Skip to content

Commit

Permalink
Suppress a new RuboCop offense
Browse files Browse the repository at this point in the history
Follow up rubocop/rubocop#12332

This commit suppresses the following new RuboCop offense:

```console
$ bundle exec rake
(snip)

lib/rubocop/cop/rails/save_bang.rb:341:15: C: [Correctable] InternalAffairs/MethodNameEqual:
Use !node.method?(:destroy) instead.
            node.method_name != :destroy &&
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

292 files inspected, 1 offense detected, 1 offense autocorrectable
```
  • Loading branch information
koic committed Nov 3, 2023
1 parent d9c4763 commit c53f914
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/rubocop/cop/rails/save_bang.rb
Original file line number Diff line number Diff line change
Expand Up @@ -336,10 +336,10 @@ def persist_method?(node, methods = RESTRICT_ON_SEND)

# Check argument signature as no arguments or one hash
def expected_signature?(node)
!node.arguments? ||
(node.arguments.one? &&
node.method_name != :destroy &&
(node.first_argument.hash_type? || !node.first_argument.literal?))
return true unless node.arguments?
return false if !node.arguments.one? || node.method?(:destroy)

node.first_argument.hash_type? || !node.first_argument.literal?
end
end
end
Expand Down

0 comments on commit c53f914

Please sign in to comment.