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

[Fix #4402] Add Cop.autocorrect_incompatible_with #4403

Merged

Conversation

backus
Copy link
Contributor

@backus backus commented May 22, 2017

With this change, cops can now specify which cops their autocorrect
functionality is incompatible with. This makes it easier for third
party cops to specify cops they are not compatible with and have that
incompatibility be respected during correction. Autocorrect mapping
is not resolved on boot so this should play well with third party
extensions like rubocop-rspec.


Before submitting the PR make sure the following are checked:

  • Wrote good commit messages.
  • Commit message starts with [Fix #issue-number] (if the related issue exists).
  • Used the same coding conventions as the rest of the project.
  • Feature branch is up-to-date with master (if not - rebase it).
  • Squashed related commits together.
  • Added tests.
  • Added an entry to the Changelog if the new code introduces user-observable changes. See changelog entry format.
  • All tests are passing.
  • The new code doesn't generate RuboCop offenses.
  • The PR relates to only one subject with a clear title
    and description in grammatically correct, complete sentences.
  • Updated cop documentation with rake generate_cops_documentation (required only when you've added a new cop or changed the configuration/documentation of an existing cop).

@backus backus force-pushed the refactor/team-autocorrect-incompatability branch from 4a918e8 to 5a36129 Compare May 22, 2017 05:22
With this change, cops can now specify which cops their autocorrect
functionality is incompatible with. This makes it easier for third
party cops to specify cops they are not compatible with and have that
incompatibility be respected during correction. Autocorrect mapping
is not resolved on boot so this should play well with third party
extensions like rubocop-rspec.
@backus backus force-pushed the refactor/team-autocorrect-incompatability branch from 5a36129 to 9d95422 Compare May 22, 2017 05:23
@bbatsov
Copy link
Collaborator

bbatsov commented May 22, 2017

I wonder if something else couldn't be added about the cop renamings. Right now that mapping is hardcoded as well in a hash and it's not exactly easy to find.

@backus
Copy link
Contributor Author

backus commented May 22, 2017

That would be great. Same with config options I think? I had to do something hacky for rubocop-rspec I believe when I renamed some configuration

@Drenmi
Copy link
Collaborator

Drenmi commented May 22, 2017

I think this is so much better in terms of discoverability. 🙂

@backus
Copy link
Contributor Author

backus commented May 22, 2017

I wonder if something else couldn't be added about the cop renamings. Right now that mapping is hardcoded as well in a hash and it's not exactly easy to find.

@bbatsov I agree but just to be clear you're not saying that should come in this PR, right?

@bbatsov
Copy link
Collaborator

bbatsov commented May 22, 2017

@bbatsov I agree but just to be clear you're not saying that should come in this PR, right?

Sure. Just remembered I dislike the code we use to track renamings. It's not exactly the same, though - the current code also tracks removed cops. But it will still be an improvement to separate the concerns there.

@bbatsov bbatsov merged commit 47287b0 into rubocop:master May 22, 2017
@backus backus deleted the refactor/team-autocorrect-incompatability branch May 22, 2017 06:39
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.

3 participants