Skip to content

Commit 9f96c3f

Browse files
committed
Suppress RuboCop's warning and offense
This PR suppresses the following RuboCop's warning and offense: ```console $ bundle exec rubocop rake (snip) Warning: Using `Naming/PredicateName` configuration in /Users/koic/src/github.com/rubocop/rubocop-rails/.rubocop.yml for `Naming/PredicatePrefix`. (snip) Offenses: lib/rubocop/cop/rails/save_bang.rb:230:13: C: Naming/PredicateMethod: Predicate method names should end with ?. def check_used_in_condition_or_compound_boolean(node) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 301 files inspected, 1 offense detected ```
1 parent bc95f97 commit 9f96c3f

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

.rubocop.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Naming/InclusiveLanguage:
4747
- spec/rubocop/cop/rails/dynamic_find_by_spec.rb
4848
- spec/rubocop/cop/rails/skips_model_validations_spec.rb
4949

50-
Naming/PredicateName:
50+
Naming/PredicatePrefix:
5151
# Method define macros for dynamically generated method.
5252
MethodDefinitionMacros:
5353
- define_method

lib/rubocop/cop/rails/save_bang.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ def on_send(node)
156156
return unless persist_method?(node)
157157
return if return_value_assigned?(node)
158158
return if implicit_return?(node)
159-
return if check_used_in_condition_or_compound_boolean(node)
159+
return if check_used_in_condition_or_compound_boolean?(node)
160160
return if argument?(node)
161161
return if explicit_return?(node)
162162
return if checked_immediately?(node)
@@ -227,7 +227,7 @@ def array_parent(node)
227227
array
228228
end
229229

230-
def check_used_in_condition_or_compound_boolean(node)
230+
def check_used_in_condition_or_compound_boolean?(node)
231231
return false unless in_condition_or_compound_boolean?(node)
232232

233233
register_offense(node, CREATE_CONDITIONAL_MSG) unless MODIFY_PERSIST_METHODS.include?(node.method_name)

0 commit comments

Comments
 (0)