rubocop 1.20.0 → 1.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/config/default.yml +19 -6
  4. data/lib/rubocop/cop/base.rb +2 -2
  5. data/lib/rubocop/cop/bundler/insecure_protocol_source.rb +12 -11
  6. data/lib/rubocop/cop/correctors/lambda_literal_to_method_corrector.rb +2 -2
  7. data/lib/rubocop/cop/correctors/line_break_corrector.rb +1 -1
  8. data/lib/rubocop/cop/layout/argument_alignment.rb +1 -1
  9. data/lib/rubocop/cop/layout/class_structure.rb +2 -1
  10. data/lib/rubocop/cop/layout/end_alignment.rb +1 -1
  11. data/lib/rubocop/cop/layout/leading_comment_space.rb +1 -1
  12. data/lib/rubocop/cop/layout/line_length.rb +1 -1
  13. data/lib/rubocop/cop/layout/multiline_block_layout.rb +1 -1
  14. data/lib/rubocop/cop/layout/single_line_block_chain.rb +15 -4
  15. data/lib/rubocop/cop/layout/space_after_not.rb +1 -0
  16. data/lib/rubocop/cop/layout/space_around_equals_in_parameter_default.rb +2 -1
  17. data/lib/rubocop/cop/layout/space_around_keyword.rb +2 -2
  18. data/lib/rubocop/cop/layout/space_before_brackets.rb +1 -0
  19. data/lib/rubocop/cop/layout/space_inside_reference_brackets.rb +1 -1
  20. data/lib/rubocop/cop/lint/ambiguous_operator_precedence.rb +107 -0
  21. data/lib/rubocop/cop/lint/ambiguous_range.rb +1 -1
  22. data/lib/rubocop/cop/lint/debugger.rb +0 -2
  23. data/lib/rubocop/cop/lint/empty_in_pattern.rb +1 -1
  24. data/lib/rubocop/cop/lint/erb_new_arguments.rb +1 -1
  25. data/lib/rubocop/cop/lint/float_out_of_range.rb +1 -1
  26. data/lib/rubocop/cop/lint/incompatible_io_select_with_fiber_scheduler.rb +67 -0
  27. data/lib/rubocop/cop/lint/number_conversion.rb +7 -1
  28. data/lib/rubocop/cop/lint/unused_method_argument.rb +2 -3
  29. data/lib/rubocop/cop/lint/useless_times.rb +1 -1
  30. data/lib/rubocop/cop/metrics/perceived_complexity.rb +1 -1
  31. data/lib/rubocop/cop/metrics/utils/abc_size_calculator.rb +1 -1
  32. data/lib/rubocop/cop/metrics/utils/code_length_calculator.rb +1 -1
  33. data/lib/rubocop/cop/mixin/code_length.rb +1 -1
  34. data/lib/rubocop/cop/mixin/frozen_string_literal.rb +11 -6
  35. data/lib/rubocop/cop/mixin/multiline_expression_indentation.rb +2 -2
  36. data/lib/rubocop/cop/mixin/preceding_following_alignment.rb +9 -1
  37. data/lib/rubocop/cop/naming/ascii_identifiers.rb +0 -3
  38. data/lib/rubocop/cop/naming/constant_name.rb +1 -1
  39. data/lib/rubocop/cop/naming/inclusive_language.rb +9 -9
  40. data/lib/rubocop/cop/style/accessor_grouping.rb +2 -2
  41. data/lib/rubocop/cop/style/and_or.rb +4 -0
  42. data/lib/rubocop/cop/style/ascii_comments.rb +0 -3
  43. data/lib/rubocop/cop/style/case_equality.rb +6 -9
  44. data/lib/rubocop/cop/style/collection_methods.rb +2 -1
  45. data/lib/rubocop/cop/style/document_dynamic_eval_definition.rb +1 -1
  46. data/lib/rubocop/cop/style/documentation.rb +23 -8
  47. data/lib/rubocop/cop/style/empty_method.rb +1 -1
  48. data/lib/rubocop/cop/style/explicit_block_argument.rb +21 -11
  49. data/lib/rubocop/cop/style/if_with_boolean_literal_branches.rb +3 -2
  50. data/lib/rubocop/cop/style/lambda_call.rb +1 -1
  51. data/lib/rubocop/cop/style/method_call_with_args_parentheses/omit_parentheses.rb +6 -6
  52. data/lib/rubocop/cop/style/mutable_constant.rb +1 -1
  53. data/lib/rubocop/cop/style/negated_if.rb +1 -1
  54. data/lib/rubocop/cop/style/negated_unless.rb +1 -1
  55. data/lib/rubocop/cop/style/non_nil_check.rb +2 -2
  56. data/lib/rubocop/cop/style/not.rb +2 -2
  57. data/lib/rubocop/cop/style/parallel_assignment.rb +1 -1
  58. data/lib/rubocop/cop/style/percent_q_literals.rb +2 -2
  59. data/lib/rubocop/cop/style/raise_args.rb +1 -1
  60. data/lib/rubocop/cop/style/redundant_condition.rb +2 -3
  61. data/lib/rubocop/cop/style/redundant_interpolation.rb +1 -1
  62. data/lib/rubocop/cop/style/redundant_percent_q.rb +2 -3
  63. data/lib/rubocop/cop/style/redundant_self_assignment_branch.rb +1 -1
  64. data/lib/rubocop/cop/style/redundant_sort.rb +17 -2
  65. data/lib/rubocop/cop/style/regexp_literal.rb +3 -3
  66. data/lib/rubocop/cop/style/return_nil.rb +2 -1
  67. data/lib/rubocop/cop/style/static_class.rb +1 -2
  68. data/lib/rubocop/cop/style/string_concatenation.rb +1 -1
  69. data/lib/rubocop/cop/style/trivial_accessors.rb +1 -1
  70. data/lib/rubocop/cop/style/yoda_condition.rb +4 -7
  71. data/lib/rubocop/result_cache.rb +1 -1
  72. data/lib/rubocop/runner.rb +1 -2
  73. data/lib/rubocop/version.rb +1 -1
  74. data/lib/rubocop.rb +3 -1
  75. metadata +5 -3
