rubocop 1.50.2 → 1.53.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 (141) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -3
  3. data/config/default.yml +76 -6
  4. data/lib/rubocop/cli/command/lsp.rb +19 -0
  5. data/lib/rubocop/cli.rb +3 -0
  6. data/lib/rubocop/config.rb +4 -0
  7. data/lib/rubocop/config_loader_resolver.rb +4 -3
  8. data/lib/rubocop/config_obsoletion.rb +2 -2
  9. data/lib/rubocop/cop/base.rb +5 -1
  10. data/lib/rubocop/cop/bundler/gem_comment.rb +1 -1
  11. data/lib/rubocop/cop/bundler/gem_version.rb +2 -2
  12. data/lib/rubocop/cop/correctors/alignment_corrector.rb +1 -1
  13. data/lib/rubocop/cop/gemspec/dependency_version.rb +2 -2
  14. data/lib/rubocop/cop/gemspec/development_dependencies.rb +1 -1
  15. data/lib/rubocop/cop/internal_affairs/cop_description.rb +32 -8
  16. data/lib/rubocop/cop/internal_affairs/node_matcher_directive.rb +5 -5
  17. data/lib/rubocop/cop/layout/class_structure.rb +7 -0
  18. data/lib/rubocop/cop/layout/closing_heredoc_indentation.rb +1 -2
  19. data/lib/rubocop/cop/layout/empty_line_between_defs.rb +1 -1
  20. data/lib/rubocop/cop/layout/empty_lines_around_exception_handling_keywords.rb +2 -0
  21. data/lib/rubocop/cop/layout/heredoc_argument_closing_parenthesis.rb +2 -2
  22. data/lib/rubocop/cop/layout/indentation_style.rb +1 -1
  23. data/lib/rubocop/cop/layout/indentation_width.rb +2 -2
  24. data/lib/rubocop/cop/layout/redundant_line_break.rb +1 -1
  25. data/lib/rubocop/cop/layout/space_inside_block_braces.rb +2 -0
  26. data/lib/rubocop/cop/layout/space_inside_range_literal.rb +1 -1
  27. data/lib/rubocop/cop/lint/ambiguous_block_association.rb +13 -1
  28. data/lib/rubocop/cop/lint/debugger.rb +1 -1
  29. data/lib/rubocop/cop/lint/duplicate_hash_key.rb +2 -1
  30. data/lib/rubocop/cop/lint/duplicate_regexp_character_class_element.rb +46 -19
  31. data/lib/rubocop/cop/lint/erb_new_arguments.rb +3 -4
  32. data/lib/rubocop/cop/lint/heredoc_method_call_position.rb +1 -1
  33. data/lib/rubocop/cop/lint/identity_comparison.rb +0 -1
  34. data/lib/rubocop/cop/lint/incompatible_io_select_with_fiber_scheduler.rb +5 -3
  35. data/lib/rubocop/cop/lint/inherit_exception.rb +9 -0
  36. data/lib/rubocop/cop/lint/lambda_without_literal_block.rb +1 -1
  37. data/lib/rubocop/cop/lint/missing_super.rb +34 -5
  38. data/lib/rubocop/cop/lint/mixed_case_range.rb +109 -0
  39. data/lib/rubocop/cop/lint/number_conversion.rb +5 -0
  40. data/lib/rubocop/cop/lint/numbered_parameter_assignment.rb +2 -2
  41. data/lib/rubocop/cop/lint/ordered_magic_comments.rb +0 -1
  42. data/lib/rubocop/cop/lint/out_of_range_regexp_ref.rb +2 -2
  43. data/lib/rubocop/cop/lint/redundant_regexp_quantifiers.rb +120 -0
  44. data/lib/rubocop/cop/lint/redundant_require_statement.rb +8 -3
  45. data/lib/rubocop/cop/lint/redundant_string_coercion.rb +1 -1
  46. data/lib/rubocop/cop/lint/send_with_mixin_argument.rb +1 -2
  47. data/lib/rubocop/cop/lint/shadowed_exception.rb +5 -11
  48. data/lib/rubocop/cop/lint/suppressed_exception.rb +1 -1
  49. data/lib/rubocop/cop/lint/top_level_return_with_argument.rb +23 -9
  50. data/lib/rubocop/cop/lint/useless_assignment.rb +59 -1
  51. data/lib/rubocop/cop/lint/void.rb +63 -7
  52. data/lib/rubocop/cop/metrics/utils/abc_size_calculator.rb +1 -2
  53. data/lib/rubocop/cop/migration/department_name.rb +2 -2
  54. data/lib/rubocop/cop/mixin/allowed_receivers.rb +34 -0
  55. data/lib/rubocop/cop/mixin/comments_help.rb +7 -3
  56. data/lib/rubocop/cop/mixin/end_keyword_alignment.rb +1 -1
  57. data/lib/rubocop/cop/mixin/percent_literal.rb +1 -1
  58. data/lib/rubocop/cop/mixin/space_after_punctuation.rb +1 -1
  59. data/lib/rubocop/cop/naming/block_forwarding.rb +1 -1
  60. data/lib/rubocop/cop/naming/constant_name.rb +1 -1
  61. data/lib/rubocop/cop/naming/memoized_instance_variable_name.rb +25 -10
  62. data/lib/rubocop/cop/naming/rescued_exceptions_variable_name.rb +11 -3
  63. data/lib/rubocop/cop/naming/variable_name.rb +6 -1
  64. data/lib/rubocop/cop/style/accessor_grouping.rb +5 -1
  65. data/lib/rubocop/cop/style/attr.rb +11 -1
  66. data/lib/rubocop/cop/style/begin_block.rb +1 -2
  67. data/lib/rubocop/cop/style/block_comments.rb +1 -1
  68. data/lib/rubocop/cop/style/block_delimiters.rb +3 -3
  69. data/lib/rubocop/cop/style/class_and_module_children.rb +1 -1
  70. data/lib/rubocop/cop/style/class_equality_comparison.rb +17 -39
  71. data/lib/rubocop/cop/style/collection_compact.rb +16 -6
  72. data/lib/rubocop/cop/style/colon_method_call.rb +2 -2
  73. data/lib/rubocop/cop/style/combinable_loops.rb +26 -6
  74. data/lib/rubocop/cop/style/conditional_assignment.rb +5 -3
  75. data/lib/rubocop/cop/style/copyright.rb +5 -2
  76. data/lib/rubocop/cop/style/dir.rb +1 -1
  77. data/lib/rubocop/cop/style/dir_empty.rb +8 -14
  78. data/lib/rubocop/cop/style/document_dynamic_eval_definition.rb +1 -1
  79. data/lib/rubocop/cop/style/documentation.rb +1 -1
  80. data/lib/rubocop/cop/style/eval_with_location.rb +5 -5
  81. data/lib/rubocop/cop/style/exact_regexp_match.rb +68 -0
  82. data/lib/rubocop/cop/style/file_read.rb +2 -2
  83. data/lib/rubocop/cop/style/guard_clause.rb +2 -0
  84. data/lib/rubocop/cop/style/hash_each_methods.rb +1 -22
  85. data/lib/rubocop/cop/style/hash_except.rb +19 -8
  86. data/lib/rubocop/cop/style/hash_transform_keys.rb +2 -2
  87. data/lib/rubocop/cop/style/hash_transform_values.rb +2 -2
  88. data/lib/rubocop/cop/style/identical_conditional_branches.rb +6 -2
  89. data/lib/rubocop/cop/style/if_inside_else.rb +6 -0
  90. data/lib/rubocop/cop/style/if_unless_modifier.rb +3 -0
  91. data/lib/rubocop/cop/style/invertible_unless_condition.rb +10 -6
  92. data/lib/rubocop/cop/style/method_call_with_args_parentheses/omit_parentheses.rb +3 -4
  93. data/lib/rubocop/cop/style/multiple_comparison.rb +14 -0
  94. data/lib/rubocop/cop/style/numeric_literals.rb +1 -1
  95. data/lib/rubocop/cop/style/percent_literal_delimiters.rb +1 -1
  96. data/lib/rubocop/cop/style/preferred_hash_methods.rb +1 -1
  97. data/lib/rubocop/cop/style/redundant_array_constructor.rb +77 -0
  98. data/lib/rubocop/cop/style/redundant_begin.rb +1 -1
  99. data/lib/rubocop/cop/style/redundant_conditional.rb +1 -1
  100. data/lib/rubocop/cop/style/redundant_current_directory_in_path.rb +38 -0
  101. data/lib/rubocop/cop/style/redundant_filter_chain.rb +101 -0
  102. data/lib/rubocop/cop/style/redundant_line_continuation.rb +7 -3
  103. data/lib/rubocop/cop/style/redundant_parentheses.rb +1 -1
  104. data/lib/rubocop/cop/style/redundant_regexp_argument.rb +86 -0
  105. data/lib/rubocop/cop/style/redundant_regexp_constructor.rb +46 -0
  106. data/lib/rubocop/cop/style/redundant_regexp_escape.rb +2 -1
  107. data/lib/rubocop/cop/style/redundant_self_assignment_branch.rb +3 -1
  108. data/lib/rubocop/cop/style/redundant_sort.rb +1 -1
  109. data/lib/rubocop/cop/style/redundant_string_escape.rb +2 -0
  110. data/lib/rubocop/cop/style/regexp_literal.rb +11 -2
  111. data/lib/rubocop/cop/style/require_order.rb +11 -5
  112. data/lib/rubocop/cop/style/rescue_modifier.rb +1 -3
  113. data/lib/rubocop/cop/style/return_nil_in_predicate_method_definition.rb +81 -0
  114. data/lib/rubocop/cop/style/select_by_regexp.rb +15 -5
  115. data/lib/rubocop/cop/style/semicolon.rb +12 -1
  116. data/lib/rubocop/cop/style/signal_exception.rb +1 -1
  117. data/lib/rubocop/cop/style/single_line_methods.rb +1 -1
  118. data/lib/rubocop/cop/style/sole_nested_conditional.rb +3 -1
  119. data/lib/rubocop/cop/style/special_global_vars.rb +3 -4
  120. data/lib/rubocop/cop/style/yaml_file_read.rb +66 -0
  121. data/lib/rubocop/cop/team.rb +1 -1
  122. data/lib/rubocop/cop/util.rb +1 -1
  123. data/lib/rubocop/cop/utils/regexp_ranges.rb +100 -0
  124. data/lib/rubocop/cop/variable_force/assignment.rb +33 -1
  125. data/lib/rubocop/cop/variable_force/variable_table.rb +2 -2
  126. data/lib/rubocop/cop/variable_force.rb +1 -0
  127. data/lib/rubocop/cops_documentation_generator.rb +1 -1
  128. data/lib/rubocop/ext/regexp_parser.rb +4 -1
  129. data/lib/rubocop/lsp/logger.rb +22 -0
  130. data/lib/rubocop/lsp/routes.rb +223 -0
  131. data/lib/rubocop/lsp/runtime.rb +79 -0
  132. data/lib/rubocop/lsp/server.rb +62 -0
  133. data/lib/rubocop/lsp/severity.rb +27 -0
  134. data/lib/rubocop/options.rb +11 -1
  135. data/lib/rubocop/result_cache.rb +1 -1
  136. data/lib/rubocop/rspec/cop_helper.rb +1 -1
  137. data/lib/rubocop/server/client_command/exec.rb +2 -1
  138. data/lib/rubocop/target_ruby.rb +3 -2
  139. data/lib/rubocop/version.rb +10 -6
  140. data/lib/rubocop.rb +13 -0
  141. metadata +38 -6
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.50.2
4
+ version: 1.53.0
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-04-17 00:00:00.000000000 Z
13
+ date: 2023-06-23 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: json
@@ -26,6 +26,20 @@ dependencies:
26
26
  - - "~>"
