You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Overcommit 0.59.0 added --disable-pending-cops to the default rubocop flags. This causes rubocop to now report violations in some cases, where before this change it would not.
In my project, I have explicitly configured rubocop via .rubocop.yml to enable all pending cops, like this:
AllCops:
NewCops: enable
When overcommit 0.59.0 executes rubocop, it specifies --disable-pending-cops, which contradicts and overrides my NewCops: enable setting. This causes a violation to be reported like this:
Warnings on modified lines:
/home/circleci/project/test/system/article_integration_test.rb:4:54: W: [Correctable] Lint/RedundantCopDisableDirective: Unnecessary disabling of `Minitest/MultipleAssertions`.
This is because Minitest/MultipleAssertions is a "pending" cop that I have explicitly opted into using NewCops: enable. The code in question has this comment:
# rubocop:disable Minitest/MultipleAssertions
When overcommit runs rubocop --disable-pending-cops, rubocop now treats the Minitest/MultipleAssertions cop is if it doesn't exist, thus this error:
Unnecessary disabling of `Minitest/MultipleAssertions`
My workaround is to customize my .overcommit.yml to redefine the rubocop flags, like this (i.e. omitting --disable-pending-cops):
In my opinion, overcommit should not be passing flags to rubocop that change its behavior. It should limit itself to passing flags that are purely related to command line output, like --format=emacs. If someone wants pending cops to be skipped, they should say so in .rubocop.yml like this:
Activity