@@ -62,7 +62,7 @@ module RuboCop
62
62
  end
63
63
 
64
64
  def correct_style?(node)
65
- compact_style? && compact?(node) || expanded_style? && expanded?(node)
65
+ (compact_style? && compact?(node)) || (expanded_style? && expanded?(node))
66
66
  end
67
67
 
68
68
  def corrected(node)
@@ -67,17 +67,27 @@ module RuboCop
67
67
  # so this can cause crashes in haml_lint
68
68
  return unless def_node
69
69
 
70
+ block_name = extract_block_name(def_node)
71
+
70
72
  add_offense(block_node) do |corrector|
71
73
  corrector.remove(block_body_range(block_node, send_node))
72
74
 
73
- add_block_argument(send_node, corrector)
74
- add_block_argument(def_node, corrector) if @def_nodes.add?(def_node)
75
+ add_block_argument(send_node, corrector, block_name)
76
+ add_block_argument(def_node, corrector, block_name) if @def_nodes.add?(def_node)
75
77
  end
76
78
  end
77
79
  end
78
80
 
79
81
  private
80
82
 
83
+ def extract_block_name(def_node)
84
+ if def_node.block_argument?
85
+ def_node.arguments.last.name
86
+ else
87
+ 'block'
88
+ end
89
+ end
90
+
81
91
  def yielding_arguments?(block_args, yield_args)
