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.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/config/default.yml +50 -0
  4. data/lib/rubocop/config_loader.rb +12 -15
  5. data/lib/rubocop/cop/corrector.rb +10 -2
  6. data/lib/rubocop/cop/correctors/ordered_gem_corrector.rb +1 -6
  7. data/lib/rubocop/cop/gemspec/development_dependencies.rb +107 -0
  8. data/lib/rubocop/cop/internal_affairs/redundant_let_rubocop_config_new.rb +11 -3
  9. data/lib/rubocop/cop/layout/block_end_newline.rb +7 -1
  10. data/lib/rubocop/cop/layout/closing_parenthesis_indentation.rb +2 -6
  11. data/lib/rubocop/cop/layout/heredoc_indentation.rb +6 -9
  12. data/lib/rubocop/cop/layout/space_inside_array_literal_brackets.rb +0 -2
  13. data/lib/rubocop/cop/lint/ambiguous_operator.rb +4 -0
  14. data/lib/rubocop/cop/lint/deprecated_class_methods.rb +62 -112
  15. data/lib/rubocop/cop/lint/else_layout.rb +2 -6
  16. data/lib/rubocop/cop/lint/format_parameter_mismatch.rb +11 -7
  17. data/lib/rubocop/cop/lint/heredoc_method_call_position.rb +15 -17
  18. data/lib/rubocop/cop/lint/mixed_regexp_capture_types.rb +1 -0
  19. data/lib/rubocop/cop/lint/redundant_require_statement.rb +11 -1
  20. data/lib/rubocop/cop/lint/useless_method_definition.rb +3 -3
  21. data/lib/rubocop/cop/lint/useless_rescue.rb +15 -1
  22. data/lib/rubocop/cop/lint/useless_ruby2_keywords.rb +9 -1
  23. data/lib/rubocop/cop/lint/void.rb +19 -10
  24. data/lib/rubocop/cop/metrics/block_nesting.rb +1 -1
  25. data/lib/rubocop/cop/metrics/cyclomatic_complexity.rb +1 -1
  26. data/lib/rubocop/cop/metrics/utils/abc_size_calculator.rb +2 -5
  27. data/lib/rubocop/cop/mixin/alignment.rb +1 -1
  28. data/lib/rubocop/cop/mixin/hash_shorthand_syntax.rb +40 -18
  29. data/lib/rubocop/cop/mixin/line_length_help.rb +3 -1
  30. data/lib/rubocop/cop/naming/block_forwarding.rb +4 -0
  31. data/lib/rubocop/cop/registry.rb +12 -7
  32. data/lib/rubocop/cop/style/access_modifier_declarations.rb +18 -10
  33. data/lib/rubocop/cop/style/block_delimiters.rb +8 -2
  34. data/lib/rubocop/cop/style/class_and_module_children.rb +2 -9
  35. data/lib/rubocop/cop/style/comparable_clamp.rb +125 -0
  36. data/lib/rubocop/cop/style/conditional_assignment.rb +0 -6
  37. data/lib/rubocop/cop/style/infinite_loop.rb +2 -5
  38. data/lib/rubocop/cop/style/invertible_unless_condition.rb +114 -0
  39. data/lib/rubocop/cop/style/method_call_with_args_parentheses/omit_parentheses.rb +11 -5
  40. data/lib/rubocop/cop/style/method_call_without_args_parentheses.rb +2 -0
  41. data/lib/rubocop/cop/style/min_max_comparison.rb +11 -1
  42. data/lib/rubocop/cop/style/multiline_if_modifier.rb +0 -4
  43. data/lib/rubocop/cop/style/multiline_memoization.rb +2 -2
  44. data/lib/rubocop/cop/style/negated_if_else_condition.rb +1 -5
  45. data/lib/rubocop/cop/style/one_line_conditional.rb +3 -6
  46. data/lib/rubocop/cop/style/operator_method_call.rb +1 -1
  47. data/lib/rubocop/cop/style/parallel_assignment.rb +3 -1
  48. data/lib/rubocop/cop/style/redundant_conditional.rb +0 -4
  49. data/lib/rubocop/cop/style/redundant_double_splat_hash_braces.rb +16 -10
  50. data/lib/rubocop/cop/style/require_order.rb +2 -9
  51. data/lib/rubocop/cop/style/self_assignment.rb +2 -2
  52. data/lib/rubocop/cop/style/semicolon.rb +24 -2
  53. data/lib/rubocop/cop/variable_force/variable_table.rb +3 -1
  54. data/lib/rubocop/cop/variable_force.rb +1 -1
  55. data/lib/rubocop/formatter.rb +0 -1
  56. data/lib/rubocop/rspec/expect_offense.rb +6 -4
  57. data/lib/rubocop/server/cache.rb +3 -1
  58. data/lib/rubocop/version.rb +1 -1
  59. data/lib/rubocop.rb +3 -0
  60. 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 a offense, annotate code by writing '^'s
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 'Use `expect_no_corrections` if the code will not change' if new_source == source
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
@@ -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(yaml_code, permitted_classes: [Regexp, Symbol])
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')
@@ -3,7 +3,7 @@
3
3
  module RuboCop
4
4
  # This module holds the RuboCop version information.
5
5
  module Version
6
- STRING = '1.43.0'
6
+ STRING = '1.44.1'
7
7
 
8
8
  MSG = '%<version>s (using Parser %<parser_version>s, ' \
9
9
  'rubocop-ast %<rubocop_ast_version>s, ' \
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.43.0
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-10 00:00:00.000000000 Z
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.43/
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: