rubocop 1.30.1 → 1.31.2

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 (132) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/config/default.yml +41 -8
  4. data/config/obsoletion.yml +2 -0
  5. data/exe/rubocop +15 -7
  6. data/lib/rubocop/cli/command/auto_genenerate_config.rb +1 -1
  7. data/lib/rubocop/cli/command/suggest_extensions.rb +3 -3
  8. data/lib/rubocop/config.rb +4 -0
  9. data/lib/rubocop/config_loader.rb +1 -0
  10. data/lib/rubocop/config_loader_resolver.rb +1 -1
  11. data/lib/rubocop/config_validator.rb +3 -3
  12. data/lib/rubocop/cop/base.rb +5 -1
  13. data/lib/rubocop/cop/bundler/duplicated_gem.rb +1 -1
  14. data/lib/rubocop/cop/bundler/gem_filename.rb +4 -4
  15. data/lib/rubocop/cop/bundler/ordered_gems.rb +2 -2
  16. data/lib/rubocop/cop/corrector.rb +2 -2
  17. data/lib/rubocop/cop/correctors/multiline_literal_brace_corrector.rb +3 -3
  18. data/lib/rubocop/cop/correctors/unused_arg_corrector.rb +1 -1
  19. data/lib/rubocop/cop/gemspec/deprecated_attribute_assignment.rb +31 -16
  20. data/lib/rubocop/cop/gemspec/duplicated_assignment.rb +1 -1
  21. data/lib/rubocop/cop/gemspec/ordered_dependencies.rb +1 -1
  22. data/lib/rubocop/cop/gemspec/require_mfa.rb +20 -20
  23. data/lib/rubocop/cop/generator.rb +5 -1
  24. data/lib/rubocop/cop/internal_affairs/node_matcher_directive.rb +1 -5
  25. data/lib/rubocop/cop/internal_affairs/redundant_location_argument.rb +1 -1
  26. data/lib/rubocop/cop/internal_affairs/redundant_message_argument.rb +1 -1
  27. data/lib/rubocop/cop/internal_affairs/useless_restrict_on_send.rb +54 -0
  28. data/lib/rubocop/cop/internal_affairs.rb +1 -0
  29. data/lib/rubocop/cop/layout/empty_comment.rb +1 -1
  30. data/lib/rubocop/cop/layout/empty_lines_around_attribute_accessor.rb +25 -4
  31. data/lib/rubocop/cop/layout/first_array_element_indentation.rb +20 -13
  32. data/lib/rubocop/cop/layout/first_hash_element_indentation.rb +51 -12
  33. data/lib/rubocop/cop/layout/initial_indentation.rb +1 -1
  34. data/lib/rubocop/cop/layout/line_continuation_leading_space.rb +68 -0
  35. data/lib/rubocop/cop/layout/line_continuation_spacing.rb +130 -0
  36. data/lib/rubocop/cop/layout/multiline_block_layout.rb +1 -1
  37. data/lib/rubocop/cop/layout/multiline_method_call_indentation.rb +2 -2
  38. data/lib/rubocop/cop/layout/multiline_operation_indentation.rb +2 -2
  39. data/lib/rubocop/cop/layout/space_around_block_parameters.rb +1 -1
  40. data/lib/rubocop/cop/layout/space_around_operators.rb +1 -1
  41. data/lib/rubocop/cop/layout/space_before_block_braces.rb +1 -1
  42. data/lib/rubocop/cop/layout/space_before_first_arg.rb +1 -1
  43. data/lib/rubocop/cop/layout/space_inside_block_braces.rb +5 -3
  44. data/lib/rubocop/cop/layout/trailing_whitespace.rb +1 -1
  45. data/lib/rubocop/cop/lint/constant_overwritten_in_rescue.rb +51 -0
  46. data/lib/rubocop/cop/lint/interpolation_check.rb +1 -1
  47. data/lib/rubocop/cop/lint/literal_as_condition.rb +5 -0
  48. data/lib/rubocop/cop/lint/non_atomic_file_operation.rb +126 -0
  49. data/lib/rubocop/cop/lint/number_conversion.rb +3 -3
  50. data/lib/rubocop/cop/lint/parentheses_as_grouped_expression.rb +1 -1
  51. data/lib/rubocop/cop/lint/redundant_cop_disable_directive.rb +5 -5
  52. data/lib/rubocop/cop/lint/redundant_cop_enable_directive.rb +1 -1
  53. data/lib/rubocop/cop/lint/redundant_require_statement.rb +1 -1
  54. data/lib/rubocop/cop/lint/regexp_as_condition.rb +2 -2
  55. data/lib/rubocop/cop/lint/struct_new_override.rb +2 -2
  56. data/lib/rubocop/cop/lint/trailing_comma_in_attribute_declaration.rb +1 -1
  57. data/lib/rubocop/cop/lint/useless_else_without_rescue.rb +44 -0
  58. data/lib/rubocop/cop/metrics/utils/code_length_calculator.rb +1 -1
  59. data/lib/rubocop/cop/mixin/def_node.rb +2 -7
  60. data/lib/rubocop/cop/mixin/multiline_element_indentation.rb +34 -12
  61. data/lib/rubocop/cop/mixin/range_help.rb +7 -3
  62. data/lib/rubocop/cop/style/accessor_grouping.rb +1 -1
  63. data/lib/rubocop/cop/style/arguments_forwarding.rb +1 -1
  64. data/lib/rubocop/cop/style/block_delimiters.rb +4 -2
  65. data/lib/rubocop/cop/style/commented_keyword.rb +1 -1
  66. data/lib/rubocop/cop/style/conditional_assignment.rb +1 -0
  67. data/lib/rubocop/cop/style/empty_method.rb +16 -1
  68. data/lib/rubocop/cop/style/encoding.rb +1 -1
  69. data/lib/rubocop/cop/style/explicit_block_argument.rb +1 -1
  70. data/lib/rubocop/cop/style/format_string_token.rb +48 -17
  71. data/lib/rubocop/cop/style/frozen_string_literal_comment.rb +1 -1
  72. data/lib/rubocop/cop/style/guard_clause.rb +8 -6
  73. data/lib/rubocop/cop/style/hash_as_last_array_item.rb +1 -1
  74. data/lib/rubocop/cop/style/hash_except.rb +88 -8
  75. data/lib/rubocop/cop/style/hash_syntax.rb +2 -2
  76. data/lib/rubocop/cop/style/implicit_runtime_error.rb +2 -2
  77. data/lib/rubocop/cop/style/keyword_parameters_order.rb +1 -1
  78. data/lib/rubocop/cop/style/line_end_concatenation.rb +1 -1
  79. data/lib/rubocop/cop/style/map_to_hash.rb +1 -1
  80. data/lib/rubocop/cop/style/method_call_with_args_parentheses/omit_parentheses.rb +2 -2
  81. data/lib/rubocop/cop/style/module_function.rb +2 -2
  82. data/lib/rubocop/cop/style/multiline_if_modifier.rb +2 -2
  83. data/lib/rubocop/cop/style/multiline_if_then.rb +1 -1
  84. data/lib/rubocop/cop/style/multiline_in_pattern_then.rb +1 -3
  85. data/lib/rubocop/cop/style/multiline_method_signature.rb +1 -1
  86. data/lib/rubocop/cop/style/multiline_ternary_operator.rb +1 -1
  87. data/lib/rubocop/cop/style/multiline_when_then.rb +1 -3
  88. data/lib/rubocop/cop/style/nested_parenthesized_calls.rb +1 -1
  89. data/lib/rubocop/cop/style/nested_ternary_operator.rb +19 -7
  90. data/lib/rubocop/cop/style/nil_lambda.rb +1 -1
  91. data/lib/rubocop/cop/style/not.rb +1 -1
  92. data/lib/rubocop/cop/style/redundant_argument.rb +1 -1
  93. data/lib/rubocop/cop/style/redundant_parentheses.rb +2 -1
  94. data/lib/rubocop/cop/style/redundant_return.rb +1 -1
  95. data/lib/rubocop/cop/style/redundant_self_assignment.rb +1 -1
  96. data/lib/rubocop/cop/style/sole_nested_conditional.rb +2 -2
  97. data/lib/rubocop/cop/style/struct_inheritance.rb +2 -2
  98. data/lib/rubocop/cop/style/swap_values.rb +1 -1
  99. data/lib/rubocop/cop/style/symbol_proc.rb +1 -1
  100. data/lib/rubocop/cop/style/top_level_method_definition.rb +0 -2
  101. data/lib/rubocop/cop/style/unpack_first.rb +1 -1
  102. data/lib/rubocop/cop/util.rb +1 -1
  103. data/lib/rubocop/formatter/formatter_set.rb +20 -19
  104. data/lib/rubocop/formatter/git_hub_actions_formatter.rb +15 -2
  105. data/lib/rubocop/formatter/html_formatter.rb +0 -1
  106. data/lib/rubocop/formatter/offense_count_formatter.rb +2 -0
  107. data/lib/rubocop/formatter/simple_text_formatter.rb +6 -7
  108. data/lib/rubocop/formatter.rb +31 -0
  109. data/lib/rubocop/options.rb +24 -1
  110. data/lib/rubocop/rake_task.rb +34 -9
  111. data/lib/rubocop/server/cache.rb +109 -0
  112. data/lib/rubocop/server/cli.rb +104 -0
  113. data/lib/rubocop/server/client_command/base.rb +44 -0
  114. data/lib/rubocop/server/client_command/exec.rb +59 -0
  115. data/lib/rubocop/server/client_command/restart.rb +25 -0
  116. data/lib/rubocop/server/client_command/start.rb +43 -0
  117. data/lib/rubocop/server/client_command/status.rb +28 -0
  118. data/lib/rubocop/server/client_command/stop.rb +31 -0
  119. data/lib/rubocop/server/client_command.rb +26 -0
  120. data/lib/rubocop/server/core.rb +79 -0
  121. data/lib/rubocop/server/errors.rb +23 -0
  122. data/lib/rubocop/server/helper.rb +34 -0
  123. data/lib/rubocop/server/server_command/base.rb +50 -0
  124. data/lib/rubocop/server/server_command/exec.rb +34 -0
  125. data/lib/rubocop/server/server_command/stop.rb +24 -0
  126. data/lib/rubocop/server/server_command.rb +21 -0
  127. data/lib/rubocop/server/socket_reader.rb +65 -0
  128. data/lib/rubocop/server.rb +53 -0
  129. data/lib/rubocop/version.rb +15 -8
  130. data/lib/rubocop.rb +8 -27
  131. metadata +42 -4
  132. data/lib/rubocop/cop/gemspec/date_assignment.rb +0 -49
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.30.1
4
+ version: 1.31.2
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-06-06 00:00:00.000000000 Z
13
+ date: 2022-07-07 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
@@ -255,7 +269,6 @@ files:
255
269
  - lib/rubocop/cop/documentation.rb
