I run rubocop from my pre-commit hook script:
bin/bundle exec rubocop ${FILES}
with ${FILES}
being the list of files staged for commit. This does not, however, honour the contents of the AllCops/Exclude
section in rubocop.yml
.
Since there are files that will always generate offences (e.g. schema.rb), is there a way to make the config Exclude
section precede the command line parameters?
rubocop
has command-line option --force-exclusion
which excludes files specified in the .rubocop.yml
Exclude
section. This was added on pull request 922.