rubocop 1.22.3 → 1.26.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (131) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.txt +1 -1
  3. data/README.md +2 -3
  4. data/config/default.yml +110 -19
  5. data/lib/rubocop/cli/command/auto_genenerate_config.rb +1 -1
  6. data/lib/rubocop/cli/command/init_dotfile.rb +1 -1
  7. data/lib/rubocop/cli/command/show_docs_url.rb +48 -0
  8. data/lib/rubocop/cli/command/suggest_extensions.rb +1 -1
  9. data/lib/rubocop/cli.rb +2 -1
  10. data/lib/rubocop/config_loader_resolver.rb +1 -1
  11. data/lib/rubocop/cop/badge.rb +7 -1
  12. data/lib/rubocop/cop/bundler/duplicated_gem.rb +1 -1
  13. data/lib/rubocop/cop/correctors/each_to_for_corrector.rb +1 -1
  14. data/lib/rubocop/cop/correctors/if_then_corrector.rb +55 -0
  15. data/lib/rubocop/cop/documentation.rb +19 -2
  16. data/lib/rubocop/cop/gemspec/date_assignment.rb +2 -10
  17. data/lib/rubocop/cop/gemspec/duplicated_assignment.rb +1 -10
  18. data/lib/rubocop/cop/gemspec/require_mfa.rb +145 -0
  19. data/lib/rubocop/cop/gemspec/required_ruby_version.rb +10 -3
  20. data/lib/rubocop/cop/gemspec/ruby_version_globals_usage.rb +3 -10
  21. data/lib/rubocop/cop/generator.rb +7 -11
  22. data/lib/rubocop/cop/internal_affairs/redundant_context_config_parameter.rb +46 -0
  23. data/lib/rubocop/cop/internal_affairs/redundant_method_dispatch_node.rb +47 -0
  24. data/lib/rubocop/cop/internal_affairs/undefined_config.rb +3 -1
  25. data/lib/rubocop/cop/internal_affairs.rb +2 -0
  26. data/lib/rubocop/cop/layout/argument_alignment.rb +36 -9
  27. data/lib/rubocop/cop/layout/case_indentation.rb +1 -1
  28. data/lib/rubocop/cop/layout/comment_indentation.rb +31 -2
  29. data/lib/rubocop/cop/layout/dot_position.rb +4 -0
  30. data/lib/rubocop/cop/layout/empty_line_between_defs.rb +22 -1
  31. data/lib/rubocop/cop/layout/empty_lines_around_exception_handling_keywords.rb +5 -1
  32. data/lib/rubocop/cop/layout/hash_alignment.rb +7 -2
  33. data/lib/rubocop/cop/layout/multiline_operation_indentation.rb +7 -8
  34. data/lib/rubocop/cop/layout/rescue_ensure_alignment.rb +1 -1
  35. data/lib/rubocop/cop/layout/space_after_colon.rb +1 -1
  36. data/lib/rubocop/cop/layout/space_before_first_arg.rb +4 -0
  37. data/lib/rubocop/cop/layout/space_in_lambda_literal.rb +11 -5
  38. data/lib/rubocop/cop/lint/ambiguous_range.rb +2 -2
  39. data/lib/rubocop/cop/lint/ambiguous_regexp_literal.rb +5 -1
  40. data/lib/rubocop/cop/lint/constant_definition_in_block.rb +1 -1
  41. data/lib/rubocop/cop/lint/deprecated_class_methods.rb +16 -4
  42. data/lib/rubocop/cop/lint/deprecated_open_ssl_constant.rb +6 -0
  43. data/lib/rubocop/cop/lint/each_with_object_argument.rb +1 -1
  44. data/lib/rubocop/cop/lint/incompatible_io_select_with_fiber_scheduler.rb +10 -5
  45. data/lib/rubocop/cop/lint/inherit_exception.rb +19 -28
  46. data/lib/rubocop/cop/lint/number_conversion.rb +5 -2
  47. data/lib/rubocop/cop/lint/parentheses_as_grouped_expression.rb +10 -6
  48. data/lib/rubocop/cop/lint/redundant_dir_glob_sort.rb +5 -0
  49. data/lib/rubocop/cop/lint/symbol_conversion.rb +3 -2
  50. data/lib/rubocop/cop/lint/useless_ruby2_keywords.rb +117 -0
  51. data/lib/rubocop/cop/lint/useless_times.rb +13 -9
  52. data/lib/rubocop/cop/metrics/block_length.rb +1 -0
  53. data/lib/rubocop/cop/metrics/cyclomatic_complexity.rb +0 -9
  54. data/lib/rubocop/cop/metrics/method_length.rb +1 -0
  55. data/lib/rubocop/cop/metrics/module_length.rb +1 -1
  56. data/lib/rubocop/cop/metrics/parameter_lists.rb +1 -1
  57. data/lib/rubocop/cop/metrics/utils/code_length_calculator.rb +1 -1
  58. data/lib/rubocop/cop/metrics/utils/repeated_attribute_discount.rb +1 -1
  59. data/lib/rubocop/cop/mixin/enforce_superclass.rb +5 -0
  60. data/lib/rubocop/cop/mixin/gemspec_help.rb +30 -0
  61. data/lib/rubocop/cop/mixin/hash_alignment_styles.rb +4 -3
  62. data/lib/rubocop/cop/mixin/hash_shorthand_syntax.rb +82 -0
  63. data/lib/rubocop/cop/mixin/line_length_help.rb +17 -6
  64. data/lib/rubocop/cop/mixin/multiline_expression_indentation.rb +3 -1
  65. data/lib/rubocop/cop/mixin/string_literals_help.rb +1 -5
  66. data/lib/rubocop/cop/naming/block_forwarding.rb +121 -0
  67. data/lib/rubocop/cop/naming/file_name.rb +37 -4
  68. data/lib/rubocop/cop/naming/method_parameter_name.rb +1 -1
  69. data/lib/rubocop/cop/security/open.rb +11 -1
  70. data/lib/rubocop/cop/security/yaml_load.rb +9 -3
  71. data/lib/rubocop/cop/style/character_literal.rb +8 -1
  72. data/lib/rubocop/cop/style/collection_compact.rb +31 -13
  73. data/lib/rubocop/cop/style/combinable_loops.rb +2 -2
  74. data/lib/rubocop/cop/style/def_with_parentheses.rb +16 -11
  75. data/lib/rubocop/cop/style/documentation.rb +1 -1
  76. data/lib/rubocop/cop/style/empty_case_condition.rb +10 -0
  77. data/lib/rubocop/cop/style/empty_method.rb +1 -1
  78. data/lib/rubocop/cop/style/file_read.rb +112 -0
  79. data/lib/rubocop/cop/style/file_write.rb +124 -0
  80. data/lib/rubocop/cop/style/for.rb +4 -0
  81. data/lib/rubocop/cop/style/format_string_token.rb +2 -1
  82. data/lib/rubocop/cop/style/hash_conversion.rb +2 -1
  83. data/lib/rubocop/cop/style/hash_syntax.rb +36 -0
  84. data/lib/rubocop/cop/style/hash_transform_keys.rb +6 -6
  85. data/lib/rubocop/cop/style/hash_transform_values.rb +6 -6
  86. data/lib/rubocop/cop/style/if_inside_else.rb +15 -0
  87. data/lib/rubocop/cop/style/if_with_boolean_literal_branches.rb +1 -1
  88. data/lib/rubocop/cop/style/lambda_call.rb +12 -20
  89. data/lib/rubocop/cop/style/map_to_hash.rb +68 -0
  90. data/lib/rubocop/cop/style/method_call_with_args_parentheses/omit_parentheses.rb +20 -0
  91. data/lib/rubocop/cop/style/method_call_with_args_parentheses.rb +3 -1
  92. data/lib/rubocop/cop/style/method_def_parentheses.rb +17 -13
  93. data/lib/rubocop/cop/style/nested_file_dirname.rb +66 -0
  94. data/lib/rubocop/cop/style/numeric_literals.rb +10 -1
  95. data/lib/rubocop/cop/style/one_line_conditional.rb +18 -39
  96. data/lib/rubocop/cop/style/open_struct_use.rb +69 -0
  97. data/lib/rubocop/cop/style/optional_boolean_parameter.rb +3 -2
  98. data/lib/rubocop/cop/style/parentheses_around_condition.rb +12 -2
  99. data/lib/rubocop/cop/style/quoted_symbols.rb +11 -1
  100. data/lib/rubocop/cop/style/redundant_begin.rb +2 -6
  101. data/lib/rubocop/cop/style/redundant_interpolation.rb +17 -3
  102. data/lib/rubocop/cop/style/redundant_regexp_character_class.rb +5 -1
  103. data/lib/rubocop/cop/style/redundant_self.rb +1 -1
  104. data/lib/rubocop/cop/style/safe_navigation.rb +1 -5
  105. data/lib/rubocop/cop/style/sample.rb +5 -3
  106. data/lib/rubocop/cop/style/select_by_regexp.rb +6 -1
  107. data/lib/rubocop/cop/style/single_line_block_params.rb +2 -2
  108. data/lib/rubocop/cop/style/sole_nested_conditional.rb +53 -13
  109. data/lib/rubocop/cop/style/string_concatenation.rb +7 -1
  110. data/lib/rubocop/cop/style/swap_values.rb +2 -0
  111. data/lib/rubocop/cop/style/ternary_parentheses.rb +16 -2
  112. data/lib/rubocop/cop/style/trailing_comma_in_array_literal.rb +1 -1
  113. data/lib/rubocop/cop/style/trailing_comma_in_hash_literal.rb +1 -1
  114. data/lib/rubocop/cop/style/unless_else.rb +4 -0
  115. data/lib/rubocop/cop/team.rb +1 -1
  116. data/lib/rubocop/cop/util.rb +9 -1
  117. data/lib/rubocop/cop/variable_force.rb +1 -5
  118. data/lib/rubocop/cops_documentation_generator.rb +2 -2
  119. data/lib/rubocop/formatter/disabled_config_formatter.rb +16 -2
  120. data/lib/rubocop/formatter/html_formatter.rb +5 -2
  121. data/lib/rubocop/formatter/json_formatter.rb +4 -1
  122. data/lib/rubocop/options.rb +14 -3
  123. data/lib/rubocop/remote_config.rb +2 -4
  124. data/lib/rubocop/result_cache.rb +1 -1
  125. data/lib/rubocop/rspec/shared_contexts.rb +4 -0
  126. data/lib/rubocop/runner.rb +1 -1
  127. data/lib/rubocop/target_ruby.rb +1 -1
  128. data/lib/rubocop/version.rb +1 -1
  129. data/lib/rubocop/yaml_duplication_checker.rb +1 -1
  130. data/lib/rubocop.rb +12 -0
  131. metadata +22 -7
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.22.3
4
+ version: 1.26.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: 2021-10-27 00:00:00.000000000 Z
13
+ date: 2022-03-22 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: parallel
@@ -32,14 +32,14 @@ dependencies:
32
32
  requirements:
