Run RuboCop linter with smart defaults and auto-correction options
Executes RuboCop static analysis with intelligent defaults and auto-correction options.
/plugin marketplace add bastos/ruby-plugin-marketplace/plugin install ruby@ruby-plugin-marketplace[file or directory] [--fix]Execute RuboCop static analysis with intelligent defaults.
The user may provide:
# Verify RuboCop is available
bundle info rubocop 2>/dev/null || gem list rubocop
bundle exec rubocop path/to/file.rb
bundle exec rubocop app/models/
# Git diff files
bundle exec rubocop $(git diff --name-only --diff-filter=d HEAD | grep '\.rb$')
# Or staged files
bundle exec rubocop $(git diff --cached --name-only --diff-filter=d | grep '\.rb$')
# Safe auto-correct
bundle exec rubocop -a path/to/file.rb
# Unsafe auto-correct (may change behavior)
bundle exec rubocop -A path/to/file.rb
# Auto-correct with specific cops
bundle exec rubocop --only Style/StringLiterals -a
# Show only offenses (no file names)
bundle exec rubocop --format simple
# Show offense counts by cop
bundle exec rubocop --format offenses
# Generate TODO file for gradual adoption
bundle exec rubocop --auto-gen-config
# Check specific cops
bundle exec rubocop --only Layout,Style/StringLiterals
# Exclude specific cops
bundle exec rubocop --except Metrics/MethodLength
--format progress for quick overview--format clang for IDE-friendly output with context-D for easier lookup--parallel for faster execution on large codebases# If using Rails Omakase
bundle exec rubocop -c .rubocop.yml
# If using standardrb
bundle exec standardrb
bundle exec standardrb --fix
Explain violation categories when showing results:
/ruby:lint # Lint entire project
/ruby:lint app/models/user.rb # Lint specific file
/ruby:lint lib/ --fix # Auto-fix safe issues in lib/
/ruby:lint --fix-all # Auto-fix all issues (careful!)