rubocop 1.5.0 → 1.7.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 +52 -7
- data/config/obsoletion.yml +196 -0
- data/lib/rubocop.rb +14 -0
- data/lib/rubocop/cli/command/suggest_extensions.rb +21 -8
- data/lib/rubocop/config.rb +8 -5
- data/lib/rubocop/config_loader.rb +10 -6
- data/lib/rubocop/config_loader_resolver.rb +21 -4
- data/lib/rubocop/config_obsoletion.rb +64 -262
- data/lib/rubocop/config_obsoletion/changed_enforced_styles.rb +33 -0
- data/lib/rubocop/config_obsoletion/changed_parameter.rb +21 -0
- data/lib/rubocop/config_obsoletion/cop_rule.rb +34 -0
- data/lib/rubocop/config_obsoletion/extracted_cop.rb +44 -0
- data/lib/rubocop/config_obsoletion/parameter_rule.rb +44 -0
- data/lib/rubocop/config_obsoletion/removed_cop.rb +41 -0
- data/lib/rubocop/config_obsoletion/renamed_cop.rb +34 -0
- data/lib/rubocop/config_obsoletion/rule.rb +41 -0
- data/lib/rubocop/config_obsoletion/split_cop.rb +27 -0
- data/lib/rubocop/config_validator.rb +11 -4
- data/lib/rubocop/cop/base.rb +17 -15
- data/lib/rubocop/cop/cop.rb +2 -2
- data/lib/rubocop/cop/correctors/string_literal_corrector.rb +6 -8
- data/lib/rubocop/cop/gemspec/required_ruby_version.rb +3 -2
- data/lib/rubocop/cop/internal_affairs.rb +1 -0
- data/lib/rubocop/cop/internal_affairs/style_detected_api_use.rb +145 -0
- data/lib/rubocop/cop/layout/empty_line_between_defs.rb +19 -3
- data/lib/rubocop/cop/layout/empty_lines_around_arguments.rb +1 -1
- data/lib/rubocop/cop/layout/empty_lines_around_attribute_accessor.rb +1 -1
- data/lib/rubocop/cop/layout/heredoc_argument_closing_parenthesis.rb +26 -0
- data/lib/rubocop/cop/layout/line_length.rb +6 -16
- data/lib/rubocop/cop/layout/multiline_method_call_indentation.rb +7 -3
- data/lib/rubocop/cop/layout/rescue_ensure_alignment.rb +3 -10
- data/lib/rubocop/cop/layout/space_around_equals_in_parameter_default.rb +1 -0
- data/lib/rubocop/cop/layout/space_before_block_braces.rb +2 -0
- data/lib/rubocop/cop/layout/space_before_brackets.rb +64 -0
- data/lib/rubocop/cop/layout/space_inside_block_braces.rb +13 -10
- data/lib/rubocop/cop/layout/space_inside_hash_literal_braces.rb +2 -2
- data/lib/rubocop/cop/lint/ambiguous_assignment.rb +59 -0
- data/lib/rubocop/cop/lint/binary_operator_with_identical_operands.rb +7 -2
- data/lib/rubocop/cop/lint/duplicate_branch.rb +64 -2
- data/lib/rubocop/cop/lint/interpolation_check.rb +7 -2
- data/lib/rubocop/cop/lint/redundant_splat_expansion.rb +50 -17
- data/lib/rubocop/cop/lint/shadowed_exception.rb +1 -11
- data/lib/rubocop/cop/lint/shadowing_outer_local_variable.rb +13 -0
- data/lib/rubocop/cop/lint/unreachable_loop.rb +17 -0
- data/lib/rubocop/cop/metrics/utils/code_length_calculator.rb +1 -1
- data/lib/rubocop/cop/migration/department_name.rb +1 -1
- data/lib/rubocop/cop/mixin/string_help.rb +4 -1
- data/lib/rubocop/cop/naming/accessor_method_name.rb +15 -1
- data/lib/rubocop/cop/naming/memoized_instance_variable_name.rb +59 -5
- data/lib/rubocop/cop/naming/variable_number.rb +3 -1
- data/lib/rubocop/cop/registry.rb +10 -0
- data/lib/rubocop/cop/style/access_modifier_declarations.rb +3 -1
- data/lib/rubocop/cop/style/character_literal.rb +10 -11
- data/lib/rubocop/cop/style/collection_methods.rb +14 -1
- data/lib/rubocop/cop/style/commented_keyword.rb +22 -5
- data/lib/rubocop/cop/style/float_division.rb +44 -1
- data/lib/rubocop/cop/style/for.rb +2 -0
- data/lib/rubocop/cop/style/hash_except.rb +95 -0
- data/lib/rubocop/cop/style/if_unless_modifier.rb +4 -0
- data/lib/rubocop/cop/style/ip_addresses.rb +1 -1
- data/lib/rubocop/cop/style/keyword_parameters_order.rb +12 -2
- data/lib/rubocop/cop/style/lambda_call.rb +2 -1
- data/lib/rubocop/cop/style/method_call_with_args_parentheses.rb +3 -0
- data/lib/rubocop/cop/style/method_call_with_args_parentheses/omit_parentheses.rb +16 -6
- data/lib/rubocop/cop/style/method_def_parentheses.rb +7 -0
- data/lib/rubocop/cop/style/multiline_method_signature.rb +26 -1
- data/lib/rubocop/cop/style/multiline_when_then.rb +3 -1
- data/lib/rubocop/cop/style/mutable_constant.rb +13 -3
- data/lib/rubocop/cop/style/perl_backrefs.rb +86 -9
- data/lib/rubocop/cop/style/raise_args.rb +2 -0
- data/lib/rubocop/cop/style/redundant_argument.rb +21 -2
- data/lib/rubocop/cop/style/redundant_freeze.rb +8 -4
- data/lib/rubocop/cop/style/redundant_regexp_escape.rb +24 -8
- data/lib/rubocop/cop/style/single_line_block_params.rb +30 -7
- data/lib/rubocop/cop/style/single_line_methods.rb +4 -0
- data/lib/rubocop/cop/style/sole_nested_conditional.rb +24 -8
- data/lib/rubocop/cop/style/special_global_vars.rb +1 -13
- data/lib/rubocop/cop/style/string_concatenation.rb +26 -1
- data/lib/rubocop/cop/style/string_literals.rb +14 -8
- data/lib/rubocop/cop/style/string_literals_in_interpolation.rb +4 -3
- data/lib/rubocop/cop/style/symbol_proc.rb +5 -4
- data/lib/rubocop/cop/util.rb +3 -1
- data/lib/rubocop/ext/regexp_node.rb +31 -9
- data/lib/rubocop/ext/regexp_parser.rb +21 -3
- data/lib/rubocop/formatter/emacs_style_formatter.rb +2 -0
- data/lib/rubocop/formatter/simple_text_formatter.rb +2 -0
- data/lib/rubocop/formatter/tap_formatter.rb +2 -0
- data/lib/rubocop/lockfile.rb +40 -0
- data/lib/rubocop/options.rb +9 -9
- data/lib/rubocop/rspec/cop_helper.rb +0 -4
- data/lib/rubocop/rspec/expect_offense.rb +34 -22
- data/lib/rubocop/runner.rb +16 -1
- data/lib/rubocop/target_finder.rb +4 -2
- data/lib/rubocop/util.rb +16 -0
- data/lib/rubocop/version.rb +8 -2
- metadata +33 -5
@@ -19,12 +19,13 @@ module RuboCop
|
|
19
19
|
#
|
20
20
|
# # good
|
21
21
|
# result = "Tests #{success ? "PASS" : "FAIL"}"
|
22
|
-
class StringLiteralsInInterpolation <
|
22
|
+
class StringLiteralsInInterpolation < Base
|
23
23
|
include ConfigurableEnforcedStyle
|
24
24
|
include StringLiteralsHelp
|
25
|
+
extend AutoCorrector
|
25
26
|
|
26
|
-
def autocorrect(node)
|
27
|
-
StringLiteralCorrector.correct(node, style)
|
27
|
+
def autocorrect(corrector, node)
|
28
|
+
StringLiteralCorrector.correct(corrector, node, style)
|
28
29
|
end
|
29
30
|
|
30
31
|
private
|
@@ -22,11 +22,12 @@ module RuboCop
|
|
22
22
|
SUPER_TYPES = %i[super zsuper].freeze
|
23
23
|
|
24
24
|
def_node_matcher :proc_node?, '(send (const {nil? cbase} :Proc) :new)'
|
25
|
+
def_node_matcher :symbol_proc_receiver?, '{(send ...) (super ...) zsuper}'
|
25
26
|
def_node_matcher :symbol_proc?, <<~PATTERN
|
26
|
-
|
27
|
-
$
|
28
|
-
$
|
29
|
-
|
27
|
+
{
|
28
|
+
(block $#symbol_proc_receiver? $(args (arg _var)) (send (lvar _var) $_))
|
29
|
+
(numblock $#symbol_proc_receiver? $1 (send (lvar :_1) $_))
|
30
|
+
}
|
30
31
|
PATTERN
|
31
32
|
|
32
33
|
def self.autocorrect_incompatible_with
|
data/lib/rubocop/cop/util.rb
CHANGED
@@ -33,7 +33,9 @@ module RuboCop
|
|
33
33
|
end
|
34
34
|
|
35
35
|
def add_parentheses(node, corrector)
|
36
|
-
if node.arguments
|
36
|
+
if !node.respond_to?(:arguments)
|
37
|
+
corrector.wrap(node, '(', ')')
|
38
|
+
elsif node.arguments.empty?
|
37
39
|
corrector.insert_after(node, '()')
|
38
40
|
else
|
39
41
|
corrector.replace(args_begin(node), '(')
|
@@ -15,17 +15,39 @@ module RuboCop
|
|
15
15
|
# see `ext/regexp_parser`.
|
16
16
|
attr_reader :parsed_tree
|
17
17
|
|
18
|
-
|
19
|
-
|
18
|
+
if Gem::Version.new(Regexp::Parser::VERSION) >= Gem::Version.new('2.0')
|
19
|
+
def assign_properties(*)
|
20
|
+
super
|
20
21
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
22
|
+
str = with_interpolations_blanked
|
23
|
+
@parsed_tree = begin
|
24
|
+
Regexp::Parser.parse(str, options: options)
|
25
|
+
rescue StandardError
|
26
|
+
nil
|
27
|
+
end
|
28
|
+
origin = loc.begin.end
|
29
|
+
@parsed_tree&.each_expression(true) { |e| e.origin = origin }
|
30
|
+
end
|
31
|
+
# Please remove this `else` branch when support for regexp_parser 1.8 will be dropped.
|
32
|
+
# It's for compatibility with regexp_arser 1.8 and will never be maintained.
|
33
|
+
else
|
34
|
+
def assign_properties(*)
|
35
|
+
super
|
36
|
+
|
37
|
+
str = with_interpolations_blanked
|
38
|
+
begin
|
39
|
+
@parsed_tree = Regexp::Parser.parse(str, options: options)
|
40
|
+
rescue StandardError
|
41
|
+
@parsed_tree = nil
|
42
|
+
else
|
43
|
+
origin = loc.begin.end
|
44
|
+
source = @parsed_tree.to_s
|
45
|
+
@parsed_tree.each_expression(true) do |e|
|
46
|
+
e.origin = origin
|
47
|
+
e.source = source
|
48
|
+
end
|
49
|
+
end
|
26
50
|
end
|
27
|
-
origin = loc.begin.end
|
28
|
-
@parsed_tree&.each_expression(true) { |e| e.origin = origin }
|
29
51
|
end
|
30
52
|
|
31
53
|
def each_capture(named: ANY)
|
@@ -22,9 +22,27 @@ module RuboCop
|
|
22
22
|
module Base
|
23
23
|
attr_accessor :origin
|
24
24
|
|
25
|
-
|
26
|
-
|
27
|
-
|
25
|
+
if Gem::Version.new(Regexp::Parser::VERSION) >= Gem::Version.new('2.0')
|
26
|
+
# Shortcut to `loc.expression`
|
27
|
+
def expression
|
28
|
+
@expression ||= origin.adjust(begin_pos: ts, end_pos: ts + full_length)
|
29
|
+
end
|
30
|
+
# Please remove this `else` branch when support for regexp_parser 1.8 will be dropped.
|
31
|
+
# It's for compatibility with regexp_arser 1.8 and will never be maintained.
|
32
|
+
else
|
33
|
+
attr_accessor :source
|
34
|
+
|
35
|
+
def start_index
|
36
|
+
# ts is a byte index; convert it to a character index
|
37
|
+
@start_index ||= source.byteslice(0, ts).length
|
38
|
+
end
|
39
|
+
|
40
|
+
# Shortcut to `loc.expression`
|
41
|
+
def expression
|
42
|
+
@expression ||= begin
|
43
|
+
origin.adjust(begin_pos: start_index, end_pos: start_index + full_length)
|
44
|
+
end
|
45
|
+
end
|
28
46
|
end
|
29
47
|
|
30
48
|
# @returns a location map like `parser` does, with:
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RuboCop
|
4
|
+
# Encapsulation of a lockfile for use when checking for gems.
|
5
|
+
# Does not actually resolve gems, just parses the lockfile.
|
6
|
+
# @api private
|
7
|
+
class Lockfile
|
8
|
+
# Gems that the bundle depends on
|
9
|
+
def dependencies
|
10
|
+
return [] unless parser
|
11
|
+
|
12
|
+
parser.dependencies.values
|
13
|
+
end
|
14
|
+
|
15
|
+
# All activated gems, including transitive dependencies
|
16
|
+
def gems
|
17
|
+
return [] unless parser
|
18
|
+
|
19
|
+
# `Bundler::LockfileParser` returns `Bundler::LazySpecification` objects
|
20
|
+
# which are not resolved, so extract the dependencies from them
|
21
|
+
parser.dependencies.values.concat(parser.specs.flat_map(&:dependencies))
|
22
|
+
end
|
23
|
+
|
24
|
+
def includes_gem?(name)
|
25
|
+
gems.any? { |gem| gem.name == name }
|
26
|
+
end
|
27
|
+
|
28
|
+
private
|
29
|
+
|
30
|
+
def parser
|
31
|
+
return unless defined?(Bundler) && Bundler.default_lockfile
|
32
|
+
return @parser if defined?(@parser)
|
33
|
+
|
34
|
+
lockfile = Bundler.read_file(Bundler.default_lockfile)
|
35
|
+
@parser = lockfile ? Bundler::LockfileParser.new(lockfile) : nil
|
36
|
+
rescue Bundler::BundlerError
|
37
|
+
nil
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
data/lib/rubocop/options.rb
CHANGED
@@ -66,7 +66,7 @@ module RuboCop
|
|
66
66
|
add_configuration_options(opts)
|
67
67
|
add_formatting_options(opts)
|
68
68
|
|
69
|
-
option(opts, '-r', '--require FILE') { |f|
|
69
|
+
option(opts, '-r', '--require FILE') { |f| require_feature(f) }
|
70
70
|
|
71
71
|
add_severity_option(opts)
|
72
72
|
add_flags_with_optional_args(opts)
|
@@ -92,14 +92,7 @@ module RuboCop
|
|
92
92
|
raise OptionArgumentError, message
|
93
93
|
end
|
94
94
|
|
95
|
-
@options[:"#{option}"] =
|
96
|
-
if list.empty?
|
97
|
-
['']
|
98
|
-
else
|
99
|
-
list.split(',').map do |c|
|
100
|
-
Cop::Registry.qualified_cop_name(c, "--#{option} option")
|
101
|
-
end
|
102
|
-
end
|
95
|
+
@options[:"#{option}"] = list.empty? ? [''] : list.split(',')
|
103
96
|
end
|
104
97
|
end
|
105
98
|
|
@@ -239,6 +232,13 @@ module RuboCop
|
|
239
232
|
long_opt[2..-1].sub('[no-]', '').sub(/ .*/, '')
|
240
233
|
.tr('-', '_').gsub(/[\[\]]/, '').to_sym
|
241
234
|
end
|
235
|
+
|
236
|
+
def require_feature(file)
|
237
|
+
# If any features were added on the CLI from `--require`,
|
238
|
+
# add them to the config.
|
239
|
+
ConfigLoader.add_loaded_features(file)
|
240
|
+
require file
|
241
|
+
end
|
242
242
|
end
|
243
243
|
|
244
244
|
# Validates option arguments and the options' compatibility with each other.
|
@@ -9,10 +9,6 @@ module CopHelper
|
|
9
9
|
let(:ruby_version) { 2.4 }
|
10
10
|
let(:rails_version) { false }
|
11
11
|
|
12
|
-
def inspect_source_file(source)
|
13
|
-
Tempfile.open('tmp') { |f| inspect_source(source, f) }
|
14
|
-
end
|
15
|
-
|
16
12
|
def inspect_source(source, file = nil)
|
17
13
|
RuboCop::Formatter::DisabledConfigFormatter.config_to_allow_offenses = {}
|
18
14
|
RuboCop::Formatter::DisabledConfigFormatter.detected_styles = {}
|
@@ -111,28 +111,9 @@ module RuboCop
|
|
111
111
|
source
|
112
112
|
end
|
113
113
|
|
114
|
-
# rubocop:disable Metrics/AbcSize, Metrics/MethodLength
|
115
114
|
def expect_offense(source, file = nil, severity: nil, **replacements)
|
116
|
-
|
117
|
-
|
118
|
-
.config_to_allow_offenses = {}
|
119
|
-
RuboCop::Formatter::DisabledConfigFormatter.detected_styles = {}
|
120
|
-
cop.instance_variable_get(:@options)[:auto_correct] = true
|
121
|
-
|
122
|
-
expected_annotations = AnnotatedSource.parse(source)
|
123
|
-
|
124
|
-
if expected_annotations.plain_source == source
|
125
|
-
raise 'Use `expect_no_offenses` to assert that no offenses are found'
|
126
|
-
end
|
127
|
-
|
128
|
-
@processed_source = parse_source(expected_annotations.plain_source,
|
129
|
-
file)
|
130
|
-
|
131
|
-
unless @processed_source.valid_syntax?
|
132
|
-
raise 'Error parsing example code: ' \
|
133
|
-
"#{@processed_source.diagnostics.map(&:render).join("\n")}"
|
134
|
-
end
|
135
|
-
|
115
|
+
expected_annotations = parse_annotations(source, **replacements)
|
116
|
+
@processed_source = parse_processed_source(expected_annotations.plain_source, file)
|
136
117
|
@offenses = _investigate(cop, @processed_source)
|
137
118
|
actual_annotations =
|
138
119
|
expected_annotations.with_offense_annotations(@offenses)
|
@@ -143,7 +124,14 @@ module RuboCop
|
|
143
124
|
@offenses
|
144
125
|
end
|
145
126
|
|
146
|
-
|
127
|
+
# rubocop:disable Metrics/AbcSize, Metrics/MethodLength
|
128
|
+
def expect_correction(correction, loop: true, source: nil)
|
129
|
+
if source
|
130
|
+
expected_annotations = parse_annotations(source, raise_error: false)
|
131
|
+
@processed_source = parse_processed_source(expected_annotations.plain_source)
|
132
|
+
_investigate(cop, @processed_source)
|
133
|
+
end
|
134
|
+
|
147
135
|
raise '`expect_correction` must follow `expect_offense`' unless @processed_source
|
148
136
|
|
149
137
|
iteration = 0
|
@@ -192,6 +180,30 @@ module RuboCop
|
|
192
180
|
expect(actual_annotations.to_s).to eq(source)
|
193
181
|
end
|
194
182
|
|
183
|
+
def parse_annotations(source, raise_error: true, **replacements)
|
184
|
+
set_formatter_options
|
185
|
+
|
186
|
+
source = format_offense(source, **replacements)
|
187
|
+
annotations = AnnotatedSource.parse(source)
|
188
|
+
return annotations unless raise_error && annotations.plain_source == source
|
189
|
+
|
190
|
+
raise 'Use `expect_no_offenses` to assert that no offenses are found'
|
191
|
+
end
|
192
|
+
|
193
|
+
def parse_processed_source(source, file = nil)
|
194
|
+
processed_source = parse_source(source, file)
|
195
|
+
return processed_source if processed_source.valid_syntax?
|
196
|
+
|
197
|
+
raise 'Error parsing example code: ' \
|
198
|
+
"#{processed_source.diagnostics.map(&:render).join("\n")}"
|
199
|
+
end
|
200
|
+
|
201
|
+
def set_formatter_options
|
202
|
+
RuboCop::Formatter::DisabledConfigFormatter.config_to_allow_offenses = {}
|
203
|
+
RuboCop::Formatter::DisabledConfigFormatter.detected_styles = {}
|
204
|
+
cop.instance_variable_get(:@options)[:auto_correct] = true
|
205
|
+
end
|
206
|
+
|
195
207
|
# Parsed representation of code annotated with the `^^^ Message` style
|
196
208
|
class AnnotatedSource
|
197
209
|
ANNOTATION_PATTERN = /\A\s*(\^+|\^{}) /.freeze
|
data/lib/rubocop/runner.rb
CHANGED
@@ -323,11 +323,16 @@ module RuboCop
|
|
323
323
|
Cop::Team.mobilize(mobilized_cop_classes(config), config, @options)
|
324
324
|
end
|
325
325
|
|
326
|
-
def mobilized_cop_classes(config)
|
326
|
+
def mobilized_cop_classes(config) # rubocop:disable Metrics/AbcSize
|
327
327
|
@mobilized_cop_classes ||= {}.compare_by_identity
|
328
328
|
@mobilized_cop_classes[config] ||= begin
|
329
329
|
cop_classes = Cop::Registry.all
|
330
330
|
|
331
|
+
# `@options[:only]` and `@options[:except]` are not qualified until
|
332
|
+
# needed so that the Registry can be fully loaded, including any
|
333
|
+
# cops added by `require`s.
|
334
|
+
qualify_option_cop_names
|
335
|
+
|
331
336
|
OptionsValidator.new(@options).validate_cop_options
|
332
337
|
|
333
338
|
if @options[:only]
|
@@ -342,6 +347,16 @@ module RuboCop
|
|
342
347
|
end
|
343
348
|
end
|
344
349
|
|
350
|
+
def qualify_option_cop_names
|
351
|
+
%i[only except].each do |option|
|
352
|
+
next unless @options[option]
|
353
|
+
|
354
|
+
@options[option].map! do |cop_name|
|
355
|
+
Cop::Registry.qualified_cop_name(cop_name, "--#{option} option")
|
356
|
+
end
|
357
|
+
end
|
358
|
+
end
|
359
|
+
|
345
360
|
def filter_cop_classes(cop_classes, config)
|
346
361
|
# use only cops that link to a style guide if requested
|
347
362
|
return unless style_guide_cops_only?(config)
|
@@ -58,7 +58,7 @@ module RuboCop
|
|
58
58
|
base_dir = base_dir.gsub(File::ALT_SEPARATOR, File::SEPARATOR) if File::ALT_SEPARATOR
|
59
59
|
all_files = find_files(base_dir, File::FNM_DOTMATCH)
|
60
60
|
# use file.include? for performance optimization
|
61
|
-
hidden_files = all_files.select { |file| file.include?(HIDDEN_PATH_SUBSTRING) }
|
61
|
+
hidden_files = all_files.select { |file| file.include?(HIDDEN_PATH_SUBSTRING) }.sort
|
62
62
|
base_dir_config = @config_store.for(base_dir)
|
63
63
|
|
64
64
|
target_files = all_files.select do |file|
|
@@ -70,7 +70,9 @@ module RuboCop
|
|
70
70
|
|
71
71
|
def to_inspect?(file, hidden_files, base_dir_config)
|
72
72
|
return false if base_dir_config.file_to_exclude?(file)
|
73
|
-
return true if !hidden_files.
|
73
|
+
return true if !hidden_files.bsearch do |hidden_file|
|
74
|
+
file <=> hidden_file
|
75
|
+
end && ruby_file?(file)
|
74
76
|
|
75
77
|
base_dir_config.file_to_include?(file)
|
76
78
|
end
|
data/lib/rubocop/util.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RuboCop
|
4
|
+
# This module contains a collection of useful utility methods.
|
5
|
+
module Util
|
6
|
+
def self.silence_warnings
|
7
|
+
# Replaces Kernel::silence_warnings since it hides any warnings,
|
8
|
+
# including the RuboCop ones
|
9
|
+
old_verbose = $VERBOSE
|
10
|
+
$VERBOSE = nil
|
11
|
+
yield
|
12
|
+
ensure
|
13
|
+
$VERBOSE = old_verbose
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/lib/rubocop/version.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
module RuboCop
|
4
4
|
# This module holds the RuboCop version information.
|
5
5
|
module Version
|
6
|
-
STRING = '1.
|
6
|
+
STRING = '1.7.0'
|
7
7
|
|
8
8
|
MSG = '%<version>s (using Parser %<parser_version>s, '\
|
9
9
|
'rubocop-ast %<rubocop_ast_version>s, ' \
|
@@ -34,7 +34,13 @@ module RuboCop
|
|
34
34
|
|
35
35
|
# @api private
|
36
36
|
def self.extension_versions(env)
|
37
|
-
|
37
|
+
features = Util.silence_warnings do
|
38
|
+
# Suppress any config issues when loading the config (ie. deprecations,
|
39
|
+
# pending cops, etc.).
|
40
|
+
env.config_store.for_pwd.loaded_features.sort
|
41
|
+
end
|
42
|
+
|
43
|
+
features.map do |loaded_feature|
|
38
44
|
next unless (match = loaded_feature.match(/rubocop-(?<feature>.*)/))
|
39
45
|
|
40
46
|
feature = match[:feature]
|
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: 1.
|
4
|
+
version: 1.7.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-12-
|
13
|
+
date: 2020-12-25 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: parallel
|
@@ -66,14 +66,20 @@ dependencies:
|
|
66
66
|
requirements:
|
67
67
|
- - ">="
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version: '
|
69
|
+
version: '1.8'
|
70
|
+
- - "<"
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '3.0'
|
70
73
|
type: :runtime
|
71
74
|
prerelease: false
|
72
75
|
version_requirements: !ruby/object:Gem::Requirement
|
73
76
|
requirements:
|
74
77
|
- - ">="
|
75
78
|
- !ruby/object:Gem::Version
|
76
|
-
version: '
|
79
|
+
version: '1.8'
|
80
|
+
- - "<"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '3.0'
|
77
83
|
- !ruby/object:Gem::Dependency
|
78
84
|
name: rexml
|
79
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -95,6 +101,9 @@ dependencies:
|
|
95
101
|
- - ">="
|
96
102
|
- !ruby/object:Gem::Version
|
97
103
|
version: 1.2.0
|
104
|
+
- - "<"
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: '2.0'
|
98
107
|
type: :runtime
|
99
108
|
prerelease: false
|
100
109
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -102,6 +111,9 @@ dependencies:
|
|
102
111
|
- - ">="
|
103
112
|
- !ruby/object:Gem::Version
|
104
113
|
version: 1.2.0
|
114
|
+
- - "<"
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: '2.0'
|
105
117
|
- !ruby/object:Gem::Dependency
|
106
118
|
name: ruby-progressbar
|
107
119
|
requirement: !ruby/object:Gem::Requirement
|
@@ -172,6 +184,7 @@ files:
|
|
172
184
|
- assets/logo.png
|
173
185
|
- assets/output.html.erb
|
174
186
|
- config/default.yml
|
187
|
+
- config/obsoletion.yml
|
175
188
|
- exe/rubocop
|
176
189
|
- lib/rubocop.rb
|
177
190
|
- lib/rubocop/ast_aliases.rb
|
@@ -191,6 +204,15 @@ files:
|
|
191
204
|
- lib/rubocop/config_loader.rb
|
192
205
|
- lib/rubocop/config_loader_resolver.rb
|
193
206
|
- lib/rubocop/config_obsoletion.rb
|
207
|
+
- lib/rubocop/config_obsoletion/changed_enforced_styles.rb
|
208
|
+
- lib/rubocop/config_obsoletion/changed_parameter.rb
|
209
|
+
- lib/rubocop/config_obsoletion/cop_rule.rb
|
210
|
+
- lib/rubocop/config_obsoletion/extracted_cop.rb
|
211
|
+
- lib/rubocop/config_obsoletion/parameter_rule.rb
|
212
|
+
- lib/rubocop/config_obsoletion/removed_cop.rb
|
213
|
+
- lib/rubocop/config_obsoletion/renamed_cop.rb
|
214
|
+
- lib/rubocop/config_obsoletion/rule.rb
|
215
|
+
- lib/rubocop/config_obsoletion/split_cop.rb
|
194
216
|
- lib/rubocop/config_regeneration.rb
|
195
217
|
- lib/rubocop/config_store.rb
|
196
218
|
- lib/rubocop/config_validator.rb
|
@@ -236,6 +258,7 @@ files:
|
|
236
258
|
- lib/rubocop/cop/internal_affairs/offense_location_keyword.rb
|
237
259
|
- lib/rubocop/cop/internal_affairs/redundant_location_argument.rb
|
238
260
|
- lib/rubocop/cop/internal_affairs/redundant_message_argument.rb
|
261
|
+
- lib/rubocop/cop/internal_affairs/style_detected_api_use.rb
|
239
262
|
- lib/rubocop/cop/internal_affairs/useless_message_assertion.rb
|
240
263
|
- lib/rubocop/cop/layout/access_modifier_indentation.rb
|
241
264
|
- lib/rubocop/cop/layout/argument_alignment.rb
|
@@ -313,6 +336,7 @@ files:
|
|
313
336
|
- lib/rubocop/cop/layout/space_around_method_call_operator.rb
|
314
337
|
- lib/rubocop/cop/layout/space_around_operators.rb
|
315
338
|
- lib/rubocop/cop/layout/space_before_block_braces.rb
|
339
|
+
- lib/rubocop/cop/layout/space_before_brackets.rb
|
316
340
|
- lib/rubocop/cop/layout/space_before_comma.rb
|
317
341
|
- lib/rubocop/cop/layout/space_before_comment.rb
|
318
342
|
- lib/rubocop/cop/layout/space_before_first_arg.rb
|
@@ -331,6 +355,7 @@ files:
|
|
331
355
|
- lib/rubocop/cop/layout/trailing_whitespace.rb
|
332
356
|
- lib/rubocop/cop/legacy/corrections_proxy.rb
|
333
357
|
- lib/rubocop/cop/legacy/corrector.rb
|
358
|
+
- lib/rubocop/cop/lint/ambiguous_assignment.rb
|
334
359
|
- lib/rubocop/cop/lint/ambiguous_block_association.rb
|
335
360
|
- lib/rubocop/cop/lint/ambiguous_operator.rb
|
336
361
|
- lib/rubocop/cop/lint/ambiguous_regexp_literal.rb
|
@@ -617,6 +642,7 @@ files:
|
|
617
642
|
- lib/rubocop/cop/style/guard_clause.rb
|
618
643
|
- lib/rubocop/cop/style/hash_as_last_array_item.rb
|
619
644
|
- lib/rubocop/cop/style/hash_each_methods.rb
|
645
|
+
- lib/rubocop/cop/style/hash_except.rb
|
620
646
|
- lib/rubocop/cop/style/hash_like_case.rb
|
621
647
|
- lib/rubocop/cop/style/hash_syntax.rb
|
622
648
|
- lib/rubocop/cop/style/hash_transform_keys.rb
|
@@ -796,6 +822,7 @@ files:
|
|
796
822
|
- lib/rubocop/formatter/tap_formatter.rb
|
797
823
|
- lib/rubocop/formatter/text_util.rb
|
798
824
|
- lib/rubocop/formatter/worst_offenders_formatter.rb
|
825
|
+
- lib/rubocop/lockfile.rb
|
799
826
|
- lib/rubocop/magic_comment.rb
|
800
827
|
- lib/rubocop/name_similarity.rb
|
801
828
|
- lib/rubocop/options.rb
|
@@ -813,6 +840,7 @@ files:
|
|
813
840
|
- lib/rubocop/string_interpreter.rb
|
814
841
|
- lib/rubocop/target_finder.rb
|
815
842
|
- lib/rubocop/target_ruby.rb
|
843
|
+
- lib/rubocop/util.rb
|
816
844
|
- lib/rubocop/version.rb
|
817
845
|
- lib/rubocop/warning.rb
|
818
846
|
- lib/rubocop/yaml_duplication_checker.rb
|
@@ -823,7 +851,7 @@ metadata:
|
|
823
851
|
homepage_uri: https://rubocop.org/
|
824
852
|
changelog_uri: https://github.com/rubocop-hq/rubocop/blob/master/CHANGELOG.md
|
825
853
|
source_code_uri: https://github.com/rubocop-hq/rubocop/
|
826
|
-
documentation_uri: https://docs.rubocop.org/rubocop/1.
|
854
|
+
documentation_uri: https://docs.rubocop.org/rubocop/1.7/
|
827
855
|
bug_tracker_uri: https://github.com/rubocop-hq/rubocop/issues
|
828
856
|
post_install_message:
|
829
857
|
rdoc_options: []
|