33
33
  - - ">="
34
34
  - !ruby/object:Gem::Version
35
- version: 3.0.0.0
35
+ version: 3.1.0.0
36
36
  type: :runtime
37
37
  prerelease: false
38
38
  version_requirements: !ruby/object:Gem::Requirement
39
39
  requirements:
40
40
  - - ">="
41
41
  - !ruby/object:Gem::Version
42
- version: 3.0.0.0
42
+ version: 3.1.0.0
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: rainbow
45
45
  requirement: !ruby/object:Gem::Requirement
@@ -100,7 +100,7 @@ dependencies:
100
100
  requirements:
101
101
  - - ">="
102
102
  - !ruby/object:Gem::Version
103
- version: 1.12.0
103
+ version: 1.16.0
104
104
  - - "<"
105
105
  - !ruby/object:Gem::Version
106
106
  version: '2.0'
@@ -110,7 +110,7 @@ dependencies:
110
110
  requirements:
111
111
  - - ">="
112
112
  - !ruby/object:Gem::Version
113
- version: 1.12.0
113
+ version: 1.16.0
114
114
  - - "<"
115
115
  - !ruby/object:Gem::Version
116
116
  version: '2.0'
@@ -196,6 +196,7 @@ files:
196
196
  - lib/rubocop/cli/command/execute_runner.rb
