
rrubocop
io.github.adrianov由 GitHub 帳號 adrianov 發布v0.8.17更新於 Oct 29, 2026
Fast RuboCop-compatible Ruby linter with MCP inspect and autocorrect tools.
概覽
相容於 RuboCop 的快速 Ruby 程式碼檢查工具,以本機 MCP 伺服器執行,讓助理在編輯程式碼時即時檢查並自動修正。
- 可以做什麼
- 檢查 Ruby 檔案或內嵌原始碼,回傳 LSP 格式的違規 JSON,並依專案 .rubocop.yml 解析路徑
- 執行自動修正,可選擇僅安全修正或全部修正;提供檔案系統路徑時會寫回檔案
- 沿用與命令列一致的 RuboCop 相容設定解析、規則集與輸出格式,涵蓋 Rails、RSpec、Performance、GraphQL 等規則
- 適用情境
- 適合助理正在編輯 Ruby 或 Rails 專案、希望在同一輪對話中看到違規並立即修正,而不必等到之後的命令列或 CI 檢查。
- 執行需求
- 需在本機安裝 rrubocop 執行檔(Homebrew、cargo 或發行版套件),並以 --mcp 參數透過 stdio 啟動。檢查程式碼與簡單 ERB 不需要 Ruby 執行環境;不支援的 ERB 會回退到 ruby 或 bundle exec ruby。未宣告任何帳號、API 金鑰或環境變數。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 rrubocop,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
rrubocop
10x faster RuboCop drop-in — same CLI, .rubocop.yml, and offense output, without maintaining RuboCop gems. Linting and simple config need no Ruby; complex ERB still does. Point it at an existing project and use it like RuboCop.
One binary — runs the same way regardless of rbenv, rvm, system Ruby, or Docker. Uses tree-sitter; no Ruby runtime required for linting or simple ERB. Unsupported ERB falls back to ruby / bundle exec ruby.
Drop-in parity: reads your existing .rubocop.yml, emits RuboCop-like text/JSON, supports -a/-A autocorrect, and grows cop coverage over time.
Baseline (shown in --help / --version): rubocop 1.91.0 with rubocop-rails 2.37.0, rubocop-performance 1.27.0, rubocop-rspec 3.9.0, rubocop-rspec_rails 2.32.0, rubocop-factory_bot 2.28.0 — pinned in src/resources/baseline.json.
Parity runs have been verified over 600+ installed Ruby gem projects (RuboCop vs rrubocop on the same trees).
Install
macOS (.tar.gz from GitHub Releases; binary + man):
Ubuntu / Debian (.deb from GitHub Releases; amd64, Ubuntu 22.04+ / Debian bookworm+):
Features
- Config — RuboCop-compatible resolution: walk-up discovery,
inherit_from/inherit_gem/require/plugins,inherit_mode(merge/override), nested.rubocop.ymloverrides,DisabledByDefault,NewCops/Enabled: pending, plus per-copEnabled/Exclude/Include/ options; public gem defaults/inherit_gemYAML are vendored by version (fromGemfile.lock, withsame_asaliases when YAML is identical) and parsed in memory; private/unlisted gems fall back tobundle info --path; simple ERB in YAML expands natively (Ruby only for unsupported tags) - Autocorrect —
-a(safe) /-A(all) - Output —
progress(marks stream as files finish),text,json,github,quiet,files, … (TTY color like RuboCop;--color/--no-color) - Directives —
# rubocop:disable/enable - Parser — tree-sitter-ruby (no Prism / no CRuby)
- Cache — content-addressed
cache.redbunder$RRUBOCOP_CACHE_DIRor$XDG_CACHE_HOME/rrubocop/~/.cache/rrubocop(same style as abcop);--cache falseskips reads but still writes - Prefer MCP with LLMs.
rrubocop --mcpis the best way to use rrubocop from an agent: the model gets offenses as soon as it writes, so it can fix and autocorrect in the same turn and ship effective code right away — not after a later CLI/CI pass. Official RustrmcpSDK; same tools as RuboCop 1.85+:rubocop_inspectionandrubocop_autocorrection
Reference implementations: nitrocop (architecture & fixtures), upstream RuboCop.
Built-in cops
Departments grow breadth-first from common RuboCop plugin sets (nitrocop / gem sources). Notable coverage:
Use rrubocop --list-cops for the full registered set, and rrubocop --list-autocorrectable-cops for cops with -a/-A support (181 with autocorrect so far; Layout complete; Style/Lint/Rails/RSpec growing).
Usage
Exit codes: 0 clean, 1 offenses at/above --fail-level, 2 error.
MCP (Model Context Protocol)
Preferred for LLM / agent workflows. Wire rrubocop as an MCP server so the model can call rubocop_inspection / rubocop_autocorrection while it edits: feedback arrives in the same turn, the agent corrects soon, and it writes clean code on the first pass instead of discovering offenses only in CI.
rrubocop --mcp runs a long-lived MCP server on stdio — same idea as RuboCop’s MCP, with no Ruby mcp gem. Tools:
Always pass path or paths (absolute file or directory preferred; path may be a string or an array). The server walks up from the first target to find .rubocop.yml. Omitting targets for filesystem ops errors out (avoids scanning $HOME when MCP cwd is mis-set). Files without a recognized Ruby extension, filename, or shebang (e.g. YAML/JSON configs) are silently skipped — same as upstream MCP, whose TargetFinder runs in :only_recognized_file_types mode — so passing mixed paths yields no Lint/Syntax noise; summary.target_file_count reflects inspected files only. A long-lived global MCP started from $HOME otherwise inherits ~/.rubocop.yml (AllCops: Enabled: false is common) and misses project cops such as RSpec/ExampleLength.
- MCP Registry name:
mcp-name: io.github.adrianov/rrubocop
Metadata lives in server.json (Cargo package on crates.io). Each v* tag publishes that listing to the MCP Registry.
Example client config (Cursor / VS Code / Windsurf):
Claude Code:
Intended for MCP clients, not interactive use.
Caching
Content-addressed cache under $RRUBOCOP_CACHE_DIR (or $XDG_CACHE_HOME/rrubocop / ~/.cache/rrubocop). Keys cover contents, version, rule revision, --only/--except, --rubocop-version, config fingerprint, and path. Auto-pruned to 20 000 entries; --cache false skips reads but still writes. Autocorrect runs bypass the cache. Nothing is written inside the project.
Benchmarks
Cold lint (cache off) on a large Rails codebase (~3.8k Ruby files), same host:
rrubocop is ≈ 22× faster wall clock than RuboCop (156.6s / 7.0s) on the same clean result. RuboCop user time was 155s; rrubocop used 71s of CPU across cores.
nitrocop caveat: out of the box it did not honor the same disabled cops / custom rules / gem configs as bundle exec rubocop (e.g. failed inherit_gem load, skipped/unimplemented cops), so it reported ~21k false positives vs RuboCop/rrubocop’s clean run. Matching that baseline needs extra setup (--migrate, plugin/config wiring). Treat the 8.9s figure as raw throughput only, not drop-in parity.
Cold lint (cache off) on rails/rails (main, RuboCop 1.79.2 via bundle exec), same host (4 cores), both clean (0 offenses). Two runs averaged:
≈ 12× faster wall clock (67.254s / 5.668s). RuboCop user time was 66.9s; rrubocop used 20.2s of CPU across cores.
Same host, cold --cache false, offense-set parity on Active Support and Active Record (fp=0, fn=0 on shared .rb files):
Cold lint on a fresh rails new app (Rails 8.1.3.1, default rubocop-rails-omakase via inherit_gem, RuboCop 1.90.0 via bundle exec), plus scaffold/model/mailer/job generators (41 identical target files). Offense-set parity fp=0, fn=0 (both clean). Two-run average:
Cross-test vs nitrocop
With a local nitrocop build:
Compares (path, line, cop_name) offense sets.
License
GPL-3.0-or-later. See NOTICE for MIT attribution of nitrocop-derived design/logic.
來源:README.md,提交 0b67072
工具
0版本歷史
10- v0.8.17最新Oct 29, 2026
- v0.8.16Oct 11, 2026
- v0.8.15Oct 1, 2026
- v0.8.14Sep 30, 2026
- v0.8.13Sep 30, 2026
- v0.8.12Sep 30, 2026
- v0.8.11Sep 24, 2026
- v0.8.10Sep 22, 2026
- v0.8.9Sep 18, 2026
- v0.8.8Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分