-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
allow autocorrect to be turned off for specific cops by configuration #1657
Conversation
55ee3e2
to
0b37b72
Compare
@@ -6,6 +6,7 @@ | |||
|
|||
* [#1604](https://github.com/bbatsov/rubocop/issues/1604): Add `IgnoreClassMethods` option to `TrivialAccessors` cop. ([@bbatsov][]) | |||
* [#1651](https://github.com/bbatsov/rubocop/issues/1651): The `Style/SpaceAroundOperators` cop now also detects extra spaces around operators. A list of operators that *may* be surrounded by multiple spaces is configurable. ([@bquorning][]) | |||
* [#1657](https://github.com/bbatsov/rubocop/issues/1626): Autocorrect can be turned off on a specific cop via the configuration ([@jdoconnor][]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
End this sentence in with .
and add yourself to the bottom of this file.
Please, capitalise the commit message and refer the issue it fixes like this |
|
||
context 'when the option is false' do | ||
let(:options) { { auto_correct: false }} | ||
it { should be_falsey } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the method always returns a boolean, you could use be false
and be true
instead of be_falsey
and be_truthy
.
@jdoconnor Ping :-) |
0b37b72
to
01437c3
Compare
updated. Thanks for the suggestions! |
b1c2888
to
282460a
Compare
awkward... the class file for cop is now too long by style rules. I'll take a look at refactoring. |
…ps by configuration
282460a
to
849a822
Compare
module Cop | ||
# This module encapsulates the logic for autocorrect behaviour for a cop | ||
module AutocorrectLogic | ||
def autocorrect? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure extracting this into a module is a good idea. After all, this functionality doesn't make sense outside anything but a cop.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the other hand it's some separation of concerns, similar to what we did for the Utils
. Design is hard... :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tell me about it :)
all better. |
allow autocorrect to be turned off for specific cops by configuration
👍 |
In a configuration yml, you can now specify
to turn off autocorrect for a specific cop
closes #1626