197
197
  - lib/rubocop/cli/command/init_dotfile.rb
198
198
  - lib/rubocop/cli/command/show_cops.rb
199
+ - lib/rubocop/cli/command/show_docs_url.rb
199
200
  - lib/rubocop/cli/command/suggest_extensions.rb
200
201
  - lib/rubocop/cli/command/version.rb
201
202
  - lib/rubocop/cli/environment.rb
@@ -233,6 +234,7 @@ files:
233
234
  - lib/rubocop/cop/correctors/each_to_for_corrector.rb
234
235
  - lib/rubocop/cop/correctors/empty_line_corrector.rb
235
236
  - lib/rubocop/cop/correctors/for_to_each_corrector.rb
237
+ - lib/rubocop/cop/correctors/if_then_corrector.rb
236
238
  - lib/rubocop/cop/correctors/lambda_literal_to_method_corrector.rb
237
239
  - lib/rubocop/cop/correctors/line_break_corrector.rb
238
240
  - lib/rubocop/cop/correctors/multiline_literal_brace_corrector.rb
@@ -250,6 +252,7 @@ files:
250
252
  - lib/rubocop/cop/gemspec/date_assignment.rb
251
253
  - lib/rubocop/cop/gemspec/duplicated_assignment.rb
252
254
  - lib/rubocop/cop/gemspec/ordered_dependencies.rb
