rubocop 1.51.0 → 1.54.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (120) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/config/default.yml +62 -3
  4. data/lib/rubocop/cli/command/lsp.rb +19 -0
  5. data/lib/rubocop/cli.rb +3 -0
  6. data/lib/rubocop/config_loader_resolver.rb +4 -3
  7. data/lib/rubocop/cop/base.rb +1 -1
  8. data/lib/rubocop/cop/bundler/gem_comment.rb +1 -1
  9. data/lib/rubocop/cop/bundler/gem_version.rb +2 -2
  10. data/lib/rubocop/cop/gemspec/dependency_version.rb +2 -2
  11. data/lib/rubocop/cop/internal_affairs/cop_description.rb +32 -8
  12. data/lib/rubocop/cop/internal_affairs/location_line_equality_comparison.rb +3 -1
  13. data/lib/rubocop/cop/internal_affairs/node_matcher_directive.rb +3 -3
  14. data/lib/rubocop/cop/layout/class_structure.rb +7 -0
  15. data/lib/rubocop/cop/layout/closing_heredoc_indentation.rb +1 -2
  16. data/lib/rubocop/cop/layout/empty_line_between_defs.rb +27 -4
  17. data/lib/rubocop/cop/layout/empty_lines_around_exception_handling_keywords.rb +2 -0
  18. data/lib/rubocop/cop/layout/indentation_style.rb +1 -1
  19. data/lib/rubocop/cop/layout/indentation_width.rb +2 -2
  20. data/lib/rubocop/cop/layout/line_end_string_concatenation_indentation.rb +2 -0
  21. data/lib/rubocop/cop/layout/redundant_line_break.rb +1 -1
  22. data/lib/rubocop/cop/layout/space_after_comma.rb +9 -1
  23. data/lib/rubocop/cop/layout/space_around_operators.rb +3 -1
  24. data/lib/rubocop/cop/layout/space_inside_range_literal.rb +1 -1
  25. data/lib/rubocop/cop/lint/ambiguous_block_association.rb +2 -1
  26. data/lib/rubocop/cop/lint/debugger.rb +9 -5
  27. data/lib/rubocop/cop/lint/duplicate_hash_key.rb +2 -1
  28. data/lib/rubocop/cop/lint/duplicate_regexp_character_class_element.rb +46 -19
  29. data/lib/rubocop/cop/lint/erb_new_arguments.rb +1 -2
  30. data/lib/rubocop/cop/lint/heredoc_method_call_position.rb +1 -1
  31. data/lib/rubocop/cop/lint/identity_comparison.rb +0 -1
  32. data/lib/rubocop/cop/lint/incompatible_io_select_with_fiber_scheduler.rb +1 -2
  33. data/lib/rubocop/cop/lint/inherit_exception.rb +9 -0
  34. data/lib/rubocop/cop/lint/missing_super.rb +34 -5
  35. data/lib/rubocop/cop/lint/mixed_case_range.rb +111 -0
  36. data/lib/rubocop/cop/lint/number_conversion.rb +5 -0
  37. data/lib/rubocop/cop/lint/ordered_magic_comments.rb +0 -1
  38. data/lib/rubocop/cop/lint/redundant_regexp_quantifiers.rb +130 -0
  39. data/lib/rubocop/cop/lint/redundant_require_statement.rb +8 -3
  40. data/lib/rubocop/cop/lint/send_with_mixin_argument.rb +1 -2
  41. data/lib/rubocop/cop/lint/shadowed_exception.rb +5 -11
  42. data/lib/rubocop/cop/lint/suppressed_exception.rb +1 -1
  43. data/lib/rubocop/cop/lint/symbol_conversion.rb +1 -1
  44. data/lib/rubocop/cop/lint/useless_assignment.rb +4 -1
  45. data/lib/rubocop/cop/lint/void.rb +12 -18
  46. data/lib/rubocop/cop/metrics/utils/abc_size_calculator.rb +1 -2
  47. data/lib/rubocop/cop/metrics/utils/code_length_calculator.rb +30 -2
  48. data/lib/rubocop/cop/migration/department_name.rb +2 -2
  49. data/lib/rubocop/cop/mixin/allowed_receivers.rb +34 -0
  50. data/lib/rubocop/cop/mixin/comments_help.rb +1 -1
  51. data/lib/rubocop/cop/mixin/end_keyword_alignment.rb +1 -1
  52. data/lib/rubocop/cop/mixin/heredoc.rb +6 -2
  53. data/lib/rubocop/cop/mixin/percent_literal.rb +1 -1
  54. data/lib/rubocop/cop/naming/block_forwarding.rb +1 -1
  55. data/lib/rubocop/cop/naming/memoized_instance_variable_name.rb +3 -3
  56. data/lib/rubocop/cop/naming/variable_name.rb +6 -1
  57. data/lib/rubocop/cop/style/accessor_grouping.rb +5 -1
  58. data/lib/rubocop/cop/style/begin_block.rb +1 -2
  59. data/lib/rubocop/cop/style/block_comments.rb +1 -1
  60. data/lib/rubocop/cop/style/block_delimiters.rb +3 -3
  61. data/lib/rubocop/cop/style/class_and_module_children.rb +1 -1
  62. data/lib/rubocop/cop/style/class_equality_comparison.rb +17 -39
  63. data/lib/rubocop/cop/style/collection_compact.rb +6 -0
  64. data/lib/rubocop/cop/style/conditional_assignment.rb +3 -1
  65. data/lib/rubocop/cop/style/dir.rb +1 -1
  66. data/lib/rubocop/cop/style/dir_empty.rb +8 -14
  67. data/lib/rubocop/cop/style/document_dynamic_eval_definition.rb +1 -1
  68. data/lib/rubocop/cop/style/eval_with_location.rb +4 -4
  69. data/lib/rubocop/cop/style/exact_regexp_match.rb +8 -2
  70. data/lib/rubocop/cop/style/file_read.rb +2 -2
  71. data/lib/rubocop/cop/style/hash_each_methods.rb +1 -22
  72. data/lib/rubocop/cop/style/hash_transform_keys.rb +2 -2
  73. data/lib/rubocop/cop/style/hash_transform_values.rb +2 -2
  74. data/lib/rubocop/cop/style/identical_conditional_branches.rb +6 -2
  75. data/lib/rubocop/cop/style/if_with_semicolon.rb +2 -2
  76. data/lib/rubocop/cop/style/invertible_unless_condition.rb +1 -1
  77. data/lib/rubocop/cop/style/lambda.rb +3 -3
  78. data/lib/rubocop/cop/style/method_call_with_args_parentheses/omit_parentheses.rb +3 -4
  79. data/lib/rubocop/cop/style/multiple_comparison.rb +14 -0
  80. data/lib/rubocop/cop/style/numeric_literals.rb +1 -1
  81. data/lib/rubocop/cop/style/preferred_hash_methods.rb +1 -1
  82. data/lib/rubocop/cop/style/redundant_array_constructor.rb +77 -0
  83. data/lib/rubocop/cop/style/redundant_begin.rb +1 -1
  84. data/lib/rubocop/cop/style/redundant_conditional.rb +1 -1
  85. data/lib/rubocop/cop/style/redundant_current_directory_in_path.rb +38 -0
  86. data/lib/rubocop/cop/style/redundant_filter_chain.rb +101 -0
  87. data/lib/rubocop/cop/style/redundant_line_continuation.rb +2 -2
  88. data/lib/rubocop/cop/style/redundant_parentheses.rb +1 -1
  89. data/lib/rubocop/cop/style/redundant_regexp_argument.rb +100 -0
  90. data/lib/rubocop/cop/style/redundant_regexp_constructor.rb +46 -0
  91. data/lib/rubocop/cop/style/redundant_regexp_escape.rb +2 -1
  92. data/lib/rubocop/cop/style/redundant_self_assignment_branch.rb +3 -1
  93. data/lib/rubocop/cop/style/redundant_sort.rb +1 -1
  94. data/lib/rubocop/cop/style/redundant_string_escape.rb +2 -0
  95. data/lib/rubocop/cop/style/require_order.rb +2 -1
  96. data/lib/rubocop/cop/style/rescue_modifier.rb +1 -3
  97. data/lib/rubocop/cop/style/return_nil_in_predicate_method_definition.rb +81 -0
  98. data/lib/rubocop/cop/style/select_by_regexp.rb +15 -5
  99. data/lib/rubocop/cop/style/signal_exception.rb +1 -1
  100. data/lib/rubocop/cop/style/single_line_methods.rb +1 -1
  101. data/lib/rubocop/cop/style/sole_nested_conditional.rb +3 -1
  102. data/lib/rubocop/cop/style/special_global_vars.rb +1 -2
  103. data/lib/rubocop/cop/style/yaml_file_read.rb +66 -0
  104. data/lib/rubocop/cop/style/yoda_condition.rb +4 -2
  105. data/lib/rubocop/cop/util.rb +1 -1
  106. data/lib/rubocop/cop/utils/regexp_ranges.rb +100 -0
  107. data/lib/rubocop/cop/variable_force/assignment.rb +43 -4
  108. data/lib/rubocop/cop/variable_force.rb +1 -0
  109. data/lib/rubocop/cops_documentation_generator.rb +1 -1
  110. data/lib/rubocop/ext/regexp_parser.rb +4 -1
  111. data/lib/rubocop/lsp/logger.rb +22 -0
  112. data/lib/rubocop/lsp/routes.rb +231 -0
  113. data/lib/rubocop/lsp/runtime.rb +82 -0
  114. data/lib/rubocop/lsp/server.rb +66 -0
  115. data/lib/rubocop/lsp/severity.rb +27 -0
  116. data/lib/rubocop/options.rb +11 -1
  117. data/lib/rubocop/server/client_command/exec.rb +2 -1
  118. data/lib/rubocop/version.rb +8 -4
  119. data/lib/rubocop.rb +12 -0
  120. metadata +36 -5
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.51.0
4
+ version: 1.54.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-05-13 00:00:00.000000000 Z
13
+ date: 2023-07-04 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
@@ -815,17 +833,20 @@ files:
815
833
  - lib/rubocop/cop/style/raise_args.rb
