rubocop 1.31.0 → 1.32.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 +1 -1
- data/config/default.yml +23 -0
- data/lib/rubocop/cli.rb +1 -0
- data/lib/rubocop/config.rb +1 -1
- data/lib/rubocop/config_loader_resolver.rb +1 -1
- data/lib/rubocop/cop/base.rb +1 -1
- data/lib/rubocop/cop/generator.rb +4 -0
- data/lib/rubocop/cop/internal_affairs/useless_restrict_on_send.rb +60 -0
- data/lib/rubocop/cop/internal_affairs.rb +1 -0
- data/lib/rubocop/cop/layout/first_array_element_indentation.rb +4 -3
- data/lib/rubocop/cop/layout/first_hash_element_indentation.rb +3 -3
- data/lib/rubocop/cop/layout/line_continuation_leading_space.rb +57 -13
- data/lib/rubocop/cop/layout/line_continuation_spacing.rb +10 -0
- data/lib/rubocop/cop/layout/line_length.rb +2 -0
- 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/lint/ambiguous_block_association.rb +7 -0
- data/lib/rubocop/cop/lint/deprecated_class_methods.rb +10 -4
- data/lib/rubocop/cop/lint/literal_as_condition.rb +5 -0
- data/lib/rubocop/cop/lint/non_atomic_file_operation.rb +60 -24
- data/lib/rubocop/cop/lint/number_conversion.rb +7 -1
- 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/metrics/block_length.rb +1 -0
- data/lib/rubocop/cop/metrics/method_length.rb +1 -0
- data/lib/rubocop/cop/mixin/check_line_breakable.rb +4 -0
- data/lib/rubocop/cop/mixin/def_node.rb +2 -7
- data/lib/rubocop/cop/mixin/multiline_element_indentation.rb +12 -14
- data/lib/rubocop/cop/mixin/percent_array.rb +60 -1
- data/lib/rubocop/cop/naming/predicate_name.rb +8 -0
- data/lib/rubocop/cop/style/class_equality_comparison.rb +22 -0
- data/lib/rubocop/cop/style/empty_else.rb +37 -0
- data/lib/rubocop/cop/style/empty_heredoc.rb +59 -0
- data/lib/rubocop/cop/style/fetch_env_var.rb +10 -177
- data/lib/rubocop/cop/style/format_string_token.rb +6 -0
- data/lib/rubocop/cop/style/hash_except.rb +1 -1
- data/lib/rubocop/cop/style/if_with_boolean_literal_branches.rb +2 -0
- data/lib/rubocop/cop/style/method_call_without_args_parentheses.rb +12 -0
- data/lib/rubocop/cop/style/module_function.rb +2 -2
- data/lib/rubocop/cop/style/nested_parenthesized_calls.rb +9 -0
- data/lib/rubocop/cop/style/numeric_predicate.rb +20 -6
- data/lib/rubocop/cop/style/redundant_parentheses.rb +2 -1
- data/lib/rubocop/cop/style/semicolon.rb +27 -3
- data/lib/rubocop/cop/style/symbol_array.rb +2 -3
- data/lib/rubocop/cop/style/symbol_proc.rb +9 -1
- data/lib/rubocop/cop/style/trivial_accessors.rb +3 -0
- data/lib/rubocop/cop/style/word_array.rb +2 -3
- data/lib/rubocop/formatter/simple_text_formatter.rb +2 -0
- data/lib/rubocop/formatter.rb +21 -21
- data/lib/rubocop/options.rb +3 -6
- data/lib/rubocop/rake_task.rb +5 -1
- 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/client_command/base.rb +1 -1
- data/lib/rubocop/version.rb +1 -1
- data/lib/rubocop.rb +4 -1
- metadata +23 -5
@@ -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)
|
@@ -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
@@ -72,7 +72,6 @@ require_relative 'rubocop/cop/mixin/configurable_enforced_style'
|
|
72
72
|
require_relative 'rubocop/cop/mixin/configurable_formatting'
|
73
73
|
require_relative 'rubocop/cop/mixin/configurable_naming'
|
74
74
|
require_relative 'rubocop/cop/mixin/configurable_numbering'
|
75
|
-
require_relative 'rubocop/cop/mixin/def_node'
|
76
75
|
require_relative 'rubocop/cop/mixin/documentation_comment'
|
77
76
|
require_relative 'rubocop/cop/mixin/duplication'
|
78
77
|
require_relative 'rubocop/cop/mixin/range_help'
|
@@ -130,6 +129,7 @@ require_relative 'rubocop/cop/mixin/uncommunicative_name'
|
|
130
129
|
require_relative 'rubocop/cop/mixin/unused_argument'
|
131
130
|
require_relative 'rubocop/cop/mixin/visibility_help'
|
132
131
|
require_relative 'rubocop/cop/mixin/comments_help' # relies on visibility_help
|
132
|
+
require_relative 'rubocop/cop/mixin/def_node' # relies on visibility_help
|
133
133
|
|
134
134
|
require_relative 'rubocop/cop/utils/format_string'
|
135
135
|
|
@@ -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'
|
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.32.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bozhidar Batsov
|
@@ -10,8 +10,22 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date: 2022-
|
13
|
+
date: 2022-07-21 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: json
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
|
+
requirements:
|
19
|
+
- - "~>"
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '2.3'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
requirements:
|
26
|
+
- - "~>"
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
version: '2.3'
|
15
29
|
- !ruby/object:Gem::Dependency
|
16
30
|
name: parallel
|
17
31
|
requirement: !ruby/object:Gem::Requirement
|
@@ -106,7 +120,7 @@ dependencies:
|
|
106
120
|
requirements:
|
107
121
|
- - ">="
|
108
122
|
- !ruby/object:Gem::Version
|
109
|
-
version: 1.
|
123
|
+
version: 1.19.1
|
110
124
|
- - "<"
|
111
125
|
- !ruby/object:Gem::Version
|
112
126
|
version: '2.0'
|
@@ -116,7 +130,7 @@ dependencies:
|
|
116
130
|
requirements:
|
117
131
|
- - ">="
|
118
132
|
- !ruby/object:Gem::Version
|
119
|
-
version: 1.
|
133
|
+
version: 1.19.1
|
120
134
|
- - "<"
|
121
135
|
- !ruby/object:Gem::Version
|
122
136
|
version: '2.0'
|
@@ -287,6 +301,7 @@ files:
|
|
287
301
|
- lib/rubocop/cop/internal_affairs/style_detected_api_use.rb
|
288
302
|
- lib/rubocop/cop/internal_affairs/undefined_config.rb
|
289
303
|
- lib/rubocop/cop/internal_affairs/useless_message_assertion.rb
|
304
|
+
- lib/rubocop/cop/internal_affairs/useless_restrict_on_send.rb
|
290
305
|
- lib/rubocop/cop/layout/access_modifier_indentation.rb
|
291
306
|
- lib/rubocop/cop/layout/argument_alignment.rb
|
292
307
|
- lib/rubocop/cop/layout/array_alignment.rb
|
@@ -352,6 +367,7 @@ files:
|
|
352
367
|
- lib/rubocop/cop/layout/multiline_method_call_brace_layout.rb
|
353
368
|
- lib/rubocop/cop/layout/multiline_method_call_indentation.rb
|
354
369
|
- lib/rubocop/cop/layout/multiline_method_definition_brace_layout.rb
|
370
|
+
- lib/rubocop/cop/layout/multiline_method_parameter_line_breaks.rb
|
355
371
|
- lib/rubocop/cop/layout/multiline_operation_indentation.rb
|
356
372
|
- lib/rubocop/cop/layout/parameter_alignment.rb
|
357
373
|
- lib/rubocop/cop/layout/redundant_line_break.rb
|
@@ -476,6 +492,7 @@ files:
|
|
476
492
|
- lib/rubocop/cop/lint/refinement_import_methods.rb
|
477
493
|
- lib/rubocop/cop/lint/regexp_as_condition.rb
|
478
494
|
- lib/rubocop/cop/lint/require_parentheses.rb
|
495
|
+
- lib/rubocop/cop/lint/require_range_parentheses.rb
|
479
496
|
- lib/rubocop/cop/lint/require_relative_self_path.rb
|
480
497
|
- lib/rubocop/cop/lint/rescue_exception.rb
|
481
498
|
- lib/rubocop/cop/lint/rescue_type.rb
|
@@ -681,6 +698,7 @@ files:
|
|
681
698
|
- lib/rubocop/cop/style/empty_block_parameter.rb
|
682
699
|
- lib/rubocop/cop/style/empty_case_condition.rb
|
683
700
|
- lib/rubocop/cop/style/empty_else.rb
|
701
|
+
- lib/rubocop/cop/style/empty_heredoc.rb
|
684
702
|
- lib/rubocop/cop/style/empty_lambda_parameter.rb
|
685
703
|
- lib/rubocop/cop/style/empty_literal.rb
|
686
704
|
- lib/rubocop/cop/style/empty_method.rb
|
@@ -953,7 +971,7 @@ metadata:
|
|
953
971
|
homepage_uri: https://rubocop.org/
|
954
972
|
changelog_uri: https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md
|
955
973
|
source_code_uri: https://github.com/rubocop/rubocop/
|
956
|
-
documentation_uri: https://docs.rubocop.org/rubocop/1.
|
974
|
+
documentation_uri: https://docs.rubocop.org/rubocop/1.32/
|
957
975
|
bug_tracker_uri: https://github.com/rubocop/rubocop/issues
|
958
976
|
rubygems_mfa_required: 'true'
|
959
977
|
post_install_message:
|