rubocop 0.85.1 → 0.86.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 (100) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +16 -4
  3. data/config/default.yml +29 -1
  4. data/lib/rubocop.rb +3 -0
  5. data/lib/rubocop/cli/command/init_dotfile.rb +1 -1
  6. data/lib/rubocop/config.rb +1 -1
  7. data/lib/rubocop/config_loader_resolver.rb +1 -1
  8. data/lib/rubocop/cop/gemspec/required_ruby_version.rb +1 -1
  9. data/lib/rubocop/cop/generator/configuration_injector.rb +1 -1
  10. data/lib/rubocop/cop/layout/comment_indentation.rb +3 -3
  11. data/lib/rubocop/cop/layout/empty_comment.rb +1 -1
  12. data/lib/rubocop/cop/layout/empty_lines_around_attribute_accessor.rb +2 -0
  13. data/lib/rubocop/cop/layout/end_of_line.rb +1 -1
  14. data/lib/rubocop/cop/layout/first_argument_indentation.rb +1 -1
  15. data/lib/rubocop/cop/layout/first_array_element_line_break.rb +1 -1
  16. data/lib/rubocop/cop/layout/hash_alignment.rb +1 -1
  17. data/lib/rubocop/cop/layout/multiline_block_layout.rb +1 -1
  18. data/lib/rubocop/cop/layout/space_after_colon.rb +1 -1
  19. data/lib/rubocop/cop/layout/space_around_keyword.rb +2 -2
  20. data/lib/rubocop/cop/layout/space_around_operators.rb +1 -1
  21. data/lib/rubocop/cop/layout/space_before_block_braces.rb +14 -0
  22. data/lib/rubocop/cop/layout/space_inside_array_literal_brackets.rb +1 -1
  23. data/lib/rubocop/cop/layout/space_inside_block_braces.rb +1 -1
  24. data/lib/rubocop/cop/layout/space_inside_hash_literal_braces.rb +2 -2
  25. data/lib/rubocop/cop/lint/constant_resolution.rb +89 -0
  26. data/lib/rubocop/cop/lint/float_out_of_range.rb +1 -1
  27. data/lib/rubocop/cop/lint/format_parameter_mismatch.rb +6 -1
  28. data/lib/rubocop/cop/lint/percent_string_array.rb +1 -1
  29. data/lib/rubocop/cop/lint/percent_symbol_array.rb +1 -1
  30. data/lib/rubocop/cop/lint/raise_exception.rb +12 -4
  31. data/lib/rubocop/cop/lint/redundant_cop_disable_directive.rb +4 -2
  32. data/lib/rubocop/cop/lint/regexp_as_condition.rb +6 -0
  33. data/lib/rubocop/cop/lint/safe_navigation_with_empty.rb +1 -1
  34. data/lib/rubocop/cop/metrics/cyclomatic_complexity.rb +35 -3
  35. data/lib/rubocop/cop/metrics/utils/abc_size_calculator.rb +1 -1
  36. data/lib/rubocop/cop/metrics/utils/iterating_block.rb +61 -0
  37. data/lib/rubocop/cop/mixin/configurable_naming.rb +1 -1
  38. data/lib/rubocop/cop/mixin/documentation_comment.rb +2 -2
  39. data/lib/rubocop/cop/mixin/end_keyword_alignment.rb +1 -1
  40. data/lib/rubocop/cop/mixin/first_element_line_break.rb +1 -1
  41. data/lib/rubocop/cop/mixin/multiline_expression_indentation.rb +1 -1
  42. data/lib/rubocop/cop/mixin/parentheses.rb +1 -2
  43. data/lib/rubocop/cop/mixin/preceding_following_alignment.rb +1 -1
  44. data/lib/rubocop/cop/mixin/range_help.rb +1 -1
  45. data/lib/rubocop/cop/mixin/regexp_literal_help.rb +27 -0
  46. data/lib/rubocop/cop/mixin/string_literals_help.rb +1 -1
  47. data/lib/rubocop/cop/mixin/surrounding_space.rb +3 -3
  48. data/lib/rubocop/cop/mixin/trailing_comma.rb +1 -1
  49. data/lib/rubocop/cop/mixin/uncommunicative_name.rb +2 -2
  50. data/lib/rubocop/cop/naming/binary_operator_parameter_name.rb +1 -1
  51. data/lib/rubocop/cop/naming/file_name.rb +1 -3
  52. data/lib/rubocop/cop/naming/heredoc_delimiter_naming.rb +1 -1
  53. data/lib/rubocop/cop/style/bare_percent_literals.rb +1 -1
  54. data/lib/rubocop/cop/style/block_delimiters.rb +2 -4
  55. data/lib/rubocop/cop/style/class_and_module_children.rb +1 -1
  56. data/lib/rubocop/cop/style/command_literal.rb +1 -1
  57. data/lib/rubocop/cop/style/commented_keyword.rb +2 -2
  58. data/lib/rubocop/cop/style/conditional_assignment.rb +1 -1
  59. data/lib/rubocop/cop/style/copyright.rb +3 -3
  60. data/lib/rubocop/cop/style/disable_cops_within_source_code_directive.rb +1 -1
  61. data/lib/rubocop/cop/style/documentation.rb +2 -2
  62. data/lib/rubocop/cop/style/empty_case_condition.rb +8 -6
  63. data/lib/rubocop/cop/style/encoding.rb +1 -1
  64. data/lib/rubocop/cop/style/exponential_notation.rb +2 -2
  65. data/lib/rubocop/cop/style/frozen_string_literal_comment.rb +1 -1
  66. data/lib/rubocop/cop/style/identical_conditional_branches.rb +1 -1
  67. data/lib/rubocop/cop/style/if_inside_else.rb +1 -1
  68. data/lib/rubocop/cop/style/inverse_methods.rb +1 -1
  69. data/lib/rubocop/cop/style/ip_addresses.rb +1 -1
  70. data/lib/rubocop/cop/style/multiline_if_then.rb +1 -1
  71. data/lib/rubocop/cop/style/multiline_ternary_operator.rb +17 -6
  72. data/lib/rubocop/cop/style/nested_ternary_operator.rb +27 -0
  73. data/lib/rubocop/cop/style/next.rb +2 -2
  74. data/lib/rubocop/cop/style/numeric_literal_prefix.rb +2 -2
  75. data/lib/rubocop/cop/style/percent_literal_delimiters.rb +1 -1
  76. data/lib/rubocop/cop/style/redundant_fetch_block.rb +103 -0
  77. data/lib/rubocop/cop/style/redundant_parentheses.rb +1 -1
  78. data/lib/rubocop/cop/style/redundant_percent_q.rb +2 -2
  79. data/lib/rubocop/cop/style/redundant_regexp_character_class.rb +2 -2
  80. data/lib/rubocop/cop/style/redundant_regexp_escape.rb +14 -23
  81. data/lib/rubocop/cop/style/redundant_self.rb +6 -9
  82. data/lib/rubocop/cop/style/sample.rb +1 -1
  83. data/lib/rubocop/cop/style/semicolon.rb +1 -1
  84. data/lib/rubocop/cop/style/struct_inheritance.rb +21 -0
  85. data/lib/rubocop/cop/style/symbol_array.rb +5 -5
  86. data/lib/rubocop/cop/style/ternary_parentheses.rb +1 -1
  87. data/lib/rubocop/cop/style/word_array.rb +1 -1
  88. data/lib/rubocop/cop/style/yoda_condition.rb +18 -1
  89. data/lib/rubocop/cop/util.rb +2 -2
  90. data/lib/rubocop/cop/utils/format_string.rb +1 -1
  91. data/lib/rubocop/formatter/disabled_config_formatter.rb +1 -1
  92. data/lib/rubocop/formatter/formatter_set.rb +1 -1
  93. data/lib/rubocop/name_similarity.rb +6 -0
  94. data/lib/rubocop/path_util.rb +2 -2
  95. data/lib/rubocop/platform.rb +1 -1
  96. data/lib/rubocop/rspec/expect_offense.rb +12 -2
  97. data/lib/rubocop/target_finder.rb +1 -1
  98. data/lib/rubocop/target_ruby.rb +1 -1
  99. data/lib/rubocop/version.rb +1 -1
  100. metadata +11 -2