256
270
  - lib/rubocop/cop/exclude_limit.rb
257
271
  - lib/rubocop/cop/force.rb
258
- - lib/rubocop/cop/gemspec/date_assignment.rb
259
272
  - lib/rubocop/cop/gemspec/dependency_version.rb
260
273
  - lib/rubocop/cop/gemspec/deprecated_attribute_assignment.rb
261
274
  - lib/rubocop/cop/gemspec/duplicated_assignment.rb
@@ -288,6 +301,7 @@ files:
288
301
  - lib/rubocop/cop/internal_affairs/style_detected_api_use.rb
289
302
  - lib/rubocop/cop/internal_affairs/undefined_config.rb
290
303
  - lib/rubocop/cop/internal_affairs/useless_message_assertion.rb
304
+ - lib/rubocop/cop/internal_affairs/useless_restrict_on_send.rb
291
305
  - lib/rubocop/cop/layout/access_modifier_indentation.rb
292
306
  - lib/rubocop/cop/layout/argument_alignment.rb
293
307
  - lib/rubocop/cop/layout/array_alignment.rb
@@ -339,6 +353,8 @@ files:
339
353
  - lib/rubocop/cop/layout/initial_indentation.rb
340
354
  - lib/rubocop/cop/layout/leading_comment_space.rb
