Skip to content

Commit 3e86c7b

Browse files
committed
Fix a build error
This commit fixes the following build error. ```consle % bundle exec rake (snip) Offenses: lib/rubocop/cop/rails/delegate.rb:103:13: W: [Correctable] Lint/AmbiguousOperatorPrecedence: Wrap expressions with varying precedence with parentheses to avoid ambiguity. include_prefix_case? && method_name == prefixed_method_name(body) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lib/rubocop/cop/rails/dynamic_find_by.rb:43:21: W: [Correctable] Lint/AmbiguousOperatorPrecedence: Wrap expressions with varying precedence with parentheses to avoid ambiguity. return if node.receiver.nil? && !inherit_active_record_base?(node) || allowed_invocation?(node) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lib/rubocop/cop/rails/http_positional_arguments.rb:72:15: W: [Correctable] Lint/AmbiguousOperatorPrecedence: Wrap expressions with varying precedence with parentheses to avoid ambiguity. format_arg?(pair.key) && data.pairs.one? ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lib/rubocop/cop/rails/pluralization_grammar.rb:64:11: W: [Correctable] Lint/AmbiguousOperatorPrecedence: Wrap expressions with varying precedence with parentheses to avoid ambiguity. singular_receiver?(number) && plural_method?(node.method_name) || ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lib/rubocop/cop/rails/pluralization_grammar.rb:65:13: W: [Correctable] Lint/AmbiguousOperatorPrecedence: Wrap expressions with varying precedence with parentheses to avoid ambiguity. plural_receiver?(number) && singular_method?(node.method_name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lib/rubocop/cop/rails/reversible_migration.rb:346:13: W: [Correctable] Lint/AmbiguousOperatorPrecedence: Wrap expressions with varying precedence with parentheses to avoid ambiguity. ancestor.block_type? && ... ^^^^^^^^^^^^^^^^^^^^^^^ 218 files inspected, 6 offenses detected, 6 offenses auto-correctable ```
1 parent efe0ec9 commit 3e86c7b

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

lib/rubocop/cop/rails/delegate.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def arguments_match?(arg_array, body)
100100

101101
def method_name_matches?(method_name, body)
102102
method_name == body.method_name ||
103-
include_prefix_case? && method_name == prefixed_method_name(body)
103+
(include_prefix_case? && method_name == prefixed_method_name(body))
104104
end
105105

106106
def include_prefix_case?

lib/rubocop/cop/rails/dynamic_find_by.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class DynamicFindBy < Base
4040
IGNORED_ARGUMENT_TYPES = %i[hash splat].freeze
4141

4242
def on_send(node)
43-
return if node.receiver.nil? && !inherit_active_record_base?(node) || allowed_invocation?(node)
43+
return if (node.receiver.nil? && !inherit_active_record_base?(node)) || allowed_invocation?(node)
4444

4545
method_name = node.method_name
4646
static_name = static_method_name(method_name)

lib/rubocop/cop/rails/http_positional_arguments.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def needs_conversion?(data)
6969

7070
data.each_pair.none? do |pair|
7171
special_keyword_arg?(pair.key) ||
72-
format_arg?(pair.key) && data.pairs.one?
72+
(format_arg?(pair.key) && data.pairs.one?)
7373
end
7474
end
7575

lib/rubocop/cop/rails/pluralization_grammar.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ def correct_method(method_name)
6161
def offense?(node)
6262
number, = *node.receiver
6363

64-
singular_receiver?(number) && plural_method?(node.method_name) ||
65-
plural_receiver?(number) && singular_method?(node.method_name)
64+
(singular_receiver?(number) && plural_method?(node.method_name)) ||
65+
(plural_receiver?(number) && singular_method?(node.method_name))
6666
end
6767

6868
def plural_method?(method_name)

lib/rubocop/cop/rails/reversible_migration.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -343,8 +343,8 @@ def within_change_method?(node)
343343

344344
def within_reversible_or_up_only_block?(node)
345345
node.each_ancestor(:block).any? do |ancestor|
346-
ancestor.block_type? &&
347-
ancestor.send_node.method?(:reversible) ||
346+
(ancestor.block_type? &&
347+
ancestor.send_node.method?(:reversible)) ||
348348
ancestor.send_node.method?(:up_only)
349349
end
350350
end

0 commit comments

Comments
 (0)