rubocop 1.43.0 → 1.44.1
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 +50 -0
- data/lib/rubocop/config_loader.rb +12 -15
- data/lib/rubocop/cop/corrector.rb +10 -2
- data/lib/rubocop/cop/correctors/ordered_gem_corrector.rb +1 -6
- data/lib/rubocop/cop/gemspec/development_dependencies.rb +107 -0
- data/lib/rubocop/cop/internal_affairs/redundant_let_rubocop_config_new.rb +11 -3
- data/lib/rubocop/cop/layout/block_end_newline.rb +7 -1
- data/lib/rubocop/cop/layout/closing_parenthesis_indentation.rb +2 -6
- data/lib/rubocop/cop/layout/heredoc_indentation.rb +6 -9
- data/lib/rubocop/cop/layout/space_inside_array_literal_brackets.rb +0 -2
- data/lib/rubocop/cop/lint/ambiguous_operator.rb +4 -0
- data/lib/rubocop/cop/lint/deprecated_class_methods.rb +62 -112
- data/lib/rubocop/cop/lint/else_layout.rb +2 -6
- data/lib/rubocop/cop/lint/format_parameter_mismatch.rb +11 -7
- data/lib/rubocop/cop/lint/heredoc_method_call_position.rb +15 -17
- data/lib/rubocop/cop/lint/mixed_regexp_capture_types.rb +1 -0
- data/lib/rubocop/cop/lint/redundant_require_statement.rb +11 -1
- data/lib/rubocop/cop/lint/useless_method_definition.rb +3 -3
- data/lib/rubocop/cop/lint/useless_rescue.rb +15 -1
- data/lib/rubocop/cop/lint/useless_ruby2_keywords.rb +9 -1
- data/lib/rubocop/cop/lint/void.rb +19 -10
- data/lib/rubocop/cop/metrics/block_nesting.rb +1 -1
- data/lib/rubocop/cop/metrics/cyclomatic_complexity.rb +1 -1
- data/lib/rubocop/cop/metrics/utils/abc_size_calculator.rb +2 -5
- data/lib/rubocop/cop/mixin/alignment.rb +1 -1
- data/lib/rubocop/cop/mixin/hash_shorthand_syntax.rb +40 -18
- data/lib/rubocop/cop/mixin/line_length_help.rb +3 -1
- data/lib/rubocop/cop/naming/block_forwarding.rb +4 -0
- data/lib/rubocop/cop/registry.rb +12 -7
- data/lib/rubocop/cop/style/access_modifier_declarations.rb +18 -10
- data/lib/rubocop/cop/style/block_delimiters.rb +8 -2
- data/lib/rubocop/cop/style/class_and_module_children.rb +2 -9
- data/lib/rubocop/cop/style/comparable_clamp.rb +125 -0
- data/lib/rubocop/cop/style/conditional_assignment.rb +0 -6
- data/lib/rubocop/cop/style/infinite_loop.rb +2 -5
- data/lib/rubocop/cop/style/invertible_unless_condition.rb +114 -0
- data/lib/rubocop/cop/style/method_call_with_args_parentheses/omit_parentheses.rb +11 -5
- data/lib/rubocop/cop/style/method_call_without_args_parentheses.rb +2 -0
- data/lib/rubocop/cop/style/min_max_comparison.rb +11 -1
- data/lib/rubocop/cop/style/multiline_if_modifier.rb +0 -4
- data/lib/rubocop/cop/style/multiline_memoization.rb +2 -2
- data/lib/rubocop/cop/style/negated_if_else_condition.rb +1 -5
- data/lib/rubocop/cop/style/one_line_conditional.rb +3 -6
- data/lib/rubocop/cop/style/operator_method_call.rb +1 -1
- data/lib/rubocop/cop/style/parallel_assignment.rb +3 -1
- data/lib/rubocop/cop/style/redundant_conditional.rb +0 -4
- data/lib/rubocop/cop/style/redundant_double_splat_hash_braces.rb +16 -10
- data/lib/rubocop/cop/style/require_order.rb +2 -9
- data/lib/rubocop/cop/style/self_assignment.rb +2 -2
- data/lib/rubocop/cop/style/semicolon.rb +24 -2
- data/lib/rubocop/cop/variable_force/variable_table.rb +3 -1
- data/lib/rubocop/cop/variable_force.rb +1 -1
- data/lib/rubocop/formatter.rb +0 -1
- data/lib/rubocop/rspec/expect_offense.rb +6 -4
- data/lib/rubocop/server/cache.rb +3 -1
- data/lib/rubocop/version.rb +1 -1
- data/lib/rubocop.rb +3 -0
- metadata +6 -3
@@ -6,7 +6,7 @@ module RuboCop
|
|
6
6
|
#
|
7
7
|
# This mixin makes it easier to specify strict offense expectations
|
8
8
|
# in a declarative and visual fashion. Just type out the code that
|
9
|
-
# should generate
|
9
|
+
# should generate an offense, annotate code by writing '^'s
|
10
10
|
# underneath each character that should be highlighted, and follow
|
11
11
|
# the carets with a string (separated by a space) that is the
|
12
12
|
# message of the offense. You can include multiple offenses in
|
@@ -126,7 +126,7 @@ module RuboCop
|
|
126
126
|
@offenses
|
127
127
|
end
|
128
128
|
|
129
|
-
# rubocop:disable Metrics/AbcSize, Metrics/MethodLength, Metrics/CyclomaticComplexity
|
129
|
+
# rubocop:disable Metrics/AbcSize, Metrics/MethodLength, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
130
130
|
def expect_correction(correction, loop: true, source: nil)
|
131
131
|
if source
|
132
132
|
expected_annotations = parse_annotations(source, raise_error: false)
|
@@ -138,6 +138,8 @@ module RuboCop
|
|
138
138
|
|
139
139
|
source = @processed_source.raw_source
|
140
140
|
|
141
|
+
raise 'Use `expect_no_corrections` if the code will not change' if correction == source
|
142
|
+
|
141
143
|
iteration = 0
|
142
144
|
new_source = loop do
|
143
145
|
iteration += 1
|
@@ -157,11 +159,11 @@ module RuboCop
|
|
157
159
|
_investigate(cop, @processed_source)
|
158
160
|
end
|
159
161
|
|
160
|
-
raise '
|
162
|
+
raise 'Expected correction but no corrections were made' if new_source == source
|
161
163
|
|
162
164
|
expect(new_source).to eq(correction)
|
163
165
|
end
|
164
|
-
# rubocop:enable Metrics/AbcSize, Metrics/MethodLength, Metrics/CyclomaticComplexity
|
166
|
+
# rubocop:enable Metrics/AbcSize, Metrics/MethodLength, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
165
167
|
|
166
168
|
def expect_no_corrections
|
167
169
|
raise '`expect_no_corrections` must follow `expect_offense`' unless @processed_source
|
data/lib/rubocop/server/cache.rb
CHANGED
@@ -68,7 +68,9 @@ module RuboCop
|
|
68
68
|
file_contents = File.read(config_path)
|
69
69
|
yaml_code = ERB.new(file_contents).result
|
70
70
|
|
71
|
-
config_yaml = YAML.safe_load(
|
71
|
+
config_yaml = YAML.safe_load(
|
72
|
+
yaml_code, permitted_classes: [Regexp, Symbol], aliases: true
|
73
|
+
)
|
72
74
|
|
73
75
|
# For compatibility with Ruby 3.0 or lower.
|
74
76
|
if Gem::Version.new(Psych::VERSION) < Gem::Version.new('4.0.0')
|
data/lib/rubocop/version.rb
CHANGED
data/lib/rubocop.rb
CHANGED
@@ -166,6 +166,7 @@ require_relative 'rubocop/cop/bundler/ordered_gems'
|
|
166
166
|
|
167
167
|
require_relative 'rubocop/cop/gemspec/dependency_version'
|
168
168
|
require_relative 'rubocop/cop/gemspec/deprecated_attribute_assignment'
|
169
|
+
require_relative 'rubocop/cop/gemspec/development_dependencies'
|
169
170
|
require_relative 'rubocop/cop/gemspec/duplicated_assignment'
|
170
171
|
require_relative 'rubocop/cop/gemspec/ordered_dependencies'
|
171
172
|
require_relative 'rubocop/cop/gemspec/require_mfa'
|
@@ -471,6 +472,7 @@ require_relative 'rubocop/cop/style/combinable_loops'
|
|
471
472
|
require_relative 'rubocop/cop/style/command_literal'
|
472
473
|
require_relative 'rubocop/cop/style/comment_annotation'
|
473
474
|
require_relative 'rubocop/cop/style/commented_keyword'
|
475
|
+
require_relative 'rubocop/cop/style/comparable_clamp'
|
474
476
|
require_relative 'rubocop/cop/style/concat_array_literals'
|
475
477
|
require_relative 'rubocop/cop/style/conditional_assignment'
|
476
478
|
require_relative 'rubocop/cop/style/constant_visibility'
|
@@ -532,6 +534,7 @@ require_relative 'rubocop/cop/style/in_pattern_then'
|
|
532
534
|
require_relative 'rubocop/cop/style/infinite_loop'
|
533
535
|
require_relative 'rubocop/cop/style/inverse_methods'
|
534
536
|
require_relative 'rubocop/cop/style/inline_comment'
|
537
|
+
require_relative 'rubocop/cop/style/invertible_unless_condition'
|
535
538
|
require_relative 'rubocop/cop/style/ip_addresses'
|
536
539
|
require_relative 'rubocop/cop/style/keyword_parameters_order'
|
537
540
|
require_relative 'rubocop/cop/style/lambda'
|
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.44.1
|
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: 2023-01-
|
13
|
+
date: 2023-01-25 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: json
|
@@ -275,6 +275,7 @@ files:
|
|
275
275
|
- lib/rubocop/cop/force.rb
|
276
276
|
- lib/rubocop/cop/gemspec/dependency_version.rb
|
277
277
|
- lib/rubocop/cop/gemspec/deprecated_attribute_assignment.rb
|
278
|
+
- lib/rubocop/cop/gemspec/development_dependencies.rb
|
278
279
|
- lib/rubocop/cop/gemspec/duplicated_assignment.rb
|
279
280
|
- lib/rubocop/cop/gemspec/ordered_dependencies.rb
|
280
281
|
- lib/rubocop/cop/gemspec/require_mfa.rb
|
@@ -692,6 +693,7 @@ files:
|
|
692
693
|
- lib/rubocop/cop/style/command_literal.rb
|
693
694
|
- lib/rubocop/cop/style/comment_annotation.rb
|
694
695
|
- lib/rubocop/cop/style/commented_keyword.rb
|
696
|
+
- lib/rubocop/cop/style/comparable_clamp.rb
|
695
697
|
- lib/rubocop/cop/style/concat_array_literals.rb
|
696
698
|
- lib/rubocop/cop/style/conditional_assignment.rb
|
697
699
|
- lib/rubocop/cop/style/constant_visibility.rb
|
@@ -753,6 +755,7 @@ files:
|
|
753
755
|
- lib/rubocop/cop/style/infinite_loop.rb
|
754
756
|
- lib/rubocop/cop/style/inline_comment.rb
|
755
757
|
- lib/rubocop/cop/style/inverse_methods.rb
|
758
|
+
- lib/rubocop/cop/style/invertible_unless_condition.rb
|
756
759
|
- lib/rubocop/cop/style/ip_addresses.rb
|
757
760
|
- lib/rubocop/cop/style/keyword_parameters_order.rb
|
758
761
|
- lib/rubocop/cop/style/lambda.rb
|
@@ -996,7 +999,7 @@ metadata:
|
|
996
999
|
homepage_uri: https://rubocop.org/
|
997
1000
|
changelog_uri: https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md
|
998
1001
|
source_code_uri: https://github.com/rubocop/rubocop/
|
999
|
-
documentation_uri: https://docs.rubocop.org/rubocop/1.
|
1002
|
+
documentation_uri: https://docs.rubocop.org/rubocop/1.44/
|
1000
1003
|
bug_tracker_uri: https://github.com/rubocop/rubocop/issues
|
1001
1004
|
rubygems_mfa_required: 'true'
|
1002
1005
|
post_install_message:
|