816
834
  - lib/rubocop/cop/style/random_with_offset.rb
817
835
  - lib/rubocop/cop/style/redundant_argument.rb
836
+ - lib/rubocop/cop/style/redundant_array_constructor.rb
818
837
  - lib/rubocop/cop/style/redundant_assignment.rb
819
838
  - lib/rubocop/cop/style/redundant_begin.rb
820
839
  - lib/rubocop/cop/style/redundant_capital_w.rb
821
840
  - lib/rubocop/cop/style/redundant_condition.rb
822
841
  - lib/rubocop/cop/style/redundant_conditional.rb
823
842
  - lib/rubocop/cop/style/redundant_constant_base.rb
843
+ - lib/rubocop/cop/style/redundant_current_directory_in_path.rb
824
844
  - lib/rubocop/cop/style/redundant_double_splat_hash_braces.rb
825
845
  - lib/rubocop/cop/style/redundant_each.rb
826
846
  - lib/rubocop/cop/style/redundant_exception.rb
827
847
  - lib/rubocop/cop/style/redundant_fetch_block.rb
828
848
  - lib/rubocop/cop/style/redundant_file_extension_in_require.rb
849
+ - lib/rubocop/cop/style/redundant_filter_chain.rb
829
850
  - lib/rubocop/cop/style/redundant_freeze.rb