27
27
  - !ruby/object:Gem::Version
28
28
  version: '2.3'
29
+ - !ruby/object:Gem::Dependency
30
+ name: language_server-protocol
31
+ requirement: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - ">="
34
+ - !ruby/object:Gem::Version
35
+ version: 3.17.0
36
+ type: :runtime
37
+ prerelease: false
38
+ version_requirements: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: 3.17.0
29
43
  - !ruby/object:Gem::Dependency
30
44
  name: parallel
31
45
  requirement: !ruby/object:Gem::Requirement
@@ -46,14 +60,14 @@ dependencies:
46
60
  requirements:
47
61
  - - ">="
48
62
  - !ruby/object:Gem::Version
49
- version: 3.2.0.0
63
+ version: 3.2.2.3
50
64
  type: :runtime
51
65
  prerelease: false
52
66
  version_requirements: !ruby/object:Gem::Requirement
53
67
  requirements:
54
68
  - - ">="
55
69
  - !ruby/object:Gem::Version
56
- version: 3.2.0.0
70
+ version: 3.2.2.3
57
71
  - !ruby/object:Gem::Dependency
58
72
  name: rainbow
59
73
  requirement: !ruby/object:Gem::Requirement
@@ -198,6 +212,7 @@ files:
198
212
  - lib/rubocop/cli/command/base.rb