@@ -156,7 +156,7 @@ module RuboCop
156
156
  source_buffer = node.source_range.source_buffer
157
157
  line_range = source_buffer.line_range(node.loc.end.line)
158
158
 
159
- line_range.source =~ /^\s*\)\s*,/
159
+ /^\s*\)\s*,/.match?(line_range.source)
160
160
  end
161
161
 
162
162
  def disallowed_literal?(begin_node, node)
@@ -97,13 +97,13 @@ module RuboCop
97
97
 
98
98
  return true if STRING_INTERPOLATION_REGEXP.match?(src)
99
99
 
100
- src.scan(/\\./).any? { |s| s =~ ESCAPED_NON_BACKSLASH }
100
+ src.scan(/\\./).any? { |s| ESCAPED_NON_BACKSLASH.match?(s) }
101
101
  end
102
102
 
103
103
  def acceptable_capital_q?(node)
104
104
  src = node.source
105
105
  src.include?(QUOTE) &&
106
- (src =~ STRING_INTERPOLATION_REGEXP ||
106
+ (STRING_INTERPOLATION_REGEXP.match?(src) ||
107
107
  (node.str_type? && double_quotes_required?(src)))
108
108
  end
109
109
  end
@@ -67,8 +67,8 @@ module RuboCop
67
67
  end
68
68
 
69
69
  def each_redundant_character_class(node)
70
- each_match_range(node.loc.expression, PATTERN) do |loc|
71
- yield loc
70
+ pattern_source(node).scan(PATTERN) do
71
+ yield match_range(node.loc.begin.end, Regexp.last_match)
72
72
  end
73
73
  end
74
74
 
@@ -18,6 +18,9 @@ module RuboCop
18
18
  # # good
19
19
  # %r/foo\/bar/
20
20
  #
21
+ # # good
22
+ # %r!foo\!bar!
23
+ #
21
24
  # # bad
22
25
  # /a\-b/
23
26
  #
@@ -63,27 +66,30 @@ module RuboCop
63
66
 
64
67
  private
65
68
 
66
- def slash_literal?(node)
67
- ['/', '%r/'].include?(node.loc.begin.source)
68
- end
69
-
70
69
  def allowed_escape?(node, char, within_character_class)
71
70
  # Strictly speaking a few single-letter metachars are currently
72
71
  # unnecessary to "escape", e.g. g, i, E, F, but enumerating them is
73
72
  # rather difficult, and their behaviour could change over time with
74
73
  # different versions of Ruby so that e.g. /\g/ != /g/
75
74
  return true if /[[:alnum:]]/.match?(char)
76
- return true if ALLOWED_ALWAYS_ESCAPES.include?(char)
75
+ return true if ALLOWED_ALWAYS_ESCAPES.include?(char) || delimiter?(node, char)
77
76
 
78
- if char == '/'
79
- slash_literal?(node)
80
- elsif within_character_class
77
+ if within_character_class
81
78
  ALLOWED_WITHIN_CHAR_CLASS_METACHAR_ESCAPES.include?(char)
82
79
  else
83
80
  ALLOWED_OUTSIDE_CHAR_CLASS_METACHAR_ESCAPES.include?(char)
84
81
  end
85
82
  end
86
83
 
84
+ def delimiter?(node, char)
85
+ delimiters = [
86
+ node.loc.begin.source.chars.last,
87
+ node.loc.end.source.chars.first
88
+ ]
89
+
90
+ delimiters.include?(char)
91
+ end
92
+
87
93
  def each_escape(node)
88
94
  pattern_source(node).each_char.with_index.reduce(
89
95
  [nil, false]
@@ -109,21 +115,6 @@ module RuboCop
109
115
 
110
116
  range_between(start, start + 2)
111
117
  end
112
-
113
- def pattern_source(node)
114
- freespace_mode = freespace_mode_regexp?(node)
115
-
116
- node.children.reject(&:regopt_type?).map do |child|
117
- source = child.source
118
-
119
- if freespace_mode
120
- # Remove comments to avoid misleading results
121
- source.sub(/(?<!\\)#.*/, '')
122
- else
123
- source
124
- end
125
- end.join
126
- end
127
118
  end
128
119
  end
129
120
  end
@@ -44,6 +44,11 @@ module RuboCop
44
44
  class RedundantSelf < Cop
45
45
  MSG = 'Redundant `self` detected.'
46
46
  KERNEL_METHODS = Kernel.methods(false)
47
+ KEYWORDS = %i[alias and begin break case class def defined? do
48
+ else elsif end ensure false for if in module
49
+ next nil not or redo rescue retry return self
50
+ super then true undef unless until when while
51
+ yield __FILE__ __LINE__ __ENCODING__].freeze
47
52
 
48
53
  def self.autocorrect_incompatible_with
49
54
  [ColonMethodCall]
@@ -131,7 +136,7 @@ module RuboCop
131
136
 
132
137
  def regular_method_call?(node)
133
138
  !(node.operator_method? ||
134
- keyword?(node.method_name) ||
139
+ KEYWORDS.include?(node.method_name) ||
135
140
  node.camel_case_method? ||
136
141
  node.setter_method? ||
137
142
  node.implicit_call?)
@@ -142,14 +147,6 @@ module RuboCop
142
147
  @local_variables_scopes[node] << name
143
148
  end
144
149
 
145
- def keyword?(method_name)
146
- %i[alias and begin break case class def defined? do
147
- else elsif end ensure false for if in module
148
- next nil not or redo rescue retry return self
149
- super then true undef unless until when while
150
- yield __FILE__ __LINE__ __ENCODING__].include?(method_name)
151
- end
152
-
153
150
  def allow_self(node)
154
151
  return unless node.send_type? && node.self_receiver?
155
152
 
@@ -92,7 +92,7 @@ module RuboCop
92
92
  second.int_type? ? second.to_a.first : :unknown
93
93
  end
94
94
 
95
- def range_size(range_node)
95
+ def range_size(range_node) # rubocop:todo Metrics/CyclomaticComplexity
96
96
  vals = range_node.to_a
97
97
  return :unknown unless vals.all?(&:int_type?)
98
98
 
@@ -39,7 +39,7 @@ module RuboCop
39
39
  check_for_line_terminator_or_opener
40
40
  end
41
41
 
42
- def on_begin(node)
42
+ def on_begin(node) # rubocop:todo Metrics/CyclomaticComplexity
43
43
  return if cop_config['AllowAsExpressionSeparator']
44
44
 
45
45
  exprs = node.children
@@ -20,6 +20,8 @@ module RuboCop
20
20
  # end
21
21
  # end
22
22
  class StructInheritance < Cop
23
+ include RangeHelp
24
+
23
25
  MSG = "Don't extend an instance initialized by `Struct.new`. " \
24
26
  'Use a block to customize the struct.'
25
27
 
@@ -29,10 +31,29 @@ module RuboCop
29
31
  add_offense(node, location: node.parent_class.source_range)
30
32
  end
31
33
 
34
+ def autocorrect(node)
35
+ lambda do |corrector|
36
+ corrector.remove(range_with_surrounding_space(range: node.loc.keyword))
37
+ corrector.replace(node.loc.operator, '=')
38
+
39
+ correct_parent(node.parent_class, corrector)
40
+ end
41
+ end
42
+
32
43
  def_node_matcher :struct_constructor?, <<~PATTERN
33
44
  {(send (const nil? :Struct) :new ...)
34
45
  (block (send (const nil? :Struct) :new ...) ...)}
35
46
  PATTERN
47
+
48
+ private
49
+
50
+ def correct_parent(parent, corrector)
51
+ if parent.block_type?
52
+ corrector.remove(range_with_surrounding_space(range: parent.loc.end, newlines: false))
53
+ else
54
+ corrector.insert_after(parent.loc.expression, ' do')
55
+ end
56
+ end
36
57
  end
37
58
  end
38
59
  end
@@ -65,7 +65,7 @@ module RuboCop
65
65
  def symbols_contain_spaces?(node)
66
66
  node.children.any? do |sym|
67
67
  content, = *sym
68
- content =~ / /
68
+ / /.match?(content)
69
69
  end
70
70
  end
71
71
 
@@ -104,12 +104,12 @@ module RuboCop
104
104
  )
105
105
 
106
106
  # method name
107
- string =~ /\A[a-zA-Z_]\w*[!?]?\z/ ||
107
+ /\A[a-zA-Z_]\w*[!?]?\z/.match?(string) ||
108
108
  # instance / class variable
109
- string =~ /\A@@?[a-zA-Z_]\w*\z/ ||
109
+ /\A@@?[a-zA-Z_]\w*\z/.match?(string) ||
110
110
  # global variable
111
- string =~ /\A\$[1-9]\d*\z/ ||
112
- string =~ /\A\$[a-zA-Z_]\w*\z/ ||
111
+ /\A\$[1-9]\d*\z/.match?(string) ||
112
+ /\A\$[a-zA-Z_]\w*\z/.match?(string) ||
113
113
  special_gvars.include?(string) ||
114
114
  redefinable_operators.include?(string)
115
115
  end
@@ -174,7 +174,7 @@ module RuboCop
174
174
  end
175
175
 
176
176
  def unparenthesized_method_call?(child)
177
- method_name(child) =~ /^[a-z]/i && !child.parenthesized?
177
+ /^[a-z]/i.match?(method_name(child)) && !child.parenthesized?
178
178
  end
179
179
 
180
180
  def below_ternary_precedence?(child)
@@ -73,7 +73,7 @@ module RuboCop
73
73
  strings.any? do |s|
74
74
  string = s.str_content.dup.force_encoding(::Encoding::UTF_8)
75
75
  !string.valid_encoding? ||
76
- string !~ word_regex || string =~ / /
76
+ !word_regex.match?(string) || / /.match?(string)
77
77
  end
78
78
  end
79
79
 
@@ -19,6 +19,8 @@ module RuboCop
19
19
  # foo == "bar"
20
20
  # foo <= 42
21
21
  # bar > 10
22
+ # "#{interpolation}" == foo
23
+ # /#{interpolation}/ == foo
22
24
  #
23
25
  # @example EnforcedStyle: forbid_for_equality_operators_only
24
26
  # # bad
@@ -109,7 +111,8 @@ module RuboCop
109
111
  rhs = node.first_argument
110
112
 
111
113
  return true if lhs.literal? && rhs.literal? ||
112
- !lhs.literal? && !rhs.literal?
114
+ !lhs.literal? && !rhs.literal? ||
115
+ interpolation?(lhs)
113
116
 
114
117
  enforce_yoda? ? lhs.literal? : rhs.literal?
115
118
  end
@@ -150,6 +153,20 @@ module RuboCop
150
153
  def program_name?(name)
151
154
  PROGRAM_NAMES.include?(name)
152
155
  end
156
+
157
+ def interpolation?(node)
158
+ return true if node.dstr_type?
159
+
160
+ # TODO: Use `RegexpNode#interpolation?` when the following is released.
161
+ # https://github.com/rubocop-hq/rubocop-ast/pull/18
162
+ if node.regexp_type?
163
+ return true if node.children.any? do |child|
164
+ child.respond_to?(:begin_type?) && child.begin_type?
165
+ end
166
+ end
167
+
168
+ false
169
+ end
153
170
  end
154
171
  end
155
172
  end
@@ -14,7 +14,7 @@ module RuboCop
14
14
  module_function
15
15
 
16
16
  def comment_line?(line_source)
17
- line_source =~ /^\s*#/
17
+ /^\s*#/.match?(line_source)
18
18
  end
19
19
 
20
20
  def comment_lines?(node)
@@ -88,7 +88,7 @@ module RuboCop
88
88
 
89
89
  # Regex matches IF there is a ' or there is a \\ in the string that is
90
90
  # not preceded/followed by another \\ (e.g. "\\x34") but not "\\\\".
91
- string =~ /'|(?<! \\) \\{2}* \\ (?![\\"])/x
91
+ /'|(?<! \\) \\{2}* \\ (?![\\"])/x.match?(string)
92
92
  end
93
93
 
94
94
  def needs_escaping?(string)
@@ -120,7 +120,7 @@ module RuboCop
120
120
  end
121
121
 
122
122
  def mixed_formats?
123
- formats = format_sequences.map do |seq|
123
+ formats = format_sequences.reject(&:percent?).map do |seq|
124
124
  if seq.name
125
125
  :named
126
126
  elsif seq.max_digit_dollar_num
@@ -74,7 +74,7 @@ module RuboCop
74
74
  end
75
75
 
76
76
  def timestamp
77
- @options[:no_auto_gen_timestamp] ? '' : "on #{Time.now} "
77
+ @options[:no_auto_gen_timestamp] ? '' : "on #{Time.now.utc} "
78
78
  end
79
79
 
80
80
  def output_offenses
@@ -82,7 +82,7 @@ module RuboCop
82
82
 
83
83
  def builtin_formatter_class(specified_key)
84
84
  matching_keys = BUILTIN_FORMATTERS_FOR_KEYS.keys.select do |key|
85
- key =~ /^\[#{specified_key}\]/ || specified_key == key.delete('[]')
85
+ /^\[#{specified_key}\]/.match?(key) || specified_key == key.delete('[]')
86
86
  end
87
87
 
88
88
  raise %(No formatter for "#{specified_key}") if matching_keys.empty?
@@ -12,6 +12,12 @@ module RuboCop
12
12
  end
13
13
 
14
14
  def find_similar_names(target_name, names)
15
+ # DidYouMean::SpellChecker is not available in all versions of Ruby, and
16
+ # even on versions where it *is* available (>= 2.3), it is not always
17
+ # required correctly. So we do a feature check first.
18
+ # See: https://github.com/rubocop-hq/rubocop/issues/7979
19
+ return [] unless defined?(DidYouMean::SpellChecker)
20
+
15
21
  names = names.dup
16
22
  names.delete(target_name)
17
23
 
@@ -40,7 +40,7 @@ module RuboCop
40
40
  hidden_file_in_not_hidden_dir?(pattern, path)
41
41
  when Regexp
42
42
  begin
43
- path =~ pattern
43
+ pattern.match?(path)
44
44
  rescue ArgumentError => e
45
45
  return false if e.message.start_with?('invalid byte sequence')
46
46
 
@@ -51,7 +51,7 @@ module RuboCop
51
51
 
52
52
  # Returns true for an absolute Unix or Windows path.
53
53
  def absolute?(path)
54
- path =~ %r{\A([A-Z]:)?/}i
54
+ %r{\A([A-Z]:)?/}i.match?(path)
55
55
  end
56
56
 
57
57
  def self.pwd
@@ -5,7 +5,7 @@ module RuboCop
5
5
  # on.
6
6
  module Platform
7
7
  def self.windows?
8
- RbConfig::CONFIG['host_os'] =~ /cygwin|mswin|mingw|bccwin|wince|emx/
8
+ /cygwin|mswin|mingw|bccwin|wince|emx/.match?(RbConfig::CONFIG['host_os'])
9
9
  end
10
10
  end
11
11
  end
@@ -72,19 +72,29 @@ module RuboCop
72
72
  #
73
73
  # expect_no_corrections
74
74
  #
75
- # If your code has variables of different lengths, you can use `%{foo}`
76
- # and `^{foo}` to format your template:
75
+ # If your code has variables of different lengths, you can use `%{foo}`,
76
+ # `^{foo}`, and `_{foo}` to format your template:
77
77
  #
78
78
  # %w[raise fail].each do |keyword|
79
79
  # expect_offense(<<~RUBY, keyword: keyword)
80
80
  # %{keyword}(RuntimeError, msg)
81
81
  # ^{keyword}^^^^^^^^^^^^^^^^^^^ Redundant `RuntimeError` argument can be removed.
82
82
  # RUBY
83
+ #
84
+ # %w[has_one has_many].each do |type|
85
+ # expect_offense(<<~RUBY, type: type)
86
+ # class Book
87
+ # %{type} :chapter, foreign_key: 'book_id'
88
+ # _{type} ^^^^^^^^^^^^^^^^^^^^^^ Specifying the default value is redundant.
89
+ # end
90
+ # RUBY
91
+ # end
83
92
  module ExpectOffense
84
93
  def format_offense(source, **replacements)
85
94
  replacements.each do |keyword, value|
86
95
  source = source.gsub("%{#{keyword}}", value)
87
96
  .gsub("^{#{keyword}}", '^' * value.size)
97
+ .gsub("_{#{keyword}}", ' ' * value.size)
88
98
  end
89
99
  source
90
100
  end
@@ -139,7 +139,7 @@ module RuboCop
139
139
  return false unless File.extname(file).empty? && File.exist?(file)
140
140
 
141
141
  first_line = File.open(file, &:readline)
142
- !(first_line =~ /#!.*(#{ruby_interpreters(file).join('|')})/).nil?
142
+ /#!.*(#{ruby_interpreters(file).join('|')})/.match?(first_line)
143
143
  rescue EOFError, ArgumentError => e
144
144
  warn("Unprocessable file #{file}: #{e.class}, #{e.message}") if debug?
145
145
 
@@ -7,7 +7,7 @@ module RuboCop
7
7
  DEFAULT_VERSION = KNOWN_RUBIES.first
8
8
 
9
9
  OBSOLETE_RUBIES = {
10
- 1.9 => '0.50', 2.0 => '0.50', 2.1 => '0.58', 2.2 => '0.69', 2.3 => '0.81'
10
+ 1.9 => '0.41', 2.0 => '0.50', 2.1 => '0.57', 2.2 => '0.68', 2.3 => '0.81'
11
11
  }.freeze
12
12
  private_constant :KNOWN_RUBIES, :OBSOLETE_RUBIES
13
13
 
@@ -3,7 +3,7 @@
3
3
  module RuboCop
4
4
  # This module holds the RuboCop version information.
5
5
  module Version
6
- STRING = '0.85.1'
6
+ STRING = '0.86.0'
7
7
 
8
8
  MSG = '%<version>s (using Parser %<parser_version>s, '\
9
9
  'rubocop-ast %<rubocop_ast_version>s, ' \
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.85.1
4
+ version: 0.86.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bozhidar Batsov
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2020-06-07 00:00:00.000000000 Z
13
+ date: 2020-06-22 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: parallel
@@ -95,6 +95,9 @@ dependencies:
95
95
  - - ">="
96
96
  - !ruby/object:Gem::Version
97
97
  version: 0.0.3
98
+ - - "<"
99
+ - !ruby/object:Gem::Version
100
+ version: '1.0'
98
101
  type: :runtime
99
102
  prerelease: false
100
103
  version_requirements: !ruby/object:Gem::Requirement
@@ -102,6 +105,9 @@ dependencies:
102
105
  - - ">="
103
106
  - !ruby/object:Gem::Version
104
107
  version: 0.0.3
108
+ - - "<"
109
+ - !ruby/object:Gem::Version
110
+ version: '1.0'
105
111
  - !ruby/object:Gem::Dependency
106
112
  name: ruby-progressbar
107
113
  requirement: !ruby/object:Gem::Requirement
@@ -332,6 +338,7 @@ files:
332
338
  - lib/rubocop/cop/lint/big_decimal_new.rb
333
339
  - lib/rubocop/cop/lint/boolean_symbol.rb
334
340
  - lib/rubocop/cop/lint/circular_argument_reference.rb
341
+ - lib/rubocop/cop/lint/constant_resolution.rb
335
342
  - lib/rubocop/cop/lint/debugger.rb
336
343
  - lib/rubocop/cop/lint/deprecated_class_methods.rb
337
344
  - lib/rubocop/cop/lint/deprecated_open_ssl_constant.rb
@@ -421,6 +428,7 @@ files:
421
428
  - lib/rubocop/cop/metrics/parameter_lists.rb
422
429
  - lib/rubocop/cop/metrics/perceived_complexity.rb
423
430
  - lib/rubocop/cop/metrics/utils/abc_size_calculator.rb
431
+ - lib/rubocop/cop/metrics/utils/iterating_block.rb
424
432
  - lib/rubocop/cop/migration/department_name.rb
425
433
  - lib/rubocop/cop/mixin/alignment.rb
426
434
  - lib/rubocop/cop/mixin/annotation_comment.rb
@@ -636,6 +644,7 @@ files:
636
644
  - lib/rubocop/cop/style/redundant_condition.rb
637
645
  - lib/rubocop/cop/style/redundant_conditional.rb
638
646
  - lib/rubocop/cop/style/redundant_exception.rb
647
+ - lib/rubocop/cop/style/redundant_fetch_block.rb
639
648
  - lib/rubocop/cop/style/redundant_freeze.rb
640
649
  - lib/rubocop/cop/style/redundant_interpolation.rb
641
650
  - lib/rubocop/cop/style/redundant_parentheses.rb