rubocop 1.31.2 → 1.34.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/config/default.yml +74 -16
- data/config/obsoletion.yml +23 -1
- data/lib/rubocop/cache_config.rb +29 -0
- data/lib/rubocop/cli/command/auto_genenerate_config.rb +2 -2
- data/lib/rubocop/cli/command/init_dotfile.rb +1 -1
- data/lib/rubocop/cli/command/suggest_extensions.rb +53 -15
- data/lib/rubocop/cli.rb +1 -0
- data/lib/rubocop/config.rb +1 -1
- data/lib/rubocop/config_finder.rb +68 -0
- data/lib/rubocop/config_loader.rb +12 -40
- data/lib/rubocop/config_loader_resolver.rb +1 -5
- data/lib/rubocop/config_obsoletion/changed_parameter.rb +5 -0
- data/lib/rubocop/config_obsoletion/parameter_rule.rb +4 -0
- data/lib/rubocop/config_obsoletion.rb +7 -2
- data/lib/rubocop/cop/cop.rb +1 -1
- data/lib/rubocop/cop/correctors/parentheses_corrector.rb +28 -0
- data/lib/rubocop/cop/internal_affairs/single_line_comparison.rb +61 -0
- data/lib/rubocop/cop/internal_affairs/useless_restrict_on_send.rb +7 -1
- data/lib/rubocop/cop/internal_affairs.rb +1 -0
- data/lib/rubocop/cop/layout/block_end_newline.rb +33 -5
- data/lib/rubocop/cop/layout/first_argument_indentation.rb +6 -1
- data/lib/rubocop/cop/layout/line_continuation_leading_space.rb +57 -13
- data/lib/rubocop/cop/layout/line_length.rb +2 -0
- data/lib/rubocop/cop/layout/multiline_assignment_layout.rb +1 -1
- data/lib/rubocop/cop/layout/multiline_method_argument_line_breaks.rb +4 -1
- data/lib/rubocop/cop/layout/multiline_method_parameter_line_breaks.rb +45 -0
- data/lib/rubocop/cop/legacy/corrections_proxy.rb +1 -1
- data/lib/rubocop/cop/legacy/corrector.rb +1 -1
- data/lib/rubocop/cop/lint/ambiguous_block_association.rb +26 -6
- data/lib/rubocop/cop/lint/debugger.rb +26 -16
- data/lib/rubocop/cop/lint/deprecated_class_methods.rb +10 -4
- data/lib/rubocop/cop/lint/empty_conditional_body.rb +65 -1
- data/lib/rubocop/cop/lint/non_atomic_file_operation.rb +55 -24
- data/lib/rubocop/cop/lint/number_conversion.rb +28 -6
- data/lib/rubocop/cop/lint/redundant_safe_navigation.rb +7 -0
- data/lib/rubocop/cop/lint/require_range_parentheses.rb +57 -0
- data/lib/rubocop/cop/lint/safe_navigation_chain.rb +35 -1
- data/lib/rubocop/cop/lint/shadowed_exception.rb +15 -0
- data/lib/rubocop/cop/lint/shadowing_outer_local_variable.rb +9 -1
- data/lib/rubocop/cop/metrics/abc_size.rb +3 -1
- data/lib/rubocop/cop/metrics/block_length.rb +6 -6
- data/lib/rubocop/cop/metrics/method_length.rb +8 -7
- data/lib/rubocop/cop/mixin/allowed_methods.rb +15 -1
- data/lib/rubocop/cop/mixin/allowed_pattern.rb +9 -1
- data/lib/rubocop/cop/mixin/check_line_breakable.rb +4 -0
- data/lib/rubocop/cop/mixin/comments_help.rb +5 -1
- data/lib/rubocop/cop/mixin/enforce_superclass.rb +2 -1
- data/lib/rubocop/cop/mixin/method_complexity.rb +4 -9
- data/lib/rubocop/cop/mixin/percent_array.rb +60 -1
- data/lib/rubocop/cop/mixin/range_help.rb +2 -2
- data/lib/rubocop/cop/naming/predicate_name.rb +30 -1
- data/lib/rubocop/cop/style/block_delimiters.rb +26 -7
- data/lib/rubocop/cop/style/class_and_module_children.rb +4 -4
- data/lib/rubocop/cop/style/class_equality_comparison.rb +50 -3
- data/lib/rubocop/cop/style/double_negation.rb +2 -0
- data/lib/rubocop/cop/style/empty_else.rb +37 -0
- data/lib/rubocop/cop/style/empty_heredoc.rb +73 -0
- data/lib/rubocop/cop/style/fetch_env_var.rb +10 -177
- data/lib/rubocop/cop/style/format_string_token.rb +25 -6
- data/lib/rubocop/cop/style/hash_except.rb +0 -4
- data/lib/rubocop/cop/style/if_unless_modifier.rb +1 -1
- data/lib/rubocop/cop/style/if_with_boolean_literal_branches.rb +2 -0
- data/lib/rubocop/cop/style/method_call_with_args_parentheses/require_parentheses.rb +5 -1
- data/lib/rubocop/cop/style/method_call_with_args_parentheses.rb +7 -7
- data/lib/rubocop/cop/style/method_call_without_args_parentheses.rb +19 -2
- data/lib/rubocop/cop/style/nested_parenthesized_calls.rb +9 -0
- data/lib/rubocop/cop/style/numeric_literals.rb +16 -1
- data/lib/rubocop/cop/style/numeric_predicate.rb +43 -9
- data/lib/rubocop/cop/style/redundant_condition.rb +19 -4
- data/lib/rubocop/cop/style/redundant_parentheses.rb +15 -22
- data/lib/rubocop/cop/style/redundant_sort.rb +21 -6
- data/lib/rubocop/cop/style/semicolon.rb +27 -3
- data/lib/rubocop/cop/style/sole_nested_conditional.rb +14 -3
- data/lib/rubocop/cop/style/symbol_array.rb +2 -3
- data/lib/rubocop/cop/style/symbol_proc.rb +40 -7
- data/lib/rubocop/cop/style/ternary_parentheses.rb +1 -13
- data/lib/rubocop/cop/style/top_level_method_definition.rb +2 -0
- data/lib/rubocop/cop/style/trivial_accessors.rb +3 -0
- data/lib/rubocop/cop/style/word_array.rb +2 -3
- data/lib/rubocop/ext/range.rb +15 -0
- data/lib/rubocop/feature_loader.rb +88 -0
- data/lib/rubocop/formatter/clang_style_formatter.rb +1 -1
- data/lib/rubocop/formatter/disabled_config_formatter.rb +1 -1
- data/lib/rubocop/formatter/html_formatter.rb +1 -1
- data/lib/rubocop/formatter/markdown_formatter.rb +1 -1
- data/lib/rubocop/formatter/tap_formatter.rb +1 -1
- data/lib/rubocop/options.rb +3 -6
- data/lib/rubocop/result_cache.rb +22 -20
- data/lib/rubocop/rspec/shared_contexts.rb +14 -14
- data/lib/rubocop/rspec/support.rb +14 -0
- data/lib/rubocop/runner.rb +4 -0
- data/lib/rubocop/server/cache.rb +33 -1
- data/lib/rubocop/server/cli.rb +19 -2
- data/lib/rubocop/server/client_command/base.rb +1 -1
- data/lib/rubocop/version.rb +1 -1
- data/lib/rubocop.rb +5 -1
- metadata +16 -9
- data/lib/rubocop/cop/mixin/ignored_methods.rb +0 -52
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'tmpdir'
|
4
4
|
|
5
|
-
RSpec.shared_context 'isolated environment'
|
5
|
+
RSpec.shared_context 'isolated environment' do
|
6
6
|
around do |example|
|
7
7
|
Dir.mktmpdir do |tmpdir|
|
8
8
|
original_home = Dir.home
|
@@ -38,7 +38,7 @@ RSpec.shared_context 'isolated environment', :isolated_environment do
|
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
41
|
-
RSpec.shared_context 'maintain registry'
|
41
|
+
RSpec.shared_context 'maintain registry' do
|
42
42
|
around(:each) { |example| RuboCop::Cop::Registry.with_temporary_global { example.run } }
|
43
43
|
|
44
44
|
def stub_cop_class(name, inherit: RuboCop::Cop::Base, &block)
|
@@ -49,7 +49,7 @@ RSpec.shared_context 'maintain registry', :restore_registry do
|
|
49
49
|
end
|
50
50
|
|
51
51
|
# This context assumes nothing and defines `cop`, among others.
|
52
|
-
RSpec.shared_context 'config'
|
52
|
+
RSpec.shared_context 'config' do # rubocop:disable Metrics/BlockLength
|
53
53
|
### Meant to be overridden at will
|
54
54
|
|
55
55
|
let(:cop_class) do
|
@@ -116,46 +116,46 @@ RSpec.shared_context 'mock console output' do
|
|
116
116
|
end
|
117
117
|
end
|
118
118
|
|
119
|
-
RSpec.shared_context 'ruby 2.0'
|
119
|
+
RSpec.shared_context 'ruby 2.0' do
|
120
120
|
let(:ruby_version) { 2.0 }
|
121
121
|
end
|
122
122
|
|
123
|
-
RSpec.shared_context 'ruby 2.1'
|
123
|
+
RSpec.shared_context 'ruby 2.1' do
|
124
124
|
let(:ruby_version) { 2.1 }
|
125
125
|
end
|
126
126
|
|
127
|
-
RSpec.shared_context 'ruby 2.2'
|
127
|
+
RSpec.shared_context 'ruby 2.2' do
|
128
128
|
let(:ruby_version) { 2.2 }
|
129
129
|
end
|
130
130
|
|
131
|
-
RSpec.shared_context 'ruby 2.3'
|
131
|
+
RSpec.shared_context 'ruby 2.3' do
|
132
132
|
let(:ruby_version) { 2.3 }
|
133
133
|
end
|
134
134
|
|
135
|
-
RSpec.shared_context 'ruby 2.4'
|
135
|
+
RSpec.shared_context 'ruby 2.4' do
|
136
136
|
let(:ruby_version) { 2.4 }
|
137
137
|
end
|
138
138
|
|
139
|
-
RSpec.shared_context 'ruby 2.5'
|
139
|
+
RSpec.shared_context 'ruby 2.5' do
|
140
140
|
let(:ruby_version) { 2.5 }
|
141
141
|
end
|
142
142
|
|
143
|
-
RSpec.shared_context 'ruby 2.6'
|
143
|
+
RSpec.shared_context 'ruby 2.6' do
|
144
144
|
let(:ruby_version) { 2.6 }
|
145
145
|
end
|
146
146
|
|
147
|
-
RSpec.shared_context 'ruby 2.7'
|
147
|
+
RSpec.shared_context 'ruby 2.7' do
|
148
148
|
let(:ruby_version) { 2.7 }
|
149
149
|
end
|
150
150
|
|
151
|
-
RSpec.shared_context 'ruby 3.0'
|
151
|
+
RSpec.shared_context 'ruby 3.0' do
|
152
152
|
let(:ruby_version) { 3.0 }
|
153
153
|
end
|
154
154
|
|
155
|
-
RSpec.shared_context 'ruby 3.1'
|
155
|
+
RSpec.shared_context 'ruby 3.1' do
|
156
156
|
let(:ruby_version) { 3.1 }
|
157
157
|
end
|
158
158
|
|
159
|
-
RSpec.shared_context 'ruby 3.2'
|
159
|
+
RSpec.shared_context 'ruby 3.2' do
|
160
160
|
let(:ruby_version) { 3.2 }
|
161
161
|
end
|
@@ -11,4 +11,18 @@ require_relative 'parallel_formatter'
|
|
11
11
|
RSpec.configure do |config|
|
12
12
|
config.include CopHelper
|
13
13
|
config.include HostEnvironmentSimulatorHelper
|
14
|
+
config.include_context 'config', :config
|
15
|
+
config.include_context 'isolated environment', :isolated_environment
|
16
|
+
config.include_context 'maintain registry', :restore_registry
|
17
|
+
config.include_context 'ruby 2.0', :ruby20
|
18
|
+
config.include_context 'ruby 2.1', :ruby21
|
19
|
+
config.include_context 'ruby 2.2', :ruby22
|
20
|
+
config.include_context 'ruby 2.3', :ruby23
|
21
|
+
config.include_context 'ruby 2.4', :ruby24
|
22
|
+
config.include_context 'ruby 2.5', :ruby25
|
23
|
+
config.include_context 'ruby 2.6', :ruby26
|
24
|
+
config.include_context 'ruby 2.7', :ruby27
|
25
|
+
config.include_context 'ruby 3.0', :ruby30
|
26
|
+
config.include_context 'ruby 3.1', :ruby31
|
27
|
+
config.include_context 'ruby 3.2', :ruby32
|
14
28
|
end
|
data/lib/rubocop/runner.rb
CHANGED
@@ -63,8 +63,12 @@ module RuboCop
|
|
63
63
|
# Warms up the RuboCop cache by forking a suitable number of RuboCop
|
64
64
|
# instances that each inspects its allotted group of files.
|
65
65
|
def warm_cache(target_files)
|
66
|
+
saved_options = @options.dup
|
66
67
|
puts 'Running parallel inspection' if @options[:debug]
|
68
|
+
%i[autocorrect safe_autocorrect].each { |opt| @options[opt] = false }
|
67
69
|
Parallel.each(target_files) { |target_file| file_offenses(target_file) }
|
70
|
+
ensure
|
71
|
+
@options = saved_options
|
68
72
|
end
|
69
73
|
|
70
74
|
def find_target_files(paths)
|
data/lib/rubocop/server/cache.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'pathname'
|
4
|
+
require_relative '../cache_config'
|
5
|
+
require_relative '../config_finder'
|
4
6
|
|
5
7
|
#
|
6
8
|
# This code is based on https://github.com/fohte/rubocop-daemon.
|
@@ -19,6 +21,8 @@ module RuboCop
|
|
19
21
|
GEMFILE_NAMES = %w[Gemfile gems.rb].freeze
|
20
22
|
|
21
23
|
class << self
|
24
|
+
attr_accessor :cache_root_path
|
25
|
+
|
22
26
|
# Searches for Gemfile or gems.rb in the current dir or any parent dirs
|
23
27
|
def project_dir
|
24
28
|
current_dir = Dir.pwd
|
@@ -38,12 +42,40 @@ module RuboCop
|
|
38
42
|
end
|
39
43
|
|
40
44
|
def dir
|
41
|
-
cache_path = File.expand_path('~/.cache/rubocop_cache/server')
|
42
45
|
Pathname.new(File.join(cache_path, project_dir_cache_key)).tap do |d|
|
43
46
|
d.mkpath unless d.exist?
|
44
47
|
end
|
45
48
|
end
|
46
49
|
|
50
|
+
def cache_path
|
51
|
+
cache_root_dir = if cache_root_path
|
52
|
+
File.join(cache_root_path, 'rubocop_cache')
|
53
|
+
else
|
54
|
+
cache_root_dir_from_config
|
55
|
+
end
|
56
|
+
|
57
|
+
File.expand_path(File.join(cache_root_dir, 'server'))
|
58
|
+
end
|
59
|
+
|
60
|
+
def cache_root_dir_from_config
|
61
|
+
CacheConfig.root_dir do
|
62
|
+
# `RuboCop::ConfigStore` has heavy dependencies, this is a lightweight implementation
|
63
|
+
# so that only the necessary `CacheRootDirectory` can be obtained.
|
64
|
+
require 'yaml'
|
65
|
+
|
66
|
+
config_path = ConfigFinder.find_config_path(Dir.pwd)
|
67
|
+
|
68
|
+
# Ruby 3.1+
|
69
|
+
config_yaml = if Gem::Version.new(Psych::VERSION) >= Gem::Version.new('4.0.0')
|
70
|
+
YAML.safe_load_file(config_path, permitted_classes: [Regexp, Symbol])
|
71
|
+
else
|
72
|
+
YAML.load_file(config_path)
|
73
|
+
end
|
74
|
+
|
75
|
+
config_yaml.dig('AllCops', 'CacheRootDirectory')
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
47
79
|
def port_path
|
48
80
|
dir.join('port')
|
49
81
|
end
|
data/lib/rubocop/server/cli.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'optparse'
|
4
3
|
require 'rainbow'
|
5
4
|
|
6
5
|
#
|
@@ -30,6 +29,7 @@ module RuboCop
|
|
30
29
|
@exit = false
|
31
30
|
end
|
32
31
|
|
32
|
+
# rubocop:disable Metrics/MethodLength
|
33
33
|
def run(argv = ARGV)
|
34
34
|
unless Server.support_server?
|
35
35
|
return error('RuboCop server is not supported by this Ruby.') if use_server_option?(argv)
|
@@ -37,6 +37,7 @@ module RuboCop
|
|
37
37
|
return STATUS_SUCCESS
|
38
38
|
end
|
39
39
|
|
40
|
+
Cache.cache_root_path = fetch_cache_root_path_from(argv)
|
40
41
|
deleted_server_arguments = delete_server_argument_from(argv)
|
41
42
|
|
42
43
|
if deleted_server_arguments.size >= 2
|
@@ -45,7 +46,7 @@ module RuboCop
|
|
45
46
|
|
46
47
|
server_command = deleted_server_arguments.first
|
47
48
|
|
48
|
-
if EXCLUSIVE_OPTIONS.include?(server_command) && argv.count
|
49
|
+
if EXCLUSIVE_OPTIONS.include?(server_command) && argv.count > allowed_option_count
|
49
50
|
return error("#{server_command} cannot be combined with other options.")
|
50
51
|
end
|
51
52
|
|
@@ -53,6 +54,7 @@ module RuboCop
|
|
53
54
|
|
54
55
|
STATUS_SUCCESS
|
55
56
|
end
|
57
|
+
# rubocop:enable Metrics/MethodLength
|
56
58
|
|
57
59
|
def exit?
|
58
60
|
@exit
|
@@ -83,6 +85,17 @@ module RuboCop
|
|
83
85
|
end
|
84
86
|
# rubocop:enable Metrics/CyclomaticComplexity, Metrics/MethodLength:
|
85
87
|
|
88
|
+
def fetch_cache_root_path_from(arguments)
|
89
|
+
cache_root = arguments.detect { |argument| argument.start_with?('--cache-root') }
|
90
|
+
return unless cache_root
|
91
|
+
|
92
|
+
if cache_root.start_with?('--cache-root=')
|
93
|
+
cache_root.split('=')[1]
|
94
|
+
else
|
95
|
+
arguments[arguments.index(cache_root) + 1]
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
86
99
|
def delete_server_argument_from(all_arguments)
|
87
100
|
SERVER_OPTIONS.each_with_object([]) do |server_option, server_arguments|
|
88
101
|
server_arguments << all_arguments.delete(server_option)
|
@@ -93,6 +106,10 @@ module RuboCop
|
|
93
106
|
(argv & SERVER_OPTIONS).any?
|
94
107
|
end
|
95
108
|
|
109
|
+
def allowed_option_count
|
110
|
+
Cache.cache_root_path ? 2 : 1
|
111
|
+
end
|
112
|
+
|
96
113
|
def error(message)
|
97
114
|
@exit = true
|
98
115
|
warn Rainbow(message).red
|
@@ -29,7 +29,7 @@ module RuboCop
|
|
29
29
|
socket.puts [Cache.token_path.read, Dir.pwd, command, *args].shelljoin
|
30
30
|
socket.write body
|
31
31
|
socket.close_write
|
32
|
-
$stdout.write socket.
|
32
|
+
$stdout.write socket.readpartial(4096) until socket.eof?
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
data/lib/rubocop/version.rb
CHANGED
data/lib/rubocop.rb
CHANGED
@@ -16,6 +16,7 @@ require 'rubocop-ast'
|
|
16
16
|
require_relative 'rubocop/ast_aliases'
|
17
17
|
require_relative 'rubocop/ext/regexp_node'
|
18
18
|
require_relative 'rubocop/ext/regexp_parser'
|
19
|
+
require_relative 'rubocop/ext/range'
|
19
20
|
|
20
21
|
require_relative 'rubocop/core_ext/string'
|
21
22
|
require_relative 'rubocop/ext/processed_source'
|
@@ -86,7 +87,6 @@ require_relative 'rubocop/cop/mixin/gem_declaration'
|
|
86
87
|
require_relative 'rubocop/cop/mixin/gemspec_help'
|
87
88
|
require_relative 'rubocop/cop/mixin/hash_alignment_styles'
|
88
89
|
require_relative 'rubocop/cop/mixin/hash_transform_method'
|
89
|
-
require_relative 'rubocop/cop/mixin/ignored_methods'
|
90
90
|
require_relative 'rubocop/cop/mixin/integer_node'
|
91
91
|
require_relative 'rubocop/cop/mixin/interpolation'
|
92
92
|
require_relative 'rubocop/cop/mixin/line_length_help'
|
@@ -233,6 +233,7 @@ require_relative 'rubocop/cop/layout/multiline_method_argument_line_breaks'
|
|
233
233
|
require_relative 'rubocop/cop/layout/multiline_method_call_brace_layout'
|
234
234
|
require_relative 'rubocop/cop/layout/multiline_method_call_indentation'
|
235
235
|
require_relative 'rubocop/cop/layout/multiline_method_definition_brace_layout'
|
236
|
+
require_relative 'rubocop/cop/layout/multiline_method_parameter_line_breaks'
|
236
237
|
require_relative 'rubocop/cop/layout/multiline_operation_indentation'
|
237
238
|
require_relative 'rubocop/cop/layout/parameter_alignment'
|
238
239
|
require_relative 'rubocop/cop/layout/redundant_line_break'
|
@@ -356,6 +357,7 @@ require_relative 'rubocop/cop/lint/redundant_with_object'
|
|
356
357
|
require_relative 'rubocop/cop/lint/refinement_import_methods'
|
357
358
|
require_relative 'rubocop/cop/lint/regexp_as_condition'
|
358
359
|
require_relative 'rubocop/cop/lint/require_parentheses'
|
360
|
+
require_relative 'rubocop/cop/lint/require_range_parentheses'
|
359
361
|
require_relative 'rubocop/cop/lint/require_relative_self_path'
|
360
362
|
require_relative 'rubocop/cop/lint/rescue_exception'
|
361
363
|
require_relative 'rubocop/cop/lint/rescue_type'
|
@@ -479,6 +481,7 @@ require_relative 'rubocop/cop/style/each_with_object'
|
|
479
481
|
require_relative 'rubocop/cop/style/empty_block_parameter'
|
480
482
|
require_relative 'rubocop/cop/style/empty_case_condition'
|
481
483
|
require_relative 'rubocop/cop/style/empty_else'
|
484
|
+
require_relative 'rubocop/cop/style/empty_heredoc'
|
482
485
|
require_relative 'rubocop/cop/style/empty_lambda_parameter'
|
483
486
|
require_relative 'rubocop/cop/style/empty_literal'
|
484
487
|
require_relative 'rubocop/cop/style/empty_method'
|
@@ -687,6 +690,7 @@ require_relative 'rubocop/config_obsoletion/split_cop'
|
|
687
690
|
require_relative 'rubocop/config_obsoletion'
|
688
691
|
require_relative 'rubocop/config_store'
|
689
692
|
require_relative 'rubocop/config_validator'
|
693
|
+
require_relative 'rubocop/feature_loader'
|
690
694
|
require_relative 'rubocop/lockfile'
|
691
695
|
require_relative 'rubocop/target_finder'
|
692
696
|
require_relative 'rubocop/directive_comment'
|
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.34.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: 2022-
|
13
|
+
date: 2022-08-09 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: json
|
@@ -46,14 +46,14 @@ dependencies:
|
|
46
46
|
requirements:
|
47
47
|
- - ">="
|
48
48
|
- !ruby/object:Gem::Version
|
49
|
-
version: 3.1.
|
49
|
+
version: 3.1.2.1
|
50
50
|
type: :runtime
|
51
51
|
prerelease: false
|
52
52
|
version_requirements: !ruby/object:Gem::Requirement
|
53
53
|
requirements:
|
54
54
|
- - ">="
|
55
55
|
- !ruby/object:Gem::Version
|
56
|
-
version: 3.1.
|
56
|
+
version: 3.1.2.1
|
57
57
|
- !ruby/object:Gem::Dependency
|
58
58
|
name: rainbow
|
59
59
|
requirement: !ruby/object:Gem::Requirement
|
@@ -120,7 +120,7 @@ dependencies:
|
|
120
120
|
requirements:
|
121
121
|
- - ">="
|
122
122
|
- !ruby/object:Gem::Version
|
123
|
-
version: 1.
|
123
|
+
version: 1.20.0
|
124
124
|
- - "<"
|
125
125
|
- !ruby/object:Gem::Version
|
126
126
|
version: '2.0'
|
@@ -130,7 +130,7 @@ dependencies:
|
|
130
130
|
requirements:
|
131
131
|
- - ">="
|
132
132
|
- !ruby/object:Gem::Version
|
133
|
-
version: 1.
|
133
|
+
version: 1.20.0
|
134
134
|
- - "<"
|
135
135
|
- !ruby/object:Gem::Version
|
136
136
|
version: '2.0'
|
@@ -208,6 +208,7 @@ files:
|
|
208
208
|
- exe/rubocop
|
209
209
|
- lib/rubocop.rb
|
210
210
|
- lib/rubocop/ast_aliases.rb
|
211
|
+
- lib/rubocop/cache_config.rb
|
211
212
|
- lib/rubocop/cached_data.rb
|
212
213
|
- lib/rubocop/cli.rb
|
213
214
|
- lib/rubocop/cli/command.rb
|
@@ -222,6 +223,7 @@ files:
|
|
222
223
|
- lib/rubocop/cli/environment.rb
|
223
224
|
- lib/rubocop/comment_config.rb
|
224
225
|
- lib/rubocop/config.rb
|
226
|
+
- lib/rubocop/config_finder.rb
|
225
227
|
- lib/rubocop/config_loader.rb
|
226
228
|
- lib/rubocop/config_loader_resolver.rb
|
227
229
|
- lib/rubocop/config_obsoletion.rb
|
@@ -298,6 +300,7 @@ files:
|
|
298
300
|
- lib/rubocop/cop/internal_affairs/redundant_location_argument.rb
|
299
301
|
- lib/rubocop/cop/internal_affairs/redundant_message_argument.rb
|
300
302
|
- lib/rubocop/cop/internal_affairs/redundant_method_dispatch_node.rb
|
303
|
+
- lib/rubocop/cop/internal_affairs/single_line_comparison.rb
|
301
304
|
- lib/rubocop/cop/internal_affairs/style_detected_api_use.rb
|
302
305
|
- lib/rubocop/cop/internal_affairs/undefined_config.rb
|
303
306
|
- lib/rubocop/cop/internal_affairs/useless_message_assertion.rb
|
@@ -367,6 +370,7 @@ files:
|
|
367
370
|
- lib/rubocop/cop/layout/multiline_method_call_brace_layout.rb
|
368
371
|
- lib/rubocop/cop/layout/multiline_method_call_indentation.rb
|
369
372
|
- lib/rubocop/cop/layout/multiline_method_definition_brace_layout.rb
|
373
|
+
- lib/rubocop/cop/layout/multiline_method_parameter_line_breaks.rb
|
370
374
|
- lib/rubocop/cop/layout/multiline_operation_indentation.rb
|
371
375
|
- lib/rubocop/cop/layout/parameter_alignment.rb
|
372
376
|
- lib/rubocop/cop/layout/redundant_line_break.rb
|
@@ -491,6 +495,7 @@ files:
|
|
491
495
|
- lib/rubocop/cop/lint/refinement_import_methods.rb
|
492
496
|
- lib/rubocop/cop/lint/regexp_as_condition.rb
|
493
497
|
- lib/rubocop/cop/lint/require_parentheses.rb
|
498
|
+
- lib/rubocop/cop/lint/require_range_parentheses.rb
|
494
499
|
- lib/rubocop/cop/lint/require_relative_self_path.rb
|
495
500
|
- lib/rubocop/cop/lint/rescue_exception.rb
|
496
501
|
- lib/rubocop/cop/lint/rescue_type.rb
|
@@ -579,7 +584,6 @@ files:
|
|
579
584
|
- lib/rubocop/cop/mixin/hash_shorthand_syntax.rb
|
580
585
|
- lib/rubocop/cop/mixin/hash_transform_method.rb
|
581
586
|
- lib/rubocop/cop/mixin/heredoc.rb
|
582
|
-
- lib/rubocop/cop/mixin/ignored_methods.rb
|
583
587
|
- lib/rubocop/cop/mixin/integer_node.rb
|
584
588
|
- lib/rubocop/cop/mixin/interpolation.rb
|
585
589
|
- lib/rubocop/cop/mixin/line_length_help.rb
|
@@ -696,6 +700,7 @@ files:
|
|
696
700
|
- lib/rubocop/cop/style/empty_block_parameter.rb
|
697
701
|
- lib/rubocop/cop/style/empty_case_condition.rb
|
698
702
|
- lib/rubocop/cop/style/empty_else.rb
|
703
|
+
- lib/rubocop/cop/style/empty_heredoc.rb
|
699
704
|
- lib/rubocop/cop/style/empty_lambda_parameter.rb
|
700
705
|
- lib/rubocop/cop/style/empty_literal.rb
|
701
706
|
- lib/rubocop/cop/style/empty_method.rb
|
@@ -894,8 +899,10 @@ files:
|
|
894
899
|
- lib/rubocop/directive_comment.rb
|
895
900
|
- lib/rubocop/error.rb
|
896
901
|
- lib/rubocop/ext/processed_source.rb
|
902
|
+
- lib/rubocop/ext/range.rb
|
897
903
|
- lib/rubocop/ext/regexp_node.rb
|
898
904
|
- lib/rubocop/ext/regexp_parser.rb
|
905
|
+
- lib/rubocop/feature_loader.rb
|
899
906
|
- lib/rubocop/file_finder.rb
|
900
907
|
- lib/rubocop/formatter.rb
|
901
908
|
- lib/rubocop/formatter/auto_gen_config_formatter.rb
|
@@ -968,7 +975,7 @@ metadata:
|
|
968
975
|
homepage_uri: https://rubocop.org/
|
969
976
|
changelog_uri: https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md
|
970
977
|
source_code_uri: https://github.com/rubocop/rubocop/
|
971
|
-
documentation_uri: https://docs.rubocop.org/rubocop/1.
|
978
|
+
documentation_uri: https://docs.rubocop.org/rubocop/1.34/
|
972
979
|
bug_tracker_uri: https://github.com/rubocop/rubocop/issues
|
973
980
|
rubygems_mfa_required: 'true'
|
974
981
|
post_install_message:
|
@@ -986,7 +993,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
986
993
|
- !ruby/object:Gem::Version
|
987
994
|
version: '0'
|
988
995
|
requirements: []
|
989
|
-
rubygems_version: 3.
|
996
|
+
rubygems_version: 3.2.22
|
990
997
|
signing_key:
|
991
998
|
specification_version: 4
|
992
999
|
summary: Automatic Ruby code style checking tool.
|
@@ -1,52 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module RuboCop
|
4
|
-
module Cop
|
5
|
-
# This module encapsulates the ability to ignore certain methods when
|
6
|
-
# parsing.
|
7
|
-
# Cops that use `IgnoredMethods` can accept either strings or regexes to match
|
8
|
-
# against.
|
9
|
-
module IgnoredMethods
|
10
|
-
# Configuration for IgnoredMethods. It is added to classes that include
|
11
|
-
# the module so that configuration can be set using the `ignored_methods`
|
12
|
-
# class macro.
|
13
|
-
module Config
|
14
|
-
attr_accessor :deprecated_key
|
15
|
-
|
16
|
-
def ignored_methods(**config)
|
17
|
-
self.deprecated_key = config[:deprecated_key]
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
def self.included(base)
|
22
|
-
base.extend(Config)
|
23
|
-
end
|
24
|
-
|
25
|
-
def ignored_method?(name)
|
26
|
-
ignored_methods.any? do |value|
|
27
|
-
case value
|
28
|
-
when Regexp
|
29
|
-
value.match? String(name)
|
30
|
-
else
|
31
|
-
value == String(name)
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
def ignored_methods
|
37
|
-
keys = %w[IgnoredMethods]
|
38
|
-
keys << deprecated_key if deprecated_key
|
39
|
-
|
40
|
-
cop_config.slice(*keys).values.reduce(&:concat)
|
41
|
-
end
|
42
|
-
|
43
|
-
private
|
44
|
-
|
45
|
-
def deprecated_key
|
46
|
-
return unless self.class.respond_to?(:deprecated_key)
|
47
|
-
|
48
|
-
self.class.deprecated_key&.to_s
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|