rubocop 1.77.0 → 1.79.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.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/config/default.yml +36 -20
  4. data/lib/rubocop/cli.rb +12 -1
  5. data/lib/rubocop/config_loader.rb +1 -38
  6. data/lib/rubocop/cop/internal_affairs/example_description.rb +1 -1
  7. data/lib/rubocop/cop/internal_affairs/node_type_group.rb +3 -2
  8. data/lib/rubocop/cop/internal_affairs/useless_restrict_on_send.rb +1 -1
  9. data/lib/rubocop/cop/layout/empty_lines_after_module_inclusion.rb +99 -0
  10. data/lib/rubocop/cop/layout/space_around_keyword.rb +6 -1
  11. data/lib/rubocop/cop/layout/space_around_operators.rb +8 -0
  12. data/lib/rubocop/cop/lint/duplicate_methods.rb +25 -4
  13. data/lib/rubocop/cop/lint/literal_as_condition.rb +3 -1
  14. data/lib/rubocop/cop/lint/numeric_operation_with_constant_result.rb +1 -0
  15. data/lib/rubocop/cop/lint/redundant_safe_navigation.rb +101 -2
  16. data/lib/rubocop/cop/lint/redundant_type_conversion.rb +4 -4
  17. data/lib/rubocop/cop/lint/require_range_parentheses.rb +1 -1
  18. data/lib/rubocop/cop/lint/rescue_type.rb +1 -1
  19. data/lib/rubocop/cop/lint/useless_numeric_operation.rb +1 -0
  20. data/lib/rubocop/cop/lint/utils/nil_receiver_checker.rb +121 -0
  21. data/lib/rubocop/cop/naming/method_name.rb +102 -13
  22. data/lib/rubocop/cop/naming/predicate_method.rb +27 -2
  23. data/lib/rubocop/cop/security/eval.rb +2 -1
  24. data/lib/rubocop/cop/security/open.rb +1 -0
  25. data/lib/rubocop/cop/style/access_modifier_declarations.rb +1 -1
  26. data/lib/rubocop/cop/style/accessor_grouping.rb +13 -1
  27. data/lib/rubocop/cop/style/array_intersect.rb +51 -23
  28. data/lib/rubocop/cop/style/block_delimiters.rb +1 -1
  29. data/lib/rubocop/cop/style/conditional_assignment.rb +1 -1
  30. data/lib/rubocop/cop/style/dig_chain.rb +1 -1
  31. data/lib/rubocop/cop/style/exponential_notation.rb +1 -0
  32. data/lib/rubocop/cop/style/hash_conversion.rb +8 -9
  33. data/lib/rubocop/cop/style/inverse_methods.rb +1 -1
  34. data/lib/rubocop/cop/style/it_assignment.rb +69 -12
  35. data/lib/rubocop/cop/style/it_block_parameter.rb +3 -1
  36. data/lib/rubocop/cop/style/method_call_with_args_parentheses/omit_parentheses.rb +2 -4
  37. data/lib/rubocop/cop/style/method_call_with_args_parentheses.rb +16 -0
  38. data/lib/rubocop/cop/style/parallel_assignment.rb +3 -0
  39. data/lib/rubocop/cop/style/redundant_fetch_block.rb +1 -9
  40. data/lib/rubocop/cop/style/redundant_freeze.rb +1 -1
  41. data/lib/rubocop/cop/style/redundant_line_continuation.rb +1 -1
  42. data/lib/rubocop/cop/style/redundant_parentheses.rb +1 -0
  43. data/lib/rubocop/cop/style/single_line_methods.rb +7 -4
  44. data/lib/rubocop/cop/style/sole_nested_conditional.rb +30 -1
  45. data/lib/rubocop/cop/style/stabby_lambda_parentheses.rb +1 -1
  46. data/lib/rubocop/cop/variable_force.rb +16 -7
  47. data/lib/rubocop/cops_documentation_generator.rb +1 -0
  48. data/lib/rubocop/formatter/markdown_formatter.rb +1 -0
  49. data/lib/rubocop/formatter/pacman_formatter.rb +1 -0
  50. data/lib/rubocop/pending_cops_reporter.rb +56 -0
  51. data/lib/rubocop/server/cache.rb +4 -2
  52. data/lib/rubocop/server/client_command/base.rb +10 -0
  53. data/lib/rubocop/server/client_command/exec.rb +2 -1
  54. data/lib/rubocop/server/client_command/start.rb +11 -1
  55. data/lib/rubocop/version.rb +1 -1
  56. data/lib/rubocop.rb +3 -0
  57. metadata +23 -6
