rubocop 0.75.0 → 0.76.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.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/config/default.yml +53 -54
- data/lib/rubocop.rb +10 -9
- data/lib/rubocop/ast/builder.rb +1 -0
- data/lib/rubocop/ast/node.rb +4 -0
- data/lib/rubocop/ast/node/return_node.rb +24 -0
- data/lib/rubocop/cli.rb +7 -4
- data/lib/rubocop/comment_config.rb +2 -2
- data/lib/rubocop/config.rb +7 -0
- data/lib/rubocop/config_loader.rb +1 -1
- data/lib/rubocop/config_loader_resolver.rb +2 -1
- data/lib/rubocop/config_obsoletion.rb +9 -0
- data/lib/rubocop/config_validator.rb +24 -15
- data/lib/rubocop/cop/commissioner.rb +15 -7
- data/lib/rubocop/cop/cop.rb +10 -6
- data/lib/rubocop/cop/corrector.rb +8 -7
- data/lib/rubocop/cop/correctors/percent_literal_corrector.rb +1 -1
- data/lib/rubocop/cop/generator/configuration_injector.rb +1 -1
- data/lib/rubocop/cop/layout/align_hash.rb +6 -2
- data/lib/rubocop/cop/layout/comment_indentation.rb +10 -13
- data/lib/rubocop/cop/layout/empty_comment.rb +7 -16
- data/lib/rubocop/cop/layout/empty_line_after_guard_clause.rb +22 -7
- data/lib/rubocop/cop/layout/empty_line_after_magic_comment.rb +2 -2
- data/lib/rubocop/cop/layout/empty_lines_around_class_body.rb +2 -2
- data/lib/rubocop/cop/layout/end_of_line.rb +8 -3
- data/lib/rubocop/cop/layout/indent_assignment.rb +2 -1
- data/lib/rubocop/cop/layout/indent_first_argument.rb +9 -7
- data/lib/rubocop/cop/layout/indent_first_hash_element.rb +1 -1
- data/lib/rubocop/cop/layout/multiline_assignment_layout.rb +1 -1
- data/lib/rubocop/cop/layout/rescue_ensure_alignment.rb +2 -0
- data/lib/rubocop/cop/layout/space_in_lambda_literal.rb +9 -7
- data/lib/rubocop/cop/layout/space_inside_array_literal_brackets.rb +7 -4
- data/lib/rubocop/cop/layout/space_inside_parens.rb +6 -6
- data/lib/rubocop/cop/layout/trailing_whitespace.rb +18 -2
- data/lib/rubocop/cop/lint/erb_new_arguments.rb +9 -8
- data/lib/rubocop/cop/lint/missing_cop_enable_directive.rb +2 -2
- data/lib/rubocop/cop/lint/{unneeded_cop_disable_directive.rb → redundant_cop_disable_directive.rb} +23 -23
- data/lib/rubocop/cop/lint/{unneeded_cop_enable_directive.rb → redundant_cop_enable_directive.rb} +6 -8
- data/lib/rubocop/cop/lint/{unneeded_require_statement.rb → redundant_require_statement.rb} +1 -1
- data/lib/rubocop/cop/lint/{unneeded_splat_expansion.rb → redundant_splat_expansion.rb} +5 -5
- data/lib/rubocop/cop/lint/safe_navigation_chain.rb +5 -6
- data/lib/rubocop/cop/lint/unused_block_argument.rb +22 -6
- data/lib/rubocop/cop/lint/unused_method_argument.rb +23 -5
- data/lib/rubocop/cop/lint/void.rb +7 -26
- data/lib/rubocop/cop/metrics/abc_size.rb +1 -1
- data/lib/rubocop/cop/metrics/line_length.rb +1 -4
- data/lib/rubocop/cop/metrics/utils/abc_size_calculator.rb +23 -6
- data/lib/rubocop/cop/mixin/method_complexity.rb +2 -1
- data/lib/rubocop/cop/mixin/statement_modifier.rb +5 -2
- data/lib/rubocop/cop/mixin/trailing_comma.rb +8 -6
- data/lib/rubocop/cop/naming/file_name.rb +12 -5
- data/lib/rubocop/cop/registry.rb +1 -1
- data/lib/rubocop/cop/style/attr.rb +2 -2
- data/lib/rubocop/cop/style/braces_around_hash_parameters.rb +6 -6
- data/lib/rubocop/cop/style/comment_annotation.rb +5 -5
- data/lib/rubocop/cop/style/copyright.rb +11 -7
- data/lib/rubocop/cop/style/documentation_method.rb +44 -0
- data/lib/rubocop/cop/style/double_cop_disable_directive.rb +2 -2
- data/lib/rubocop/cop/style/empty_case_condition.rb +2 -2
- data/lib/rubocop/cop/style/empty_literal.rb +2 -2
- data/lib/rubocop/cop/style/empty_method.rb +5 -5
- data/lib/rubocop/cop/style/expand_path_arguments.rb +1 -1
- data/lib/rubocop/cop/style/format_string.rb +10 -7
- data/lib/rubocop/cop/style/format_string_token.rb +15 -34
- data/lib/rubocop/cop/style/frozen_string_literal_comment.rb +10 -0
- data/lib/rubocop/cop/style/hash_syntax.rb +2 -2
- data/lib/rubocop/cop/style/if_unless_modifier.rb +9 -2
- data/lib/rubocop/cop/style/infinite_loop.rb +4 -3
- data/lib/rubocop/cop/style/inverse_methods.rb +19 -13
- data/lib/rubocop/cop/style/line_end_concatenation.rb +14 -10
- data/lib/rubocop/cop/style/method_call_with_args_parentheses.rb +20 -20
- data/lib/rubocop/cop/style/method_def_parentheses.rb +17 -9
- data/lib/rubocop/cop/style/multiline_when_then.rb +1 -1
- data/lib/rubocop/cop/style/nested_modifier.rb +4 -2
- data/lib/rubocop/cop/style/non_nil_check.rb +21 -9
- data/lib/rubocop/cop/style/{unneeded_capital_w.rb → redundant_capital_w.rb} +1 -1
- data/lib/rubocop/cop/style/{unneeded_condition.rb → redundant_condition.rb} +3 -3
- data/lib/rubocop/cop/style/{unneeded_interpolation.rb → redundant_interpolation.rb} +1 -1
- data/lib/rubocop/cop/style/{unneeded_percent_q.rb → redundant_percent_q.rb} +1 -1
- data/lib/rubocop/cop/style/redundant_return.rb +37 -21
- data/lib/rubocop/cop/style/{unneeded_sort.rb → redundant_sort.rb} +4 -4
- data/lib/rubocop/cop/style/safe_navigation.rb +19 -8
- data/lib/rubocop/cop/style/semicolon.rb +13 -2
- data/lib/rubocop/cop/style/special_global_vars.rb +5 -7
- data/lib/rubocop/cop/util.rb +1 -1
- data/lib/rubocop/cop/utils/format_string.rb +10 -18
- data/lib/rubocop/cop/variable_force.rb +7 -5
- data/lib/rubocop/formatter/clang_style_formatter.rb +8 -3
- data/lib/rubocop/formatter/emacs_style_formatter.rb +22 -12
- data/lib/rubocop/formatter/file_list_formatter.rb +1 -1
- data/lib/rubocop/formatter/formatter_set.rb +16 -16
- data/lib/rubocop/formatter/pacman_formatter.rb +3 -3
- data/lib/rubocop/formatter/simple_text_formatter.rb +7 -3
- data/lib/rubocop/formatter/tap_formatter.rb +8 -3
- data/lib/rubocop/node_pattern.rb +3 -1
- data/lib/rubocop/options.rb +16 -22
- data/lib/rubocop/result_cache.rb +1 -1
- data/lib/rubocop/runner.rb +32 -27
- data/lib/rubocop/target_finder.rb +12 -6
- data/lib/rubocop/version.rb +1 -1
- metadata +12 -11
@@ -8,20 +8,30 @@ module RuboCop
|
|
8
8
|
class EmacsStyleFormatter < BaseFormatter
|
9
9
|
def file_finished(file, offenses)
|
10
10
|
offenses.each do |o|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
output.printf("%s:%d:%d: %s: %s\n",
|
21
|
-
file, o.line, o.real_column, o.severity.code,
|
22
|
-
message.tr("\n", ' '))
|
11
|
+
output.printf(
|
12
|
+
"%<path>s:%<line>d:%<column>d: %<severity>s: %<message>s\n",
|
13
|
+
path: file,
|
14
|
+
line: o.line,
|
15
|
+
column: o.real_column,
|
16
|
+
severity: o.severity.code,
|
17
|
+
message: message(o)
|
18
|
+
)
|
23
19
|
end
|
24
20
|
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def message(offense)
|
25
|
+
message =
|
26
|
+
if offense.corrected_with_todo?
|
27
|
+
"[Todo] #{offense.message}"
|
28
|
+
elsif offense.corrected?
|
29
|
+
"[Corrected] #{offense.message}"
|
30
|
+
else
|
31
|
+
offense.message
|
32
|
+
end
|
33
|
+
message.tr("\n", ' ')
|
34
|
+
end
|
25
35
|
end
|
26
36
|
end
|
27
37
|
end
|
@@ -9,21 +9,21 @@ module RuboCop
|
|
9
9
|
# which invoke same method of each formatters.
|
10
10
|
class FormatterSet < Array
|
11
11
|
BUILTIN_FORMATTERS_FOR_KEYS = {
|
12
|
-
'
|
13
|
-
'
|
14
|
-
'
|
15
|
-
'
|
16
|
-
'
|
17
|
-
'
|
18
|
-
'
|
19
|
-
'
|
20
|
-
'
|
21
|
-
'
|
22
|
-
'
|
23
|
-
'
|
24
|
-
'
|
25
|
-
'
|
26
|
-
'
|
12
|
+
'[a]utogenconf' => AutoGenConfigFormatter,
|
13
|
+
'[c]lang' => ClangStyleFormatter,
|
14
|
+
'[d]isabled' => DisabledLinesFormatter,
|
15
|
+
'[e]macs' => EmacsStyleFormatter,
|
16
|
+
'[fi]les' => FileListFormatter,
|
17
|
+
'[fu]ubar' => FuubarStyleFormatter,
|
18
|
+
'[h]tml' => HTMLFormatter,
|
19
|
+
'[j]son' => JSONFormatter,
|
20
|
+
'[o]ffenses' => OffenseCountFormatter,
|
21
|
+
'[pa]cman' => PacmanFormatter,
|
22
|
+
'[p]rogress' => ProgressFormatter,
|
23
|
+
'[q]uiet' => QuietFormatter,
|
24
|
+
'[s]imple' => SimpleTextFormatter,
|
25
|
+
'[t]ap' => TapFormatter,
|
26
|
+
'[w]orst' => WorstOffendersFormatter
|
27
27
|
}.freeze
|
28
28
|
|
29
29
|
FORMATTER_APIS = %i[started finished].freeze
|
@@ -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.
|
85
|
+
key =~ /^\[#{specified_key}\]/ || specified_key == key.delete('[]')
|
86
86
|
end
|
87
87
|
|
88
88
|
raise %(No formatter for "#{specified_key}") if matching_keys.empty?
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
module RuboCop
|
4
4
|
module Formatter
|
5
|
-
# This formatter prints a PACDOT per every file to be
|
5
|
+
# This formatter prints a PACDOT per every file to be analyzed.
|
6
6
|
# Pacman will "eat" one PACDOT per file when no offense is detected.
|
7
7
|
# Otherwise it will print a Ghost.
|
8
8
|
# This is inspired by the Pacman formatter for RSpec by Carlos Rojas.
|
@@ -49,7 +49,7 @@ module RuboCop
|
|
49
49
|
|
50
50
|
def cols
|
51
51
|
@cols ||= begin
|
52
|
-
width =
|
52
|
+
_height, width = $stdout.winsize
|
53
53
|
width.nil? || width.zero? ? FALLBACK_TERMINAL_WIDTH : width
|
54
54
|
end
|
55
55
|
end
|
@@ -68,7 +68,7 @@ module RuboCop
|
|
68
68
|
def step(character)
|
69
69
|
regex = /#{Regexp.quote(PACMAN)}|#{Regexp.quote(PACDOT)}/
|
70
70
|
@progress_line = @progress_line.sub(regex, character)
|
71
|
-
output.printf("
|
71
|
+
output.printf("%<line>s\r", line: @progress_line)
|
72
72
|
return unless @progress_line[-1] =~ /ᗣ|\./
|
73
73
|
|
74
74
|
@repetitions += 1
|
@@ -42,9 +42,13 @@ module RuboCop
|
|
42
42
|
output.puts yellow("== #{smart_path(file)} ==")
|
43
43
|
|
44
44
|
offenses.each do |o|
|
45
|
-
output.printf(
|
46
|
-
|
47
|
-
|
45
|
+
output.printf(
|
46
|
+
"%<severity>s:%3<line>d:%3<column>d: %<message>s\n",
|
47
|
+
severity: colored_severity_code(o),
|
48
|
+
line: o.line,
|
49
|
+
column: o.real_column,
|
50
|
+
message: message(o)
|
51
|
+
)
|
48
52
|
end
|
49
53
|
end
|
50
54
|
|
@@ -42,9 +42,14 @@ module RuboCop
|
|
42
42
|
end
|
43
43
|
|
44
44
|
def report_offense(file, offense)
|
45
|
-
output.printf(
|
46
|
-
|
47
|
-
|
45
|
+
output.printf(
|
46
|
+
"# %<path>s:%<line>d:%<column>d: %<severity>s: %<message>s\n",
|
47
|
+
path: cyan(smart_path(file)),
|
48
|
+
line: offense.line,
|
49
|
+
column: offense.real_column,
|
50
|
+
severity: colored_severity_code(offense),
|
51
|
+
message: message(offense)
|
52
|
+
)
|
48
53
|
|
49
54
|
# rubocop:disable Lint/HandleExceptions
|
50
55
|
begin
|
data/lib/rubocop/node_pattern.rb
CHANGED
@@ -429,12 +429,13 @@ module RuboCop
|
|
429
429
|
[0..Float::INFINITY, 'true']
|
430
430
|
end
|
431
431
|
|
432
|
+
# rubocop:disable Metrics/AbcSize
|
432
433
|
# rubocop:disable Metrics/MethodLength
|
433
434
|
def compile_any_order(capture_all = nil)
|
434
435
|
rest = capture_rest = nil
|
435
436
|
patterns = []
|
436
437
|
with_temp_variables do |child, matched|
|
437
|
-
tokens_until('>', 'any child')
|
438
|
+
tokens_until('>', 'any child') do
|
438
439
|
fail_due_to 'ellipsis must be at the end of <>' if rest
|
439
440
|
token = tokens.shift
|
440
441
|
case token
|
@@ -448,6 +449,7 @@ module RuboCop
|
|
448
449
|
end
|
449
450
|
end
|
450
451
|
# rubocop:enable Metrics/MethodLength
|
452
|
+
# rubocop:enable Metrics/AbcSize
|
451
453
|
|
452
454
|
def insure_same_captures(enum, what)
|
453
455
|
return to_enum __method__, enum, what unless block_given?
|
data/lib/rubocop/options.rb
CHANGED
@@ -255,11 +255,17 @@ module RuboCop
|
|
255
255
|
@options = options
|
256
256
|
end
|
257
257
|
|
258
|
+
def validate_cop_options
|
259
|
+
%i[only except].each do |opt|
|
260
|
+
OptionsValidator.validate_cop_list(@options[opt])
|
261
|
+
end
|
262
|
+
end
|
263
|
+
|
258
264
|
# rubocop:disable Metrics/AbcSize
|
259
265
|
def validate_compatibility # rubocop:disable Metrics/MethodLength
|
260
|
-
if
|
261
|
-
raise OptionArgumentError, 'Lint/
|
262
|
-
'be used with --only.'
|
266
|
+
if only_includes_redundant_disable?
|
267
|
+
raise OptionArgumentError, 'Lint/RedundantCopDisableDirective can ' \
|
268
|
+
'not be used with --only.'
|
263
269
|
end
|
264
270
|
if except_syntax?
|
265
271
|
raise OptionArgumentError, 'Syntax checking can not be turned off.'
|
@@ -332,10 +338,10 @@ module RuboCop
|
|
332
338
|
end
|
333
339
|
end
|
334
340
|
|
335
|
-
def
|
341
|
+
def only_includes_redundant_disable?
|
336
342
|
@options.key?(:only) &&
|
337
|
-
(@options[:only] & %w[Lint/
|
338
|
-
|
343
|
+
(@options[:only] & %w[Lint/RedundantCopDisableDirective
|
344
|
+
RedundantCopDisableDirective]).any?
|
339
345
|
end
|
340
346
|
|
341
347
|
def display_only_fail_level_offenses_with_autocorrect?
|
@@ -367,8 +373,9 @@ module RuboCop
|
|
367
373
|
# This module contains help texts for command line options.
|
368
374
|
module OptionsHelp
|
369
375
|
MAX_EXCL = RuboCop::Options::DEFAULT_MAXIMUM_EXCLUSION_ITEMS.to_s
|
370
|
-
|
371
376
|
# rubocop:disable Metrics/LineLength
|
377
|
+
FORMATTER_OPTION_LIST = RuboCop::Formatter::FormatterSet::BUILTIN_FORMATTERS_FOR_KEYS.keys
|
378
|
+
|
372
379
|
TEXT = {
|
373
380
|
only: 'Run only the given cop(s).',
|
374
381
|
only_guide_cops: ['Run only cops for rules that link to a',
|
@@ -407,21 +414,8 @@ module RuboCop
|
|
407
414
|
format: ['Choose an output formatter. This option',
|
408
415
|
'can be specified multiple times to enable',
|
409
416
|
'multiple formatters at the same time.',
|
410
|
-
'
|
411
|
-
|
412
|
-
' [c]lang',
|
413
|
-
' [d]isabled cops via inline comments',
|
414
|
-
' [fu]ubar',
|
415
|
-
' [pa]cman',
|
416
|
-
' [e]macs',
|
417
|
-
' [j]son',
|
418
|
-
' [h]tml',
|
419
|
-
' [fi]les',
|
420
|
-
' [o]ffenses',
|
421
|
-
' [w]orst',
|
422
|
-
' [t]ap',
|
423
|
-
' [q]uiet',
|
424
|
-
' [a]utogenconf',
|
417
|
+
'[p]rogress is used by default',
|
418
|
+
*FORMATTER_OPTION_LIST.map { |item| " #{item}" },
|
425
419
|
' custom formatter class name'],
|
426
420
|
out: ['Write output to a file instead of STDOUT.',
|
427
421
|
'This option applies to the previously',
|
data/lib/rubocop/result_cache.rb
CHANGED
data/lib/rubocop/runner.rb
CHANGED
@@ -104,25 +104,20 @@ module RuboCop
|
|
104
104
|
end
|
105
105
|
|
106
106
|
def process_file(file)
|
107
|
-
puts "Scanning #{file}" if @options[:debug]
|
108
107
|
file_started(file)
|
109
|
-
|
110
108
|
offenses = file_offenses(file)
|
111
|
-
if @options[:display_only_fail_level_offenses]
|
112
|
-
offenses = offenses.select { |o| considered_failure?(o) }
|
113
|
-
end
|
114
|
-
formatter_set.file_finished(file, offenses)
|
115
|
-
offenses
|
116
109
|
rescue InfiniteCorrectionLoop => e
|
117
|
-
|
110
|
+
offenses = e.offenses.compact.sort.freeze
|
118
111
|
raise
|
112
|
+
ensure
|
113
|
+
file_finished(file, offenses || [])
|
119
114
|
end
|
120
115
|
|
121
116
|
def file_offenses(file)
|
122
117
|
file_offense_cache(file) do
|
123
118
|
source = get_processed_source(file)
|
124
119
|
source, offenses = do_inspection_loop(file, source)
|
125
|
-
|
120
|
+
add_redundant_disables(file, offenses.compact.sort, source)
|
126
121
|
end
|
127
122
|
end
|
128
123
|
|
@@ -146,33 +141,37 @@ module RuboCop
|
|
146
141
|
offenses
|
147
142
|
end
|
148
143
|
|
149
|
-
def
|
150
|
-
if
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
cop.check(offenses, source.disabled_line_ranges, source.comments)
|
157
|
-
offenses += cop.offenses
|
158
|
-
offenses += autocorrect_unneeded_disables(file, source, cop,
|
159
|
-
offenses)
|
160
|
-
end
|
144
|
+
def add_redundant_disables(file, offenses, source)
|
145
|
+
if check_for_redundant_disables?(source)
|
146
|
+
redundant_cop_disable_directive(file) do |cop|
|
147
|
+
cop.check(offenses, source.disabled_line_ranges, source.comments)
|
148
|
+
offenses += cop.offenses
|
149
|
+
offenses += autocorrect_redundant_disables(file, source, cop,
|
150
|
+
offenses)
|
161
151
|
end
|
162
152
|
end
|
163
153
|
|
164
154
|
offenses.sort.reject(&:disabled?).freeze
|
165
155
|
end
|
166
156
|
|
167
|
-
def
|
157
|
+
def check_for_redundant_disables?(source)
|
168
158
|
!source.disabled_line_ranges.empty? && !filtered_run?
|
169
159
|
end
|
170
160
|
|
161
|
+
def redundant_cop_disable_directive(file)
|
162
|
+
config = @config_store.for(file)
|
163
|
+
if config.for_cop(Cop::Lint::RedundantCopDisableDirective)
|
164
|
+
.fetch('Enabled')
|
165
|
+
cop = Cop::Lint::RedundantCopDisableDirective.new(config, @options)
|
166
|
+
yield cop if cop.relevant_file?(file)
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
171
170
|
def filtered_run?
|
172
171
|
@options[:except] || @options[:only]
|
173
172
|
end
|
174
173
|
|
175
|
-
def
|
174
|
+
def autocorrect_redundant_disables(file, source, cop, offenses)
|
176
175
|
cop.processed_source = source
|
177
176
|
|
178
177
|
team = Cop::Team.new(RuboCop::Cop::Registry.new, nil, @options)
|
@@ -180,7 +179,7 @@ module RuboCop
|
|
180
179
|
|
181
180
|
return [] unless team.updated_source_file?
|
182
181
|
|
183
|
-
# Do one extra inspection loop if any
|
182
|
+
# Do one extra inspection loop if any redundant disables were
|
184
183
|
# removed. This is done in order to find rubocop:enable directives that
|
185
184
|
# have now become useless.
|
186
185
|
_source, new_offenses = do_inspection_loop(file,
|
@@ -189,11 +188,19 @@ module RuboCop
|
|
189
188
|
end
|
190
189
|
|
191
190
|
def file_started(file)
|
191
|
+
puts "Scanning #{file}" if @options[:debug]
|
192
192
|
formatter_set.file_started(file,
|
193
193
|
cli_options: @options,
|
194
194
|
config_store: @config_store)
|
195
195
|
end
|
196
196
|
|
197
|
+
def file_finished(file, offenses)
|
198
|
+
if @options[:display_only_fail_level_offenses]
|
199
|
+
offenses = offenses.select { |o| considered_failure?(o) }
|
200
|
+
end
|
201
|
+
formatter_set.file_finished(file, offenses)
|
202
|
+
end
|
203
|
+
|
197
204
|
def cached_run?
|
198
205
|
@cached_run ||=
|
199
206
|
(@options[:cache] == 'true' ||
|
@@ -291,9 +298,7 @@ module RuboCop
|
|
291
298
|
@mobilized_cop_classes[config.object_id] ||= begin
|
292
299
|
cop_classes = Cop::Cop.all
|
293
300
|
|
294
|
-
|
295
|
-
OptionsValidator.validate_cop_list(@options[opt])
|
296
|
-
end
|
301
|
+
OptionsValidator.new(@options).validate_cop_options
|
297
302
|
|
298
303
|
if @options[:only]
|
299
304
|
cop_classes.select! { |c| c.match?(@options[:only]) }
|
@@ -65,12 +65,7 @@ module RuboCop
|
|
65
65
|
to_inspect?(file, hidden_files, base_dir_config)
|
66
66
|
end
|
67
67
|
|
68
|
-
|
69
|
-
# Most recently modified file first.
|
70
|
-
target_files.sort_by! { |path| -Integer(File.mtime(path)) }
|
71
|
-
else
|
72
|
-
target_files.sort!
|
73
|
-
end
|
68
|
+
target_files.sort_by!(&order)
|
74
69
|
end
|
75
70
|
|
76
71
|
def to_inspect?(file, hidden_files, base_dir_config)
|
@@ -186,5 +181,16 @@ module RuboCop
|
|
186
181
|
config.file_to_exclude?(file)
|
187
182
|
end
|
188
183
|
end
|
184
|
+
|
185
|
+
private
|
186
|
+
|
187
|
+
def order
|
188
|
+
if fail_fast?
|
189
|
+
# Most recently modified file first.
|
190
|
+
->(path) { -Integer(File.mtime(path)) }
|
191
|
+
else
|
192
|
+
:itself
|
193
|
+
end
|
194
|
+
end
|
189
195
|
end
|
190
196
|
end
|
data/lib/rubocop/version.rb
CHANGED
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.
|
4
|
+
version: 0.76.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: 2019-
|
13
|
+
date: 2019-10-28 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: jaro_winkler
|
@@ -185,6 +185,7 @@ files:
|
|
185
185
|
- lib/rubocop/ast/node/regexp_node.rb
|
186
186
|
- lib/rubocop/ast/node/resbody_node.rb
|
187
187
|
- lib/rubocop/ast/node/retry_node.rb
|
188
|
+
- lib/rubocop/ast/node/return_node.rb
|
188
189
|
- lib/rubocop/ast/node/self_class_node.rb
|
189
190
|
- lib/rubocop/ast/node/send_node.rb
|
190
191
|
- lib/rubocop/ast/node/str_node.rb
|
@@ -378,6 +379,10 @@ files:
|
|
378
379
|
- lib/rubocop/cop/lint/percent_string_array.rb
|
379
380
|
- lib/rubocop/cop/lint/percent_symbol_array.rb
|
380
381
|
- lib/rubocop/cop/lint/rand_one.rb
|
382
|
+
- lib/rubocop/cop/lint/redundant_cop_disable_directive.rb
|
383
|
+
- lib/rubocop/cop/lint/redundant_cop_enable_directive.rb
|
384
|
+
- lib/rubocop/cop/lint/redundant_require_statement.rb
|
385
|
+
- lib/rubocop/cop/lint/redundant_splat_expansion.rb
|
381
386
|
- lib/rubocop/cop/lint/redundant_with_index.rb
|
382
387
|
- lib/rubocop/cop/lint/redundant_with_object.rb
|
383
388
|
- lib/rubocop/cop/lint/regexp_as_condition.rb
|
@@ -398,10 +403,6 @@ files:
|
|
398
403
|
- lib/rubocop/cop/lint/to_json.rb
|
399
404
|
- lib/rubocop/cop/lint/underscore_prefixed_variable_name.rb
|
400
405
|
- lib/rubocop/cop/lint/unified_integer.rb
|
401
|
-
- lib/rubocop/cop/lint/unneeded_cop_disable_directive.rb
|
402
|
-
- lib/rubocop/cop/lint/unneeded_cop_enable_directive.rb
|
403
|
-
- lib/rubocop/cop/lint/unneeded_require_statement.rb
|
404
|
-
- lib/rubocop/cop/lint/unneeded_splat_expansion.rb
|
405
406
|
- lib/rubocop/cop/lint/unreachable_code.rb
|
406
407
|
- lib/rubocop/cop/lint/unused_block_argument.rb
|
407
408
|
- lib/rubocop/cop/lint/unused_method_argument.rb
|
@@ -627,12 +628,17 @@ files:
|
|
627
628
|
- lib/rubocop/cop/style/raise_args.rb
|
628
629
|
- lib/rubocop/cop/style/random_with_offset.rb
|
629
630
|
- lib/rubocop/cop/style/redundant_begin.rb
|
631
|
+
- lib/rubocop/cop/style/redundant_capital_w.rb
|
632
|
+
- lib/rubocop/cop/style/redundant_condition.rb
|
630
633
|
- lib/rubocop/cop/style/redundant_conditional.rb
|
631
634
|
- lib/rubocop/cop/style/redundant_exception.rb
|
632
635
|
- lib/rubocop/cop/style/redundant_freeze.rb
|
636
|
+
- lib/rubocop/cop/style/redundant_interpolation.rb
|
633
637
|
- lib/rubocop/cop/style/redundant_parentheses.rb
|
638
|
+
- lib/rubocop/cop/style/redundant_percent_q.rb
|
634
639
|
- lib/rubocop/cop/style/redundant_return.rb
|
635
640
|
- lib/rubocop/cop/style/redundant_self.rb
|
641
|
+
- lib/rubocop/cop/style/redundant_sort.rb
|
636
642
|
- lib/rubocop/cop/style/redundant_sort_by.rb
|
637
643
|
- lib/rubocop/cop/style/regexp_literal.rb
|
638
644
|
- lib/rubocop/cop/style/rescue_modifier.rb
|
@@ -669,11 +675,6 @@ files:
|
|
669
675
|
- lib/rubocop/cop/style/trailing_underscore_variable.rb
|
670
676
|
- lib/rubocop/cop/style/trivial_accessors.rb
|
671
677
|
- lib/rubocop/cop/style/unless_else.rb
|
672
|
-
- lib/rubocop/cop/style/unneeded_capital_w.rb
|
673
|
-
- lib/rubocop/cop/style/unneeded_condition.rb
|
674
|
-
- lib/rubocop/cop/style/unneeded_interpolation.rb
|
675
|
-
- lib/rubocop/cop/style/unneeded_percent_q.rb
|
676
|
-
- lib/rubocop/cop/style/unneeded_sort.rb
|
677
678
|
- lib/rubocop/cop/style/unpack_first.rb
|
678
679
|
- lib/rubocop/cop/style/variable_interpolation.rb
|
679
680
|
- lib/rubocop/cop/style/when_then.rb
|