Skip to content
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

Merged
merged 1 commit into from
Mar 7, 2015

Conversation

jdoconnor
Copy link
Contributor

In a configuration yml, you can now specify

UnusedBlockArgument:
  AutoCorrect: False

to turn off autocorrect for a specific cop
closes #1626

@@ -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][])
Copy link
Collaborator

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.

@bbatsov
Copy link
Collaborator

bbatsov commented Feb 28, 2015

Please, capitalise the commit message and refer the issue it fixes like this [Fix #n] Allow.... You'll also have to rebase this branch on top of the current master.


context 'when the option is false' do
let(:options) { { auto_correct: false }}
it { should be_falsey }
Copy link
Contributor

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.

@bbatsov
Copy link
Collaborator

bbatsov commented Mar 7, 2015

@jdoconnor Ping :-)

@jdoconnor
Copy link
Contributor Author

updated. Thanks for the suggestions!

@jdoconnor jdoconnor force-pushed the autocorrect-cop-specific branch 2 times, most recently from b1c2888 to 282460a Compare March 7, 2015 15:57
@jdoconnor
Copy link
Contributor Author

awkward... the class file for cop is now too long by style rules. I'll take a look at refactoring.

module Cop
# This module encapsulates the logic for autocorrect behaviour for a cop
module AutocorrectLogic
def autocorrect?
Copy link
Collaborator

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.

Copy link
Collaborator

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... :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tell me about it :)

@jdoconnor
Copy link
Contributor Author

all better.

bbatsov added a commit that referenced this pull request Mar 7, 2015
allow autocorrect to be turned off for specific cops by configuration
@bbatsov bbatsov merged commit 294510c into rubocop:master Mar 7, 2015
@bbatsov
Copy link
Collaborator

bbatsov commented Mar 7, 2015

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow autocorrect to be configured by cop
3 participants