@@ -46,12 +46,14 @@ module RuboCop
46
46
  end
47
47
 
48
48
  # rubocop:disable Metrics/AbcSize
49
- def restart_key
49
+ def restart_key(args_config_file_path: nil)
50
50
  lockfile_path = LOCKFILE_NAMES.map do |lockfile_name|
51
51
  Pathname(project_dir).join(lockfile_name)
52
52
  end.find(&:exist?)
53
53
  version_data = lockfile_path&.read || RuboCop::Version::STRING
54
- config_data = Pathname(ConfigFinder.find_config_path(Dir.pwd)).read
54
+ config_data = Pathname(
55
+ args_config_file_path || ConfigFinder.find_config_path(Dir.pwd)
56
+ ).read
55
57
  yaml = load_erb_templated_yaml(config_data)
56
58
 
57
59
  inherit_from_data = inherit_from_data(yaml)
@@ -38,6 +38,16 @@ module RuboCop
38
38
  warn 'RuboCop server is not running.' unless running
39
39
  end
40
40
  end
41
+
42
+ class << self
43
+ def args_config_file_path
44
+ first_args_config_key_index = ARGV.index { |value| ['-c', '--config'].include?(value) }
45
+
46
+ return if first_args_config_key_index.nil?
47
+
48
+ ARGV[first_args_config_key_index + 1]
49
+ end
50
+ end
41
51
  end
42
52
  end
43
53
  end
@@ -41,7 +41,8 @@ module RuboCop
41
41
  end
42
42
 
43
43
  def incompatible_version?
44
- Cache.version_path.read != Cache.restart_key
44
+ Cache.version_path.read !=
45
+ Cache.restart_key(args_config_file_path: self.class.args_config_file_path)
45
46
  end
46
47
 
47
48
  def stderr
@@ -34,7 +34,7 @@ module RuboCop
34
34
  exit 0
35
35
  end
36
36
 
37
- Cache.write_version_file(Cache.restart_key)
37
+ write_version_file
38
38
 
39
39
  host = ENV.fetch('RUBOCOP_SERVER_HOST', '127.0.0.1')
40
40
  port = ENV.fetch('RUBOCOP_SERVER_PORT', 0)
@@ -42,6 +42,16 @@ module RuboCop
42
42
  Server::Core.new.start(host, port, detach: @detach)
43
43
  end
44
44
  end
45
+
46
+ private
47
+
48
+ def write_version_file
49
+ Cache.write_version_file(
50
+ Cache.restart_key(
51
+ args_config_file_path: self.class.args_config_file_path
52
+ )
53
+ )
54
+ end
45
55
  end
46
56
  end
47
57
  end
@@ -3,7 +3,7 @@
3
3
  module RuboCop
4
4
  # This module holds the RuboCop version information.
5
5
  module Version
6
- STRING = '1.77.0'
6
+ STRING = '1.79.0'
7
7
 
8
8
  MSG = '%<version>s (using %<parser_version>s, ' \
9
9
  'rubocop-ast %<rubocop_ast_version>s, ' \
data/lib/rubocop.rb CHANGED
@@ -211,6 +211,7 @@ require_relative 'rubocop/cop/layout/empty_line_after_guard_clause'
211
211
  require_relative 'rubocop/cop/layout/empty_line_after_magic_comment'
212
212
  require_relative 'rubocop/cop/layout/empty_line_after_multiline_condition'
213
213
  require_relative 'rubocop/cop/layout/empty_line_between_defs'
214
+ require_relative 'rubocop/cop/layout/empty_lines_after_module_inclusion'
214
215
  require_relative 'rubocop/cop/layout/empty_lines_around_access_modifier'
215
216
  require_relative 'rubocop/cop/layout/empty_lines_around_arguments'
216
217
  require_relative 'rubocop/cop/layout/empty_lines_around_attribute_accessor'
@@ -290,6 +291,7 @@ require_relative 'rubocop/cop/layout/space_inside_string_interpolation'
290
291
  require_relative 'rubocop/cop/layout/trailing_empty_lines'
291
292
  require_relative 'rubocop/cop/layout/trailing_whitespace'
292
293
 
294
+ require_relative 'rubocop/cop/lint/utils/nil_receiver_checker'
293
295
  require_relative 'rubocop/cop/lint/ambiguous_assignment'
294
296
  require_relative 'rubocop/cop/lint/ambiguous_block_association'
295
297
  require_relative 'rubocop/cop/lint/ambiguous_operator'
@@ -812,6 +814,7 @@ require_relative 'rubocop/options'
812
814
  require_relative 'rubocop/remote_config'