82
92
  yield_args = yield_args.dup.fill(
83
93
  nil,
@@ -91,15 +101,15 @@ module RuboCop
91
101
  end
92
102
  end
93
103
 
94
- def add_block_argument(node, corrector)
104
+ def add_block_argument(node, corrector, block_name)
95
105
  if node.arguments?
96
- insert_argument(node, corrector)
106
+ insert_argument(node, corrector, block_name)
97
107
  elsif empty_arguments?(node)
98
- corrector.replace(node.arguments, '(&block)')
108
+ corrector.replace(node.arguments, "(&#{block_name})")
99
109
  elsif call_like?(node)
100
- correct_call_node(node, corrector)
110
+ correct_call_node(node, corrector, block_name)
101
111
  else
102
- corrector.insert_after(node.loc.name, '(&block)')
112
+ corrector.insert_after(node.loc.name, "(&#{block_name})")
103
113
  end
104
114
  end
105
115
 
@@ -112,16 +122,16 @@ module RuboCop
112
122
  node.call_type? || node.zsuper_type? || node.super_type?
113
123
  end
114
124
 
115
- def insert_argument(node, corrector)
125
+ def insert_argument(node, corrector, block_name)
116
126
  last_arg = node.arguments.last
117
127
  arg_range = range_with_surrounding_comma(last_arg.source_range, :right)
118
- replacement = ' &block'
128
+ replacement = " &#{block_name}"
119
129
  replacement = ",#{replacement}" unless arg_range.source.end_with?(',')
120
130
  corrector.insert_after(arg_range, replacement) unless last_arg.blockarg_type?
121
131
  end
122
132
 
123
- def correct_call_node(node, corrector)
124
- corrector.insert_after(node, '(&block)')
133
+ def correct_call_node(node, corrector, block_name)
134
+ corrector.insert_after(node, "(&#{block_name})")
125
135
  return unless node.parenthesized?
126
136
 
127
137
  args_begin = Util.args_begin(node)
@@ -109,12 +109,13 @@ module RuboCop
109
109
  end
110
110
 
111
111
  def opposite_condition?(node)
112
- !node.unless? && node.if_branch.false_type? || node.unless? && node.if_branch.true_type?
112
+ (!node.unless? && node.if_branch.false_type?) ||
113
+ (node.unless? && node.if_branch.true_type?)
113
114
  end
114
115
 
115
116
  def require_parentheses?(condition)
116
117
  condition.and_type? || condition.or_type? ||
117
- condition.send_type? && condition.comparison_method?
118
+ (condition.send_type? && condition.comparison_method?)
118
119
  end
119
120
  end
120
121
  end
@@ -52,7 +52,7 @@ module RuboCop
52
52
  private
53
53
 
54
54
  def offense?(node)
55
- explicit_style? && node.implicit_call? || implicit_style? && !node.implicit_call?
55
+ (explicit_style? && node.implicit_call?) || (implicit_style? && !node.implicit_call?)
56
56
  end
57
57
 
58
58
  def message(_node)
@@ -93,8 +93,8 @@ module RuboCop
93
93
  parent = node.parent&.block_type? ? node.parent.parent : node.parent
94
94
  parent &&
95
95
  (logical_operator?(parent) ||
96
- parent.send_type? &&
97
- parent.arguments.any? { |argument| logical_operator?(argument) })
96
+ (parent.send_type? &&
97
+ parent.arguments.any? { |argument| logical_operator?(argument) }))
98
98
  end
99
99
 
100
100
  def call_in_optional_arguments?(node)
@@ -122,14 +122,14 @@ module RuboCop
122
122
 
123
123
  def call_as_argument_or_chain?(node)
124
124
  node.parent &&
125
- (node.parent.send_type? && !assigned_before?(node.parent, node) ||
125
+ ((node.parent.send_type? && !assigned_before?(node.parent, node)) ||
126
126
  node.parent.csend_type? || node.parent.super_type? || node.parent.yield_type?)
127
127
  end
128
128
 
129
129
  def hash_literal_in_arguments?(node)
130
130
  node.arguments.any? do |n|
131
131
  hash_literal?(n) ||
132
- n.send_type? && node.descendants.any? { |descendant| hash_literal?(descendant) }
132
+ (n.send_type? && node.descendants.any? { |descendant| hash_literal?(descendant) })
133
133
  end
134
134
  end
135
135
 
@@ -171,8 +171,8 @@ module RuboCop
171
171
  end
172
172
 
173
173
  def unary_literal?(node)
174
- node.numeric_type? && node.sign? ||
175
- node.parent&.send_type? && node.parent&.unary_operation?
174
+ (node.numeric_type? && node.sign?) ||
175
+ (node.parent&.send_type? && node.parent&.unary_operation?)
176
176
  end
177
177
 
178
178
  def assigned_before?(node, target)
@@ -153,7 +153,7 @@ module RuboCop
153
153
  def check(value)
154
154
  range_enclosed_in_parentheses = range_enclosed_in_parentheses?(value)
155
155
  return unless mutable_literal?(value) ||
156
- target_ruby_version <= 2.7 && range_enclosed_in_parentheses
156
+ (target_ruby_version <= 2.7 && range_enclosed_in_parentheses)
157
157
 
158
158
  return if frozen_string_literal?(value)
159
159
  return if shareable_constant_value?(value)
@@ -90,7 +90,7 @@ module RuboCop
90
90
  end
91
91
 
92
92
  def correct_style?(node)
93
- style == :prefix && node.modifier_form? || style == :postfix && !node.modifier_form?
93
+ (style == :prefix && node.modifier_form?) || (style == :postfix && !node.modifier_form?)
94
94
  end
95
95
  end
96
96
  end
@@ -80,7 +80,7 @@ module RuboCop
80
80
  end
81
81
 
82
82
  def correct_style?(node)
83
- style == :prefix && node.modifier_form? || style == :postfix && !node.modifier_form?
83
+ (style == :prefix && node.modifier_form?) || (style == :postfix && !node.modifier_form?)
84
84
  end
85
85
  end
86
86
  end
@@ -63,7 +63,7 @@ module RuboCop
63
63
 
64
64
  def on_send(node)
65
65
  return if ignored_node?(node) ||
66
- !include_semantic_changes? && nil_comparison_style == 'comparison'
66
+ (!include_semantic_changes? && nil_comparison_style == 'comparison')
67
67
  return unless register_offense?(node)
68
68
 
69
69
  message = message(node)
@@ -87,7 +87,7 @@ module RuboCop
87
87
 
88
88
  def register_offense?(node)
89
89
  not_equal_to_nil?(node) ||
90
- include_semantic_changes? && (not_and_nil_check?(node) || unless_and_nil_check?(node))
90
+ (include_semantic_changes? && (not_and_nil_check?(node) || unless_and_nil_check?(node)))
91
91
  end
92
92
 
93
93
  def autocorrect(corrector, node)
@@ -53,8 +53,8 @@ module RuboCop
53
53
 
54
54
  def requires_parens?(child)
55
55
  child.and_type? || child.or_type? ||
56
- child.send_type? && child.binary_operation? ||
57
- child.if_type? && child.ternary?
56
+ (child.send_type? && child.binary_operation?) ||
57
+ (child.if_type? && child.ternary?)
58
58
  end
59
59
 
60
60
  def correct_opposite_method(corrector, range, child)
@@ -153,7 +153,7 @@ module RuboCop
153
153
 
154
154
  def dependency?(lhs, rhs)
155
155
  uses_var?(rhs, var_name(lhs)) ||
156
- lhs.send_type? && lhs.assignment_method? && accesses?(rhs, lhs)
156
+ (lhs.send_type? && lhs.assignment_method? && accesses?(rhs, lhs))
157
157
  end
158
158
 
159
159
  # `lhs` is an assignment method call like `obj.attr=` or `ary[idx]=`.
@@ -53,8 +53,8 @@ module RuboCop
53
53
  end
54
54
 
55
55
  def correct_literal_style?(node)
56
- style == :lower_case_q && type(node) == '%q' ||
57
- style == :upper_case_q && type(node) == '%Q'
56
+ (style == :lower_case_q && type(node) == '%q') ||
57
+ (style == :upper_case_q && type(node) == '%Q')
58
58
  end
59
59
 
60
60
  def message(_range)
@@ -141,7 +141,7 @@ module RuboCop
141
141
  end
142
142
 
143
143
  def requires_parens?(parent)
144
- parent.and_type? || parent.or_type? || parent.if_type? && parent.ternary?
144
+ parent.and_type? || parent.or_type? || (parent.if_type? && parent.ternary?)
145
145
  end
146
146
  end
147
147
  end
@@ -120,11 +120,10 @@ module RuboCop
120
120
  end
121
121
 
122
122
  def require_parentheses?(node)
123
- node.basic_conditional? &&
124
- node.modifier_form? ||
123
+ (node.basic_conditional? && node.modifier_form?) ||
125
124
  node.range_type? ||
126
125
  node.rescue_type? ||
127
- node.respond_to?(:semantic_operator?) && node.semantic_operator?
126
+ (node.respond_to?(:semantic_operator?) && node.semantic_operator?)
128
127
  end
129
128
 
130
129
  def without_argument_parentheses_method?(node)
@@ -56,7 +56,7 @@ module RuboCop
56
56
  first_child = node.children.first
57
57
 
58
58
  variable_interpolation?(first_child) ||
59
- first_child.send_type? && !first_child.operator_method?
59
+ (first_child.send_type? && !first_child.operator_method?)
60
60
  end
61
61
 
62
62
  def interpolation?(node)
@@ -65,9 +65,8 @@ module RuboCop
65
65
  end
66
66
 
67
67
  def allowed_percent_q?(node)
68
- node.source.start_with?(PERCENT_Q) && acceptable_q?(node) ||
69
- node.source.start_with?(PERCENT_CAPITAL_Q) &&
70
- acceptable_capital_q?(node)
68
+ (node.source.start_with?(PERCENT_Q) && acceptable_q?(node)) ||
69
+ (node.source.start_with?(PERCENT_CAPITAL_Q) && acceptable_capital_q?(node))
71
70
  end
72
71
 
73
72
  def message(node)
@@ -58,7 +58,7 @@ module RuboCop
58
58
 
59
59
  def inconvertible_to_modifier?(if_branch, else_branch)
60
60
  multiple_statements?(if_branch) || multiple_statements?(else_branch) ||
61
- else_branch.respond_to?(:elsif?) && else_branch.elsif?
61
+ (else_branch.respond_to?(:elsif?) && else_branch.elsif?)
62
62
  end
63
63
 
64
64
  def multiple_statements?(branch)
@@ -76,13 +76,30 @@ module RuboCop
76
76
 
77
77
  def on_send(node)
78
78
  if (sort_node, sorter, accessor = redundant_sort?(node.parent))
79
+ return if use_size_method_in_block?(sort_node)
80
+
79
81
  ancestor = node.parent
80
82
  elsif (sort_node, sorter, accessor = redundant_sort?(node.parent&.parent))
83
+ return if use_size_method_in_block?(sort_node)
84
+
81
85
  ancestor = node.parent.parent
82
86
  else
83
87
  return
84
88
  end
85
89
 
90
+ register_offense(ancestor, sort_node, sorter, accessor)
91
+ end
92
+
93
+ private
94
+
95
+ def use_size_method_in_block?(sort_node)
96
+ return true if sort_node.send_type? && sort_node.block_node&.body&.method?(:size)
97
+ return false unless sort_node.block_argument?
98
+
99
+ sort_node.last_argument.children.first.value == :size
100
+ end
101
+
102
+ def register_offense(ancestor, sort_node, sorter, accessor)
86
103
  message = message(ancestor, sorter, accessor)
87
104
 
88
105
  add_offense(offense_range(sort_node, ancestor), message: message) do |corrector|
@@ -90,8 +107,6 @@ module RuboCop
90
107
  end
91
108
  end
92
109
 
93
- private
94
-
95
110
  def autocorrect(corrector, node, sort_node, sorter, accessor)
96
111
  # Remove accessor, e.g. `first` or `[-1]`.
97
112
  corrector.remove(range_between(accessor_start(node), node.loc.expression.end_pos))
@@ -107,7 +107,7 @@ module RuboCop
107
107
  private
108
108
 
109
109
  def allowed_slash_literal?(node)
110
- style == :slashes && !contains_disallowed_slash?(node) || allowed_mixed_slash?(node)
110
+ (style == :slashes && !contains_disallowed_slash?(node)) || allowed_mixed_slash?(node)
111
111
  end
112
112
 
113
113
  def allowed_mixed_slash?(node)
@@ -115,13 +115,13 @@ module RuboCop
115
115
  end
116
116
 
117
117
  def allowed_percent_r_literal?(node)
118
- style == :slashes && contains_disallowed_slash?(node) ||
118
+ (style == :slashes && contains_disallowed_slash?(node)) ||
119
119
  style == :percent_r ||
120
120
  allowed_mixed_percent_r?(node) || allowed_omit_parentheses_with_percent_r_literal?(node)
121
121
  end
122
122
 
123
123
  def allowed_mixed_percent_r?(node)
124
- style == :mixed && node.multiline? || contains_disallowed_slash?(node)
124
+ (style == :mixed && node.multiline?) || contains_disallowed_slash?(node)
125
125
  end
126
126
 
127
127
  def contains_disallowed_slash?(node)
@@ -74,7 +74,8 @@ module RuboCop
74
74
  end
75
75
 
76
76
  def correct_style?(node)
77
- style == :return && !return_nil_node?(node) || style == :return_nil && !return_node?(node)
77
+ (style == :return && !return_nil_node?(node)) ||
78
+ (style == :return_nil && !return_node?(node))
78
79
  end
79
80
 
80
81
  def scoped_node?(node)
@@ -60,8 +60,7 @@ module RuboCop
60
60
  return false if nodes.empty?
61
61
 
62
62
  nodes.all? do |node|
63
- node_visibility(node) == :public &&
64
- node.defs_type? ||
63
+ (node_visibility(node) == :public && node.defs_type?) ||
65
64
  sclass_convertible_to_module?(node) ||
66
65
  node.equals_asgn? ||
67
66
  extend_call?(node)
@@ -93,7 +93,7 @@ module RuboCop
93
93
 
94
94
  def offensive_for_mode?(receiver_node)
95
95
  mode = cop_config['Mode'].to_sym
96
- mode == :aggressive || mode == :conservative && receiver_node.str_type?
96
+ mode == :aggressive || (mode == :conservative && receiver_node.str_type?)
97
97
  end
98
98
 
99
99
  def line_end_concatenation?(node)
@@ -192,7 +192,7 @@ module RuboCop
192
192
 
193
193
  def allowed_method_name?(node)
194
194
  allowed_method_names.include?(node.method_name) ||
195
- exact_name_match? && !names_match?(node)
195
+ (exact_name_match? && !names_match?(node))
196
196
  end
197
197
 
198
198
  def allowed_writer?(method_name)
@@ -58,14 +58,11 @@ module RuboCop
58
58
  extend AutoCorrector
59
59
 
60
60
  MSG = 'Reverse the order of the operands `%<source>s`.'
61
-
62
61
  REVERSE_COMPARISON = { '<' => '>', '<=' => '>=', '>' => '<', '>=' => '<=' }.freeze
63
-
64
62
  EQUALITY_OPERATORS = %i[== !=].freeze
65
-
66
63
  NONCOMMUTATIVE_OPERATORS = %i[===].freeze
67
-
68
64
  PROGRAM_NAMES = %i[$0 $PROGRAM_NAME].freeze
65
+ RESTRICT_ON_SEND = RuboCop::AST::Node::COMPARISON_OPERATORS
69
66
 
70
67
  # @!method file_constant_equal_program_name?(node)
71
68
  def_node_matcher :file_constant_equal_program_name?, <<~PATTERN
@@ -74,7 +71,7 @@ module RuboCop
74
71
 
75
72
  def on_send(node)
76
73
  return unless yoda_compatible_condition?(node)
77
- return if equality_only? && non_equality_operator?(node) ||
74
+ return if (equality_only? && non_equality_operator?(node)) ||
78
75
  file_constant_equal_program_name?(node)
79
76
 
80
77
  valid_yoda?(node) || add_offense(node) do |corrector|
@@ -102,8 +99,8 @@ module RuboCop
102
99
  lhs = node.receiver
103
100
  rhs = node.first_argument
104
101
 
105
- return true if lhs.literal? && rhs.literal? ||
106
- !lhs.literal? && !rhs.literal? ||
102
+ return true if (lhs.literal? && rhs.literal?) ||
103
+ (!lhs.literal? && !rhs.literal?) ||
107
104
  interpolation?(lhs)
108
105
 
109
106
  enforce_yoda? ? lhs.literal? : rhs.literal?
@@ -45,7 +45,7 @@ module RuboCop
45
45
  def remove_oldest_files(files, dirs, cache_root, verbose)
46
46
  # Add 1 to half the number of files, so that we remove the file if
47
47
  # there's only 1 left.
48
- remove_count = 1 + files.length / 2
48
+ remove_count = 1 + (files.length / 2)
49
49
  puts "Removing the #{remove_count} oldest files from #{cache_root}" if verbose
50
50
  sorted = files.sort_by { |path| File.mtime(path) }
51
51
  remove_files(sorted, dirs, remove_count)
@@ -216,8 +216,7 @@ module RuboCop
216
216
  def cached_run?
217
217
  @cached_run ||=
218
218
  (@options[:cache] == 'true' ||
219
- @options[:cache] != 'false' &&
220
- @config_store.for_pwd.for_all_cops['UseCache']) &&
219
+ (@options[:cache] != 'false' && @config_store.for_pwd.for_all_cops['UseCache'])) &&
221
220
  # When running --auto-gen-config, there's some processing done in the
222
221
  # cops related to calculating the Max parameters for Metrics cops. We
223
222
  # need to do that processing and cannot use caching.