341
355
  - lib/rubocop/cop/layout/leading_empty_lines.rb
356
+ - lib/rubocop/cop/layout/line_continuation_leading_space.rb
357
+ - lib/rubocop/cop/layout/line_continuation_spacing.rb
342
358
  - lib/rubocop/cop/layout/line_end_string_concatenation_indentation.rb
343
359
  - lib/rubocop/cop/layout/line_length.rb
344
360
  - lib/rubocop/cop/layout/multiline_array_brace_layout.rb
@@ -398,6 +414,7 @@ files:
398
414
  - lib/rubocop/cop/lint/boolean_symbol.rb
399
415
  - lib/rubocop/cop/lint/circular_argument_reference.rb
400
416
  - lib/rubocop/cop/lint/constant_definition_in_block.rb
417
+ - lib/rubocop/cop/lint/constant_overwritten_in_rescue.rb
401
418
  - lib/rubocop/cop/lint/constant_resolution.rb
402
419
  - lib/rubocop/cop/lint/debugger.rb
403
420
  - lib/rubocop/cop/lint/deprecated_class_methods.rb
@@ -449,6 +466,7 @@ files:
449
466
  - lib/rubocop/cop/lint/nested_percent_literal.rb
450
467
  - lib/rubocop/cop/lint/next_without_accumulator.rb
451
468
  - lib/rubocop/cop/lint/no_return_in_begin_end_blocks.rb
469
+ - lib/rubocop/cop/lint/non_atomic_file_operation.rb
452
470
  - lib/rubocop/cop/lint/non_deterministic_require_order.rb
453
471
  - lib/rubocop/cop/lint/non_local_exit_from_iterator.rb
454
472
  - lib/rubocop/cop/lint/number_conversion.rb
@@ -507,6 +525,7 @@ files:
507
525
  - lib/rubocop/cop/lint/uri_regexp.rb
508
526
  - lib/rubocop/cop/lint/useless_access_modifier.rb
509
527
  - lib/rubocop/cop/lint/useless_assignment.rb
528
+ - lib/rubocop/cop/lint/useless_else_without_rescue.rb
510
529
  - lib/rubocop/cop/lint/useless_method_definition.rb
511
530
  - lib/rubocop/cop/lint/useless_ruby2_keywords.rb
512
531
  - lib/rubocop/cop/lint/useless_setter_call.rb
@@ -878,6 +897,7 @@ files:
878
897
  - lib/rubocop/ext/regexp_node.rb
879
898
  - lib/rubocop/ext/regexp_parser.rb
880
899
  - lib/rubocop/file_finder.rb
900
+ - lib/rubocop/formatter.rb
881
901
  - lib/rubocop/formatter/auto_gen_config_formatter.rb
882
902
  - lib/rubocop/formatter/base_formatter.rb
883
903
  - lib/rubocop/formatter/clang_style_formatter.rb
@@ -916,6 +936,24 @@ files:
916
936
  - lib/rubocop/rspec/shared_contexts.rb
917
937
  - lib/rubocop/rspec/support.rb
918
938
  - lib/rubocop/runner.rb
939
+ - lib/rubocop/server.rb
940
+ - lib/rubocop/server/cache.rb
941
+ - lib/rubocop/server/cli.rb
942
+ - lib/rubocop/server/client_command.rb
943
+ - lib/rubocop/server/client_command/base.rb
944
+ - lib/rubocop/server/client_command/exec.rb
945
+ - lib/rubocop/server/client_command/restart.rb
946
+ - lib/rubocop/server/client_command/start.rb
947
+ - lib/rubocop/server/client_command/status.rb
948
+ - lib/rubocop/server/client_command/stop.rb
949
+ - lib/rubocop/server/core.rb
950
+ - lib/rubocop/server/errors.rb
951
+ - lib/rubocop/server/helper.rb
952
+ - lib/rubocop/server/server_command.rb
953
+ - lib/rubocop/server/server_command/base.rb
954
+ - lib/rubocop/server/server_command/exec.rb
955
+ - lib/rubocop/server/server_command/stop.rb
956
+ - lib/rubocop/server/socket_reader.rb
919
957
  - lib/rubocop/string_interpreter.rb
920
958
  - lib/rubocop/target_finder.rb
921
959
  - lib/rubocop/target_ruby.rb
@@ -930,7 +968,7 @@ metadata:
930
968
  homepage_uri: https://rubocop.org/
931
969
  changelog_uri: https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md
932
970
  source_code_uri: https://github.com/rubocop/rubocop/
933
- documentation_uri: https://docs.rubocop.org/rubocop/1.30/
971
+ documentation_uri: https://docs.rubocop.org/rubocop/1.31/
934
972
  bug_tracker_uri: https://github.com/rubocop/rubocop/issues
935
973
  rubygems_mfa_required: 'true'
936
974
  post_install_message:
@@ -1,49 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module RuboCop
4
- module Cop
5
- module Gemspec
6
- # Checks that `date =` is not used in gemspec file.
7
- # It is set automatically when the gem is packaged.
8
- #
9
- # @example
10
- #
11
- # # bad
12
- # Gem::Specification.new do |spec|
13
- # spec.name = 'your_cool_gem_name'
14
- # spec.date = Time.now.strftime('%Y-%m-%d')
15
- # end
16
- #
17
- # # good
18
- # Gem::Specification.new do |spec|
19
- # spec.name = 'your_cool_gem_name'
20
- # end
21
- #
22
- class DateAssignment < Base
23
- include RangeHelp
24
- include GemspecHelp
25
- extend AutoCorrector
26
-
27
- MSG = 'Do not use `date =` in gemspec, it is set automatically when the gem is packaged.'
28
-
29
- def on_block(block_node)
30
- return unless gem_specification?(block_node)
31
-
32
- block_parameter = block_node.arguments.first.source
33
-
34
- date_assignment = block_node.descendants.detect do |node|
35
- node.send_type? && node.receiver&.source == block_parameter && node.method?(:date=)
36
- end
37
-
38
- return unless date_assignment
39
-
40
- add_offense(date_assignment) do |corrector|
41
- range = range_by_whole_lines(date_assignment.source_range, include_final_newline: true)
42
-
43
- corrector.remove(range)
44
- end
45
- end
46
- end
47
- end
48
- end
49
- end