830
851
  - lib/rubocop/cop/style/redundant_heredoc_delimiter_quotes.rb
831
852
  - lib/rubocop/cop/style/redundant_initialize.rb
@@ -833,7 +854,9 @@ files:
833
854
  - lib/rubocop/cop/style/redundant_line_continuation.rb
834
855
  - lib/rubocop/cop/style/redundant_parentheses.rb
835
856
  - lib/rubocop/cop/style/redundant_percent_q.rb
857
+ - lib/rubocop/cop/style/redundant_regexp_argument.rb
836
858
  - lib/rubocop/cop/style/redundant_regexp_character_class.rb
859
+ - lib/rubocop/cop/style/redundant_regexp_constructor.rb
837
860
  - lib/rubocop/cop/style/redundant_regexp_escape.rb
838
861
  - lib/rubocop/cop/style/redundant_return.rb
839
862
  - lib/rubocop/cop/style/redundant_self.rb
@@ -847,6 +870,7 @@ files:
847
870
  - lib/rubocop/cop/style/rescue_modifier.rb
848
871
  - lib/rubocop/cop/style/rescue_standard_error.rb
849
872
  - lib/rubocop/cop/style/return_nil.rb
873
+ - lib/rubocop/cop/style/return_nil_in_predicate_method_definition.rb
850
874
  - lib/rubocop/cop/style/safe_navigation.rb
851
875
  - lib/rubocop/cop/style/sample.rb
852
876
  - lib/rubocop/cop/style/select_by_regexp.rb
@@ -895,12 +919,14 @@ files:
895
919
  - lib/rubocop/cop/style/while_until_do.rb
896
920
  - lib/rubocop/cop/style/while_until_modifier.rb
897
921
  - lib/rubocop/cop/style/word_array.rb
922
+ - lib/rubocop/cop/style/yaml_file_read.rb
898
923
  - lib/rubocop/cop/style/yoda_condition.rb
899
924
  - lib/rubocop/cop/style/yoda_expression.rb
900
925
  - lib/rubocop/cop/style/zero_length_predicate.rb
901
926
  - lib/rubocop/cop/team.rb
902
927
  - lib/rubocop/cop/util.rb
903
928
  - lib/rubocop/cop/utils/format_string.rb
929
+ - lib/rubocop/cop/utils/regexp_ranges.rb
904
930
  - lib/rubocop/cop/variable_force.rb
905
931
  - lib/rubocop/cop/variable_force/assignment.rb
906
932
  - lib/rubocop/cop/variable_force/branch.rb
@@ -945,6 +971,11 @@ files:
945
971
  - lib/rubocop/formatter/text_util.rb
946
972
  - lib/rubocop/formatter/worst_offenders_formatter.rb
947
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
948
979
  - lib/rubocop/magic_comment.rb
949
980
  - lib/rubocop/name_similarity.rb
950
981
  - lib/rubocop/options.rb
@@ -992,7 +1023,7 @@ metadata:
992
1023
  homepage_uri: https://rubocop.org/
993
1024
  changelog_uri: https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md
994
1025
  source_code_uri: https://github.com/rubocop/rubocop/
995
- documentation_uri: https://docs.rubocop.org/rubocop/1.51/
1026
+ documentation_uri: https://docs.rubocop.org/rubocop/1.54/
996
1027
  bug_tracker_uri: https://github.com/rubocop/rubocop/issues
997
1028
  rubygems_mfa_required: 'true'
998
1029
  post_install_message: