You’ve got linting errors. Red text everywhere. I’ve been there more times than I can count. This agent fixes those violations so you can get back to building.
Here’s how you tackle this:
Gemfile, package.json, or CI config. Know what you’re dealing with.This is the standard Ruby linter. You’ll find the config in .rubocop.yml.
# Check violations
bundle exec rubocop
# Auto-fix safe violations
bundle exec rubocop -a
# Auto-fix all (including unsafe)
bundle exec rubocop -A
# Check specific files/directories
bundle exec rubocop app/models/
# Show only offenses (no file list)
bundle exec rubocop --format simple
# Generate TODO file for existing offenses
bundle exec rubocop --auto-gen-config
Zero-config Ruby style guide. No .rubocop.yml needed. You either love it or you don’t.
# Check violations
bundle exec standardrb
# Auto-fix
bundle exec standardrb --fix
# Check specific files
bundle exec standardrb app/models/user.rb
Ruby formatter and linter with AST-based formatting. Pretty aggressive about its opinions.
# Check formatting
bundle exec stree check app/
# Auto-format
bundle exec stree write app/
# Format specific file
bundle exec stree write app/models/user.rb
The official ERB linter. Config lives in .erb-lint.yml.
# Check all ERB files
bundle exec erblint --lint-all
# Auto-fix
bundle exec erblint --lint-all --autocorrect
# Check specific files
bundle exec erblint app/views/users/
# Enable all linters
bundle exec erblint --enable-all-linters --lint-all
Newer ERB linter with HTML validation. Worth checking out if erb_lint isn’t cutting it.
# Check ERB files
npx @herb-tools/linter
# Auto-fix
npx @herb-tools/linter --fix
# Format ERB
npx herb-format [path]
# Analyze Ruby in ERB
bundle exec herb analyze .
Ruby gem for formatting HTML/ERB. Simple but effective.
# Format file
bundle exec htmlbeautifier app/views/users/index.html.erb
# Format all ERB files
find app/views -name "*.erb" -exec bundle exec htmlbeautifier {} \;
Static security analysis for Rails apps. You should run this regularly. Trust me.
# Run security scan
bundle exec brakeman
# Output to file
bundle exec brakeman -o brakeman-report.html
# Check specific paths
bundle exec brakeman --only-files app/controllers/
# Ignore false positives (uses config/brakeman.ignore)
bundle exec brakeman -i config/brakeman.ignore
Checks for vulnerable gem versions. Your dependencies have dependencies, and some of them have security holes.
# Check for vulnerabilities
bundle exec bundle-audit check --update
# Update vulnerability database
bundle exec bundle-audit update
Detects code smells in Ruby. It’s opinionated, but usually right.
# Check all Ruby files
bundle exec reek
# Check specific directory
bundle exec reek app/models/
# Show smell types
bundle exec reek --show-configuration-path
Finds duplicate code. Copy-paste detection at its finest.
# Find duplicates
bundle exec flay app/
# Set minimum mass threshold
bundle exec flay --mass 20 app/
Measures code complexity. High scores mean your code is doing too much.
# Check complexity
bundle exec flog app/
# Show details
bundle exec flog -d app/models/
Rails-specific code quality checks. Knows the Rails way better than most developers.
# Run checks
bundle exec rails_best_practices
# Generate config
bundle exec rails_best_practices -g
# Output HTML report
bundle exec rails_best_practices --format html --output-file rbp.html
Catches unsafe migrations before they take down your production database. This one has saved me more than once.
# Runs automatically during migrations
bundle exec rails db:migrate
# Check for unsafe operations
bundle exec rails strong_migrations:check
Validates that database constraints match model validations. Because your database and your code should agree.
bundle exec database_consistency
# Check violations
npx eslint app/javascript/
# Auto-fix
npx eslint app/javascript/ --fix
# Check specific file
npx eslint app/javascript/controllers/users_controller.js
# Check formatting
npx prettier --check "app/javascript/**/*.js"
# Auto-fix
npx prettier --write "app/javascript/**/*.js"
# Check multiple file types
npx prettier --check "**/*.{js,jsx,ts,tsx,css,scss,json,md}"
# Check violations
npx standard
# Auto-fix
npx standard --fix
# Check violations
npx stylelint "app/assets/stylesheets/**/*.scss"
# Auto-fix
npx stylelint "app/assets/stylesheets/**/*.scss" --fix
# Check YAML files
yamllint config/
# Check specific file
yamllint config/database.yml
Gradual typing for Ruby. The learning curve is steep, but it catches real bugs.
# Type check
bundle exec srb tc
# Auto-generate RBI files
bundle exec tapioca dsl
# Sync gem signatures
bundle exec tapioca gems
Ruby 3 type checking with RBS. The official approach to Ruby types.
# Type check
bundle exec steep check
# Generate RBS prototypes
bundle exec rbs prototype rb app/models/user.rb
Many Rails projects combine linters in Rake tasks. Check what’s already there:
# Common patterns
bundle exec rake lint
bundle exec rake lint:fix
bundle exec rake rubocop
bundle exec rake standard
bundle exec rake ci
# Check what's available
bundle exec rake -T | grep -E "(lint|rubocop|standard|check)"
Style violations:
Naming:
ERB:
<%= vs <%-)Security:
Here’s the thing: linting isn’t about perfection. It’s about consistency.
Gemfile and CI config to identify which linters are actually used