255
+ - lib/rubocop/cop/gemspec/require_mfa.rb
253
256
  - lib/rubocop/cop/gemspec/required_ruby_version.rb
254
257
  - lib/rubocop/cop/gemspec/ruby_version_globals_usage.rb
255
258
  - lib/rubocop/cop/generator.rb
@@ -266,10 +269,12 @@ files:
266
269
  - lib/rubocop/cop/internal_affairs/node_matcher_directive.rb
267
270
  - lib/rubocop/cop/internal_affairs/node_type_predicate.rb
268
271
  - lib/rubocop/cop/internal_affairs/offense_location_keyword.rb
272
+ - lib/rubocop/cop/internal_affairs/redundant_context_config_parameter.rb
269
273
  - lib/rubocop/cop/internal_affairs/redundant_described_class_as_subject.rb
270
274
  - lib/rubocop/cop/internal_affairs/redundant_let_rubocop_config_new.rb
271
275
  - lib/rubocop/cop/internal_affairs/redundant_location_argument.rb
272
276
  - lib/rubocop/cop/internal_affairs/redundant_message_argument.rb
277
+ - lib/rubocop/cop/internal_affairs/redundant_method_dispatch_node.rb
273
278
  - lib/rubocop/cop/internal_affairs/style_detected_api_use.rb
274
279
  - lib/rubocop/cop/internal_affairs/undefined_config.rb
275
280
  - lib/rubocop/cop/internal_affairs/useless_message_assertion.rb
@@ -493,6 +498,7 @@ files:
493
498
  - lib/rubocop/cop/lint/useless_assignment.rb
494
499
  - lib/rubocop/cop/lint/useless_else_without_rescue.rb
495
500
  - lib/rubocop/cop/lint/useless_method_definition.rb
501
+ - lib/rubocop/cop/lint/useless_ruby2_keywords.rb
496
502
  - lib/rubocop/cop/lint/useless_setter_call.rb
497
503
  - lib/rubocop/cop/lint/useless_times.rb
498
504
  - lib/rubocop/cop/lint/void.rb
@@ -538,7 +544,9 @@ files:
538
544
  - lib/rubocop/cop/mixin/first_element_line_break.rb
539
545
  - lib/rubocop/cop/mixin/frozen_string_literal.rb
540
546
  - lib/rubocop/cop/mixin/gem_declaration.rb
