Using Rubocop
CLI commands
Run
$ bundle exec rubocop
Run and fix issues automatically
$ bundle exec rubocop --safe-auto-correct
Same but for cowboys!
$ bundle exec rubocop -a
Do that to staged files only
rubocop -a `git diff --name-only --cached | grep '\.rb'`
Generate a ‘todo’ config file to exclude all current isssues
$ rubocop --auto-gen-config
Config options
Config is in .rubocop.yml
.
Some rules are configurable
Layout/LineLength:
Max: 90
Some rules don’t make sense
Bundler/OrderedGems:
Enabled: false
Or you may want to disable everything to then start slowly whitelisting rules
AllCops:
DisabledByDefault: true