813
815
  require_relative 'rubocop/target_ruby'
814
816
  require_relative 'rubocop/yaml_duplication_checker'
817
+ require_relative 'rubocop/pending_cops_reporter'
815
818
 
816
819
  # rubocop:enable Style/RequireOrder
817
820
 
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.77.0
4
+ version: 1.79.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bozhidar Batsov
@@ -9,7 +9,7 @@ authors:
9
9
  - Yuji Nakayama
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2025-06-20 00:00:00.000000000 Z
12
+ date: 2025-07-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json
@@ -127,7 +127,7 @@ dependencies:
127
127
  requirements:
128
128
  - - ">="
129
129
  - !ruby/object:Gem::Version
130
- version: 1.45.1
130
+ version: 1.46.0
131
131
  - - "<"
132
132
  - !ruby/object:Gem::Version
133
133
  version: '2.0'
@@ -137,7 +137,7 @@ dependencies:
137
137
  requirements:
138
138
  - - ">="
139
139
  - !ruby/object:Gem::Version
140
- version: 1.45.1
140
+ version: 1.46.0
141
141
  - - "<"
142
142
  - !ruby/object:Gem::Version
143
143
  version: '2.0'
@@ -155,6 +155,20 @@ dependencies:
155
155
  - - "~>"
156
156
  - !ruby/object:Gem::Version
157
157
  version: '1.7'
158
+ - !ruby/object:Gem::Dependency
159
+ name: tsort
160
+ requirement: !ruby/object:Gem::Requirement
161
+ requirements:
162
+ - - ">="
163
+ - !ruby/object:Gem::Version
164
+ version: 0.2.0
165
+ type: :runtime
166
+ prerelease: false
167
+ version_requirements: !ruby/object:Gem::Requirement
168
+ requirements:
169
+ - - ">="
170
+ - !ruby/object:Gem::Version
171
+ version: 0.2.0
158
172
  - !ruby/object:Gem::Dependency
159
173
  name: unicode-display_width
160
174
  requirement: !ruby/object:Gem::Requirement
@@ -342,6 +356,7 @@ files:
342
356
  - lib/rubocop/cop/layout/empty_line_after_multiline_condition.rb
343
357
  - lib/rubocop/cop/layout/empty_line_between_defs.rb
344
358
  - lib/rubocop/cop/layout/empty_lines.rb
359
+ - lib/rubocop/cop/layout/empty_lines_after_module_inclusion.rb
345
360
  - lib/rubocop/cop/layout/empty_lines_around_access_modifier.rb
346
361
  - lib/rubocop/cop/layout/empty_lines_around_arguments.rb
347
362
  - lib/rubocop/cop/layout/empty_lines_around_attribute_accessor.rb
@@ -572,6 +587,7 @@ files:
572
587
  - lib/rubocop/cop/lint/useless_ruby2_keywords.rb
573
588
  - lib/rubocop/cop/lint/useless_setter_call.rb
574
589
  - lib/rubocop/cop/lint/useless_times.rb
590
+ - lib/rubocop/cop/lint/utils/nil_receiver_checker.rb
575
591
  - lib/rubocop/cop/lint/void.rb
576
592
  - lib/rubocop/cop/message_annotator.rb
577
593
  - lib/rubocop/cop/metrics/abc_size.rb
@@ -1040,6 +1056,7 @@ files:
1040
1056
  - lib/rubocop/name_similarity.rb
1041
1057
  - lib/rubocop/options.rb
1042
1058
  - lib/rubocop/path_util.rb
1059
+ - lib/rubocop/pending_cops_reporter.rb
1043
1060
  - lib/rubocop/platform.rb
1044
1061
  - lib/rubocop/plugin.rb
1045
1062
  - lib/rubocop/plugin/configuration_integrator.rb
@@ -1087,9 +1104,9 @@ licenses:
1087
1104
  - MIT
1088
1105
  metadata:
1089
1106
  homepage_uri: https://rubocop.org/
1090
- changelog_uri: https://github.com/rubocop/rubocop/releases/tag/v1.77.0
1107
+ changelog_uri: https://github.com/rubocop/rubocop/releases/tag/v1.79.0
1091
1108
  source_code_uri: https://github.com/rubocop/rubocop/
1092
- documentation_uri: https://docs.rubocop.org/rubocop/1.77/
1109
+ documentation_uri: https://docs.rubocop.org/rubocop/1.79/
1093
1110
  bug_tracker_uri: https://github.com/rubocop/rubocop/issues
1094
1111
  rubygems_mfa_required: 'true'
1095
1112
  rdoc_options: []