547
+ - lib/rubocop/cop/mixin/gemspec_help.rb
541
548
  - lib/rubocop/cop/mixin/hash_alignment_styles.rb
549
+ - lib/rubocop/cop/mixin/hash_shorthand_syntax.rb
542
550
  - lib/rubocop/cop/mixin/hash_transform_method.rb
543
551
  - lib/rubocop/cop/mixin/heredoc.rb
544
552
  - lib/rubocop/cop/mixin/ignored_methods.rb
@@ -584,6 +592,7 @@ files:
584
592
  - lib/rubocop/cop/naming/accessor_method_name.rb
585
593
  - lib/rubocop/cop/naming/ascii_identifiers.rb
586
594
  - lib/rubocop/cop/naming/binary_operator_parameter_name.rb
595
+ - lib/rubocop/cop/naming/block_forwarding.rb
587
596
  - lib/rubocop/cop/naming/block_parameter_name.rb
588
597
  - lib/rubocop/cop/naming/class_and_module_camel_case.rb
589
598
  - lib/rubocop/cop/naming/constant_name.rb
@@ -668,6 +677,8 @@ files:
668
677
  - lib/rubocop/cop/style/expand_path_arguments.rb
669
678
  - lib/rubocop/cop/style/explicit_block_argument.rb
670
679
  - lib/rubocop/cop/style/exponential_notation.rb
680
+ - lib/rubocop/cop/style/file_read.rb
681
+ - lib/rubocop/cop/style/file_write.rb
671
682
  - lib/rubocop/cop/style/float_division.rb
672
683
  - lib/rubocop/cop/style/for.rb
673
684
  - lib/rubocop/cop/style/format_string.rb
@@ -700,6 +711,7 @@ files:
700
711
  - lib/rubocop/cop/style/lambda.rb
701
712
  - lib/rubocop/cop/style/lambda_call.rb
702
713
  - lib/rubocop/cop/style/line_end_concatenation.rb
714
+ - lib/rubocop/cop/style/map_to_hash.rb
703
715
  - lib/rubocop/cop/style/method_call_with_args_parentheses.rb
704
716
  - lib/rubocop/cop/style/method_call_with_args_parentheses/omit_parentheses.rb
705
717
  - lib/rubocop/cop/style/method_call_with_args_parentheses/require_parentheses.rb
@@ -726,6 +738,7 @@ files:
726
738
  - lib/rubocop/cop/style/negated_if_else_condition.rb
727
739
  - lib/rubocop/cop/style/negated_unless.rb
728
740
  - lib/rubocop/cop/style/negated_while.rb
741
+ - lib/rubocop/cop/style/nested_file_dirname.rb
729
742
  - lib/rubocop/cop/style/nested_modifier.rb
730
743
  - lib/rubocop/cop/style/nested_parenthesized_calls.rb
731
744
  - lib/rubocop/cop/style/nested_ternary_operator.rb
@@ -740,6 +753,7 @@ files:
740
753
  - lib/rubocop/cop/style/numeric_literals.rb
741
754
  - lib/rubocop/cop/style/numeric_predicate.rb
742
755
  - lib/rubocop/cop/style/one_line_conditional.rb
756
+ - lib/rubocop/cop/style/open_struct_use.rb
743
757
  - lib/rubocop/cop/style/option_hash.rb
744
758
  - lib/rubocop/cop/style/optional_arguments.rb
745
759
  - lib/rubocop/cop/style/optional_boolean_parameter.rb
@@ -899,8 +913,9 @@ metadata:
899
913
  homepage_uri: https://rubocop.org/
900
914
  changelog_uri: https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md
901
915
  source_code_uri: https://github.com/rubocop/rubocop/
902
- documentation_uri: https://docs.rubocop.org/rubocop/1.22/
916
+ documentation_uri: https://docs.rubocop.org/rubocop/1.26/
903
917
  bug_tracker_uri: https://github.com/rubocop/rubocop/issues
918
+ rubygems_mfa_required: 'true'
904
919
  post_install_message:
905
920
  rdoc_options: []
906
921
  require_paths: