Skip to content

Commit

Permalink
[Fix rubocop#7236] Prevent bad auto-correction from Style/InverseMeth…
Browse files Browse the repository at this point in the history
…ods and Style/SymbolProc

These two cops had an interaction between their auto-corrections which produced
code that wasn't semantically equivalent to the original.

This change fixes that by marking `Style/InverseMethods` auto-correct as
incompatible with that of `Style/SymbolProc`.
  • Loading branch information
Drenmi committed Sep 9, 2019
1 parent 8cb0b2d commit 727e3bc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -52,6 +52,7 @@
* [#6861](https://github.com/rubocop-hq/rubocop/issues/6861): Fix a false positive for `Layout/IndentationWidth` when using `EnforcedStyle: outdent` of `Layout/AccessModifierIndentation`. ([@koic][])
* [#7235](https://github.com/rubocop-hq/rubocop/issues/7235): Fix an error where `Style/ConditionalAssignment` would swallow a nested `if` condition. ([@buehmann][])
* [#7242](https://github.com/rubocop-hq/rubocop/issues/7242): Make `Style/ConstantVisibility` work on non-trivial class and module bodies. ([@buehmann][])
* [#7236](https://github.com/rubocop-hq/rubocop/pull/7236): Mark `Style/InverseMethods` auto-correct as incompatible with `Style/SymbolProc`. ([@drenmi][])

### Changes

Expand Down
2 changes: 1 addition & 1 deletion lib/rubocop/cop/style/inverse_methods.rb
Expand Up @@ -44,7 +44,7 @@ class InverseMethods < Cop
CAMEL_CASE = /[A-Z]+[a-z]+/.freeze

def self.autocorrect_incompatible_with
[Style::Not]
[Style::Not, Style::SymbolProc]
end

def_node_matcher :inverse_candidate?, <<~PATTERN
Expand Down

0 comments on commit 727e3bc

Please sign in to comment.