A Ruby static code analyzer and formatter, based on the community Ruby style guide.
open sourceMITself-hostablefreeMCP
RuboCop is a Ruby linter and code formatter that enforces the community Ruby Style Guide out of the box and autocorrects many of the offenses it finds. Every check (a cop) can be turned on, off or tuned in a .rubocop.yml file, and teams write their own cops and formatters. Extension gems add cops for Rails, RSpec, Minitest, performance and more. It has a built-in language server for editors, a server mode for fast repeated runs, and since 1.85 an experimental built-in MCP server (rubocop --mcp) that lets AI agents inspect, autocorrect and explain cops.
Ways to install
Package managers
Problems it solves
- enforce a consistent Ruby style in CI
- code review keeps turning into arguments about quotes, spacing and method length
- automatically fix style problems across a whole Ruby codebase in one command
- catch likely bugs in Ruby code like unused variables and shadowed arguments before they ship
- write our own lint rule that bans a dangerous pattern in our Rails app
- show Ruby lint warnings and fixes in my editor as I type
- fail the build when someone adds a method that's too long or too complex
- adopt a linter on a legacy Ruby app without fixing thousands of existing offenses first
- let my AI coding agent check and autocorrect Ruby files it just wrote
- check our RSpec and Rails code against community best practices
- format Ruby code automatically on save
Features
- configurable cops for style, layout, lint, metrics, naming and security
- autocorrection (safe and unsafe)
- per-project .rubocop.yml with inheritance
- todo file to adopt on existing code
- custom cops and formatters
- plugins: rubocop-rails, rubocop-rspec, rubocop-performance, rubocop-minitest and more
- built-in LSP server
- server mode
- experimental built-in MCP server (rubocop --mcp, 1.85+)
Capabilities
| Has a command line tool | plan not known |
|---|---|
| Has an MCP server | plan not known |
| Takes plugins | plan not known |
Alternatives
The same job
These do what RuboCop does.
- PHP_CodeSniffer Detect and fix coding standard violations in PHP