199
213
  - lib/rubocop/cli/command/execute_runner.rb
200
214
  - lib/rubocop/cli/command/init_dotfile.rb
215
+ - lib/rubocop/cli/command/lsp.rb
201
216
  - lib/rubocop/cli/command/show_cops.rb
202
217
  - lib/rubocop/cli/command/show_docs_url.rb
203
218
  - lib/rubocop/cli/command/suggest_extensions.rb
@@ -456,6 +471,7 @@ files:
456
471
  - lib/rubocop/cop/lint/loop.rb
457
472
  - lib/rubocop/cop/lint/missing_cop_enable_directive.rb
458
473
  - lib/rubocop/cop/lint/missing_super.rb
474
+ - lib/rubocop/cop/lint/mixed_case_range.rb
459
475
  - lib/rubocop/cop/lint/mixed_regexp_capture_types.rb
460
476
  - lib/rubocop/cop/lint/multiple_comparison.rb
461
477
  - lib/rubocop/cop/lint/nested_method_definition.rb
@@ -478,6 +494,7 @@ files:
478
494
  - lib/rubocop/cop/lint/redundant_cop_disable_directive.rb
479
495
  - lib/rubocop/cop/lint/redundant_cop_enable_directive.rb
480
496
  - lib/rubocop/cop/lint/redundant_dir_glob_sort.rb
497
+ - lib/rubocop/cop/lint/redundant_regexp_quantifiers.rb
481
498
  - lib/rubocop/cop/lint/redundant_require_statement.rb
482
499
  - lib/rubocop/cop/lint/redundant_safe_navigation.rb
483
500
  - lib/rubocop/cop/lint/redundant_splat_expansion.rb
@@ -550,6 +567,7 @@ files:
550
567
  - lib/rubocop/cop/mixin/allowed_identifiers.rb
551
568
  - lib/rubocop/cop/mixin/allowed_methods.rb
552
569
  - lib/rubocop/cop/mixin/allowed_pattern.rb
570
+ - lib/rubocop/cop/mixin/allowed_receivers.rb
553
571
  - lib/rubocop/cop/mixin/annotation_comment.rb
554
572
  - lib/rubocop/cop/mixin/array_min_size.rb
555
573
  - lib/rubocop/cop/mixin/array_syntax.rb
@@ -710,6 +728,7 @@ files:
710
728
  - lib/rubocop/cop/style/env_home.rb
711
729
  - lib/rubocop/cop/style/eval_with_location.rb
712
730
  - lib/rubocop/cop/style/even_odd.rb
731
+ - lib/rubocop/cop/style/exact_regexp_match.rb
713
732
  - lib/rubocop/cop/style/expand_path_arguments.rb
714
733
  - lib/rubocop/cop/style/explicit_block_argument.rb
715
734
  - lib/rubocop/cop/style/exponential_notation.rb
@@ -814,17 +833,20 @@ files:
814
833
  - lib/rubocop/cop/style/raise_args.rb
815
834
  - lib/rubocop/cop/style/random_with_offset.rb
816
835
  - lib/rubocop/cop/style/redundant_argument.rb
836
+ - lib/rubocop/cop/style/redundant_array_constructor.rb
817
837
  - lib/rubocop/cop/style/redundant_assignment.rb
818
838
  - lib/rubocop/cop/style/redundant_begin.rb
819
839
  - lib/rubocop/cop/style/redundant_capital_w.rb
820
840
  - lib/rubocop/cop/style/redundant_condition.rb
821
841
  - lib/rubocop/cop/style/redundant_conditional.rb
822
842
  - lib/rubocop/cop/style/redundant_constant_base.rb
843
+ - lib/rubocop/cop/style/redundant_current_directory_in_path.rb
823
844
  - lib/rubocop/cop/style/redundant_double_splat_hash_braces.rb
824
845
  - lib/rubocop/cop/style/redundant_each.rb
825
846
  - lib/rubocop/cop/style/redundant_exception.rb
826
847
  - lib/rubocop/cop/style/redundant_fetch_block.rb
827
848
  - lib/rubocop/cop/style/redundant_file_extension_in_require.rb
849
+ - lib/rubocop/cop/style/redundant_filter_chain.rb
828
850
  - lib/rubocop/cop/style/redundant_freeze.rb
829
851
  - lib/rubocop/cop/style/redundant_heredoc_delimiter_quotes.rb
830
852
  - lib/rubocop/cop/style/redundant_initialize.rb
@@ -832,7 +854,9 @@ files:
832
854
  - lib/rubocop/cop/style/redundant_line_continuation.rb
833
855
  - lib/rubocop/cop/style/redundant_parentheses.rb
834
856
  - lib/rubocop/cop/style/redundant_percent_q.rb
857
+ - lib/rubocop/cop/style/redundant_regexp_argument.rb
835
858
  - lib/rubocop/cop/style/redundant_regexp_character_class.rb
859
+ - lib/rubocop/cop/style/redundant_regexp_constructor.rb
836
860
  - lib/rubocop/cop/style/redundant_regexp_escape.rb
837
861
  - lib/rubocop/cop/style/redundant_return.rb
838
862
  - lib/rubocop/cop/style/redundant_self.rb
@@ -846,6 +870,7 @@ files:
846
870
  - lib/rubocop/cop/style/rescue_modifier.rb
847
871
  - lib/rubocop/cop/style/rescue_standard_error.rb
848
872
  - lib/rubocop/cop/style/return_nil.rb
873
+ - lib/rubocop/cop/style/return_nil_in_predicate_method_definition.rb
849
874
  - lib/rubocop/cop/style/safe_navigation.rb
850
875
  - lib/rubocop/cop/style/sample.rb
851
876
  - lib/rubocop/cop/style/select_by_regexp.rb
@@ -894,12 +919,14 @@ files:
894
919
  - lib/rubocop/cop/style/while_until_do.rb
895
920
  - lib/rubocop/cop/style/while_until_modifier.rb
896
921
  - lib/rubocop/cop/style/word_array.rb
922
+ - lib/rubocop/cop/style/yaml_file_read.rb
897
923
  - lib/rubocop/cop/style/yoda_condition.rb
898
924
  - lib/rubocop/cop/style/yoda_expression.rb
899
925
  - lib/rubocop/cop/style/zero_length_predicate.rb
900
926
  - lib/rubocop/cop/team.rb
901
927
  - lib/rubocop/cop/util.rb
902
928
  - lib/rubocop/cop/utils/format_string.rb
929
+ - lib/rubocop/cop/utils/regexp_ranges.rb
903
930
  - lib/rubocop/cop/variable_force.rb
904
931
  - lib/rubocop/cop/variable_force/assignment.rb
905
932
  - lib/rubocop/cop/variable_force/branch.rb
@@ -944,6 +971,11 @@ files:
944
971
  - lib/rubocop/formatter/text_util.rb
945
972
  - lib/rubocop/formatter/worst_offenders_formatter.rb
946
973
  - lib/rubocop/lockfile.rb
974
+ - lib/rubocop/lsp/logger.rb
975
+ - lib/rubocop/lsp/routes.rb
976
+ - lib/rubocop/lsp/runtime.rb
977
+ - lib/rubocop/lsp/server.rb
978
+ - lib/rubocop/lsp/severity.rb
947
979
  - lib/rubocop/magic_comment.rb
948
980
  - lib/rubocop/name_similarity.rb
949
981
  - lib/rubocop/options.rb
@@ -991,7 +1023,7 @@ metadata:
991
1023
  homepage_uri: https://rubocop.org/
992
1024
  changelog_uri: https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md
993
1025
  source_code_uri: https://github.com/rubocop/rubocop/
994
- documentation_uri: https://docs.rubocop.org/rubocop/1.50/
1026
+ documentation_uri: https://docs.rubocop.org/rubocop/1.53/
995
1027
  bug_tracker_uri: https://github.com/rubocop/rubocop/issues
996
1028
  rubygems_mfa_required: 'true'
997
1029
  post_install_message:
@@ -1002,7 +1034,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
1002
1034
  requirements:
1003
1035
  - - ">="
1004
1036
  - !ruby/object:Gem::Version
1005
- version: 2.6.0
1037
+ version: 2.7.0
1006
1038
  required_rubygems_version: !ruby/object:Gem::Requirement
1007
1039
  requirements:
1008
1040
  - - ">="