rubocop 1.5.1 → 1.8.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 (115) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.txt +1 -1
  3. data/README.md +2 -2
  4. data/config/default.yml +111 -14
  5. data/config/obsoletion.yml +196 -0
  6. data/lib/rubocop.rb +20 -1
  7. data/lib/rubocop/cli/command/suggest_extensions.rb +19 -19
  8. data/lib/rubocop/comment_config.rb +6 -6
  9. data/lib/rubocop/config.rb +8 -5
  10. data/lib/rubocop/config_loader.rb +10 -6
  11. data/lib/rubocop/config_loader_resolver.rb +21 -4
  12. data/lib/rubocop/config_obsoletion.rb +64 -262
  13. data/lib/rubocop/config_obsoletion/changed_enforced_styles.rb +33 -0
  14. data/lib/rubocop/config_obsoletion/changed_parameter.rb +21 -0
  15. data/lib/rubocop/config_obsoletion/cop_rule.rb +34 -0
  16. data/lib/rubocop/config_obsoletion/extracted_cop.rb +44 -0
  17. data/lib/rubocop/config_obsoletion/parameter_rule.rb +44 -0
  18. data/lib/rubocop/config_obsoletion/removed_cop.rb +41 -0
  19. data/lib/rubocop/config_obsoletion/renamed_cop.rb +34 -0
  20. data/lib/rubocop/config_obsoletion/rule.rb +41 -0
  21. data/lib/rubocop/config_obsoletion/split_cop.rb +27 -0
  22. data/lib/rubocop/config_validator.rb +11 -4
  23. data/lib/rubocop/cop/base.rb +17 -15
  24. data/lib/rubocop/cop/cop.rb +2 -2
  25. data/lib/rubocop/cop/correctors/string_literal_corrector.rb +6 -8
  26. data/lib/rubocop/cop/gemspec/required_ruby_version.rb +3 -2
  27. data/lib/rubocop/cop/internal_affairs.rb +1 -0
  28. data/lib/rubocop/cop/internal_affairs/style_detected_api_use.rb +145 -0
  29. data/lib/rubocop/cop/layout/empty_line_between_defs.rb +19 -3
  30. data/lib/rubocop/cop/layout/empty_lines_around_attribute_accessor.rb +1 -1
  31. data/lib/rubocop/cop/layout/heredoc_argument_closing_parenthesis.rb +26 -0
  32. data/lib/rubocop/cop/layout/line_length.rb +6 -16
  33. data/lib/rubocop/cop/layout/multiline_method_call_indentation.rb +7 -3
  34. data/lib/rubocop/cop/layout/multiline_operation_indentation.rb +2 -2
  35. data/lib/rubocop/cop/layout/rescue_ensure_alignment.rb +3 -10
  36. data/lib/rubocop/cop/layout/space_around_equals_in_parameter_default.rb +1 -0
  37. data/lib/rubocop/cop/layout/space_before_block_braces.rb +2 -0
  38. data/lib/rubocop/cop/layout/space_before_brackets.rb +62 -0
  39. data/lib/rubocop/cop/layout/space_inside_block_braces.rb +13 -10
  40. data/lib/rubocop/cop/layout/space_inside_hash_literal_braces.rb +2 -2
  41. data/lib/rubocop/cop/lint/ambiguous_assignment.rb +59 -0
  42. data/lib/rubocop/cop/lint/binary_operator_with_identical_operands.rb +7 -2
  43. data/lib/rubocop/cop/lint/deprecated_constants.rb +75 -0
  44. data/lib/rubocop/cop/lint/duplicate_branch.rb +64 -2
  45. data/lib/rubocop/cop/lint/lambda_without_literal_block.rb +44 -0
  46. data/lib/rubocop/cop/lint/non_deterministic_require_order.rb +10 -6
  47. data/lib/rubocop/cop/lint/redundant_cop_disable_directive.rb +2 -1
  48. data/lib/rubocop/cop/lint/redundant_dir_glob_sort.rb +48 -0
  49. data/lib/rubocop/cop/lint/redundant_splat_expansion.rb +50 -17
  50. data/lib/rubocop/cop/lint/shadowed_exception.rb +1 -11
  51. data/lib/rubocop/cop/lint/shadowing_outer_local_variable.rb +13 -0
  52. data/lib/rubocop/cop/lint/unreachable_loop.rb +17 -0
  53. data/lib/rubocop/cop/metrics/utils/code_length_calculator.rb +1 -1
  54. data/lib/rubocop/cop/migration/department_name.rb +1 -1
  55. data/lib/rubocop/cop/mixin/allowed_identifiers.rb +18 -0
  56. data/lib/rubocop/cop/mixin/comments_help.rb +1 -10
  57. data/lib/rubocop/cop/mixin/first_element_line_break.rb +1 -1
  58. data/lib/rubocop/cop/mixin/string_help.rb +4 -1
  59. data/lib/rubocop/cop/naming/accessor_method_name.rb +15 -1
  60. data/lib/rubocop/cop/naming/memoized_instance_variable_name.rb +59 -5
  61. data/lib/rubocop/cop/naming/variable_name.rb +2 -0
  62. data/lib/rubocop/cop/naming/variable_number.rb +1 -8
  63. data/lib/rubocop/cop/registry.rb +10 -0
  64. data/lib/rubocop/cop/style/access_modifier_declarations.rb +3 -1
  65. data/lib/rubocop/cop/style/character_literal.rb +10 -11
  66. data/lib/rubocop/cop/style/collection_methods.rb +14 -1
  67. data/lib/rubocop/cop/style/commented_keyword.rb +22 -5
  68. data/lib/rubocop/cop/style/empty_literal.rb +6 -2
  69. data/lib/rubocop/cop/style/endless_method.rb +102 -0
  70. data/lib/rubocop/cop/style/float_division.rb +44 -1
  71. data/lib/rubocop/cop/style/for.rb +2 -0
  72. data/lib/rubocop/cop/style/hash_except.rb +95 -0
  73. data/lib/rubocop/cop/style/hash_like_case.rb +2 -1
  74. data/lib/rubocop/cop/style/if_inside_else.rb +8 -3
  75. data/lib/rubocop/cop/style/if_unless_modifier.rb +4 -0
  76. data/lib/rubocop/cop/style/ip_addresses.rb +1 -1
  77. data/lib/rubocop/cop/style/keyword_parameters_order.rb +12 -2
  78. data/lib/rubocop/cop/style/lambda_call.rb +2 -1
  79. data/lib/rubocop/cop/style/method_call_with_args_parentheses.rb +7 -0
  80. data/lib/rubocop/cop/style/method_call_with_args_parentheses/omit_parentheses.rb +16 -6
  81. data/lib/rubocop/cop/style/method_def_parentheses.rb +7 -0
  82. data/lib/rubocop/cop/style/multiline_method_signature.rb +26 -1
  83. data/lib/rubocop/cop/style/multiline_when_then.rb +3 -1
  84. data/lib/rubocop/cop/style/mutable_constant.rb +13 -3
  85. data/lib/rubocop/cop/style/nested_parenthesized_calls.rb +4 -0
  86. data/lib/rubocop/cop/style/perl_backrefs.rb +86 -9
  87. data/lib/rubocop/cop/style/raise_args.rb +5 -2
  88. data/lib/rubocop/cop/style/redundant_argument.rb +21 -2
  89. data/lib/rubocop/cop/style/redundant_freeze.rb +8 -4
  90. data/lib/rubocop/cop/style/redundant_regexp_escape.rb +24 -8
  91. data/lib/rubocop/cop/style/redundant_return.rb +1 -1
  92. data/lib/rubocop/cop/style/single_line_block_params.rb +30 -7
  93. data/lib/rubocop/cop/style/single_line_methods.rb +33 -2
  94. data/lib/rubocop/cop/style/sole_nested_conditional.rb +25 -9
  95. data/lib/rubocop/cop/style/special_global_vars.rb +1 -13
  96. data/lib/rubocop/cop/style/string_concatenation.rb +26 -1
  97. data/lib/rubocop/cop/style/string_literals.rb +14 -8
  98. data/lib/rubocop/cop/style/string_literals_in_interpolation.rb +4 -3
  99. data/lib/rubocop/cop/style/symbol_proc.rb +5 -4
  100. data/lib/rubocop/cop/util.rb +3 -1
  101. data/lib/rubocop/ext/regexp_node.rb +31 -9
  102. data/lib/rubocop/ext/regexp_parser.rb +21 -3
  103. data/lib/rubocop/formatter/emacs_style_formatter.rb +2 -0
  104. data/lib/rubocop/formatter/simple_text_formatter.rb +2 -0
  105. data/lib/rubocop/formatter/tap_formatter.rb +2 -0
  106. data/lib/rubocop/lockfile.rb +40 -0
  107. data/lib/rubocop/options.rb +9 -9
  108. data/lib/rubocop/rspec/cop_helper.rb +0 -4
  109. data/lib/rubocop/rspec/expect_offense.rb +34 -22
  110. data/lib/rubocop/runner.rb +16 -1
  111. data/lib/rubocop/target_finder.rb +4 -2
  112. data/lib/rubocop/target_ruby.rb +47 -11
  113. data/lib/rubocop/util.rb +16 -0
  114. data/lib/rubocop/version.rb +8 -2
  115. metadata +42 -9
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RuboCop
4
+ # This module contains a collection of useful utility methods.
5
+ module Util
6
+ def self.silence_warnings
7
+ # Replaces Kernel::silence_warnings since it hides any warnings,
8
+ # including the RuboCop ones
9
+ old_verbose = $VERBOSE
10
+ $VERBOSE = nil
11
+ yield
12
+ ensure
13
+ $VERBOSE = old_verbose
14
+ end
15
+ end
16
+ 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.5.1'
6
+ STRING = '1.8.0'
7
7
 
8
8
  MSG = '%<version>s (using Parser %<parser_version>s, '\
9
9
  'rubocop-ast %<rubocop_ast_version>s, ' \
@@ -34,7 +34,13 @@ module RuboCop
34
34
 
35
35
  # @api private
36
36
  def self.extension_versions(env)
37
- env.config_store.for_pwd.loaded_features.sort.map do |loaded_feature|
37
+ features = Util.silence_warnings do
38
+ # Suppress any config issues when loading the config (ie. deprecations,
39
+ # pending cops, etc.).
40
+ env.config_store.for_pwd.loaded_features.sort
41
+ end
42
+
43
+ features.map do |loaded_feature|
38
44
  next unless (match = loaded_feature.match(/rubocop-(?<feature>.*)/))
39
45
 
40
46
  feature = match[:feature]
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.5.1
4
+ version: 1.8.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: 2020-12-02 00:00:00.000000000 Z
13
+ date: 2021-01-07 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: 2.7.1.5
35
+ version: 3.0.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: 2.7.1.5
42
+ version: 3.0.0.0
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: rainbow
45
45
  requirement: !ruby/object:Gem::Requirement
@@ -66,14 +66,20 @@ dependencies:
66
66
  requirements:
67
67
  - - ">="
68
68
  - !ruby/object:Gem::Version
69
- version: '2.0'
69
+ version: '1.8'
70
+ - - "<"
71
+ - !ruby/object:Gem::Version
72
+ version: '3.0'
70
73
  type: :runtime
71
74
  prerelease: false
72
75
  version_requirements: !ruby/object:Gem::Requirement
73
76
  requirements:
74
77
  - - ">="
75
78
  - !ruby/object:Gem::Version
76
- version: '2.0'
79
+ version: '1.8'
80
+ - - "<"
81
+ - !ruby/object:Gem::Version
82
+ version: '3.0'
77
83
  - !ruby/object:Gem::Dependency
78
84
  name: rexml
79
85
  requirement: !ruby/object:Gem::Requirement
@@ -95,6 +101,9 @@ dependencies:
95
101
  - - ">="
96
102
  - !ruby/object:Gem::Version
97
103
  version: 1.2.0
104
+ - - "<"
105
+ - !ruby/object:Gem::Version
106
+ version: '2.0'
98
107
  type: :runtime
99
108
  prerelease: false
100
109
  version_requirements: !ruby/object:Gem::Requirement
@@ -102,6 +111,9 @@ dependencies:
102
111
  - - ">="
103
112
  - !ruby/object:Gem::Version
104
113
  version: 1.2.0
114
+ - - "<"
115
+ - !ruby/object:Gem::Version
116
+ version: '2.0'
105
117
  - !ruby/object:Gem::Dependency
106
118
  name: ruby-progressbar
107
119
  requirement: !ruby/object:Gem::Requirement
@@ -125,7 +137,7 @@ dependencies:
125
137
  version: 1.4.0
126
138
  - - "<"
127
139
  - !ruby/object:Gem::Version
128
- version: '2.0'
140
+ version: '3.0'
129
141
  type: :runtime
130
142
  prerelease: false
131
143
  version_requirements: !ruby/object:Gem::Requirement
@@ -135,7 +147,7 @@ dependencies:
135
147
  version: 1.4.0
136
148
  - - "<"
137
149
  - !ruby/object:Gem::Version
138
- version: '2.0'
150
+ version: '3.0'
139
151
  - !ruby/object:Gem::Dependency
140
152
  name: bundler
141
153
  requirement: !ruby/object:Gem::Requirement
@@ -172,6 +184,7 @@ files:
172
184
  - assets/logo.png
173
185
  - assets/output.html.erb
174
186
  - config/default.yml
187
+ - config/obsoletion.yml
175
188
  - exe/rubocop
176
189
  - lib/rubocop.rb
177
190
  - lib/rubocop/ast_aliases.rb
@@ -191,6 +204,15 @@ files:
191
204
  - lib/rubocop/config_loader.rb
192
205
  - lib/rubocop/config_loader_resolver.rb
193
206
  - lib/rubocop/config_obsoletion.rb
207
+ - lib/rubocop/config_obsoletion/changed_enforced_styles.rb
208
+ - lib/rubocop/config_obsoletion/changed_parameter.rb
209
+ - lib/rubocop/config_obsoletion/cop_rule.rb
210
+ - lib/rubocop/config_obsoletion/extracted_cop.rb
211
+ - lib/rubocop/config_obsoletion/parameter_rule.rb
212
+ - lib/rubocop/config_obsoletion/removed_cop.rb
213
+ - lib/rubocop/config_obsoletion/renamed_cop.rb
214
+ - lib/rubocop/config_obsoletion/rule.rb
215
+ - lib/rubocop/config_obsoletion/split_cop.rb
194
216
  - lib/rubocop/config_regeneration.rb
195
217
  - lib/rubocop/config_store.rb
196
218
  - lib/rubocop/config_validator.rb
@@ -236,6 +258,7 @@ files:
236
258
  - lib/rubocop/cop/internal_affairs/offense_location_keyword.rb
237
259
  - lib/rubocop/cop/internal_affairs/redundant_location_argument.rb
238
260
  - lib/rubocop/cop/internal_affairs/redundant_message_argument.rb
261
+ - lib/rubocop/cop/internal_affairs/style_detected_api_use.rb
239
262
  - lib/rubocop/cop/internal_affairs/useless_message_assertion.rb
240
263
  - lib/rubocop/cop/layout/access_modifier_indentation.rb
241
264
  - lib/rubocop/cop/layout/argument_alignment.rb
@@ -313,6 +336,7 @@ files:
313
336
  - lib/rubocop/cop/layout/space_around_method_call_operator.rb
314
337
  - lib/rubocop/cop/layout/space_around_operators.rb
315
338
  - lib/rubocop/cop/layout/space_before_block_braces.rb
339
+ - lib/rubocop/cop/layout/space_before_brackets.rb
316
340
  - lib/rubocop/cop/layout/space_before_comma.rb
317
341
  - lib/rubocop/cop/layout/space_before_comment.rb
318
342
  - lib/rubocop/cop/layout/space_before_first_arg.rb
@@ -331,6 +355,7 @@ files:
331
355
  - lib/rubocop/cop/layout/trailing_whitespace.rb
332
356
  - lib/rubocop/cop/legacy/corrections_proxy.rb
333
357
  - lib/rubocop/cop/legacy/corrector.rb
358
+ - lib/rubocop/cop/lint/ambiguous_assignment.rb
334
359
  - lib/rubocop/cop/lint/ambiguous_block_association.rb
335
360
  - lib/rubocop/cop/lint/ambiguous_operator.rb
336
361
  - lib/rubocop/cop/lint/ambiguous_regexp_literal.rb
@@ -343,6 +368,7 @@ files:
343
368
  - lib/rubocop/cop/lint/constant_resolution.rb
344
369
  - lib/rubocop/cop/lint/debugger.rb
345
370
  - lib/rubocop/cop/lint/deprecated_class_methods.rb
371
+ - lib/rubocop/cop/lint/deprecated_constants.rb
346
372
  - lib/rubocop/cop/lint/deprecated_open_ssl_constant.rb
347
373
  - lib/rubocop/cop/lint/disjunctive_assignment_in_constructor.rb
348
374
  - lib/rubocop/cop/lint/duplicate_branch.rb
@@ -376,6 +402,7 @@ files:
376
402
  - lib/rubocop/cop/lint/ineffective_access_modifier.rb
377
403
  - lib/rubocop/cop/lint/inherit_exception.rb
378
404
  - lib/rubocop/cop/lint/interpolation_check.rb
405
+ - lib/rubocop/cop/lint/lambda_without_literal_block.rb
379
406
  - lib/rubocop/cop/lint/literal_as_condition.rb
380
407
  - lib/rubocop/cop/lint/literal_in_interpolation.rb
381
408
  - lib/rubocop/cop/lint/loop.rb
@@ -399,6 +426,7 @@ files:
399
426
  - lib/rubocop/cop/lint/rand_one.rb
400
427
  - lib/rubocop/cop/lint/redundant_cop_disable_directive.rb
401
428
  - lib/rubocop/cop/lint/redundant_cop_enable_directive.rb
429
+ - lib/rubocop/cop/lint/redundant_dir_glob_sort.rb
402
430
  - lib/rubocop/cop/lint/redundant_require_statement.rb
403
431
  - lib/rubocop/cop/lint/redundant_safe_navigation.rb
404
432
  - lib/rubocop/cop/lint/redundant_splat_expansion.rb
@@ -460,6 +488,7 @@ files:
460
488
  - lib/rubocop/cop/metrics/utils/repeated_csend_discount.rb
461
489
  - lib/rubocop/cop/migration/department_name.rb
462
490
  - lib/rubocop/cop/mixin/alignment.rb
491
+ - lib/rubocop/cop/mixin/allowed_identifiers.rb
463
492
  - lib/rubocop/cop/mixin/allowed_methods.rb
464
493
  - lib/rubocop/cop/mixin/annotation_comment.rb
465
494
  - lib/rubocop/cop/mixin/array_min_size.rb
@@ -602,6 +631,7 @@ files:
602
631
  - lib/rubocop/cop/style/empty_method.rb
603
632
  - lib/rubocop/cop/style/encoding.rb
604
633
  - lib/rubocop/cop/style/end_block.rb
634
+ - lib/rubocop/cop/style/endless_method.rb
605
635
  - lib/rubocop/cop/style/eval_with_location.rb
606
636
  - lib/rubocop/cop/style/even_odd.rb
607
637
  - lib/rubocop/cop/style/expand_path_arguments.rb
@@ -617,6 +647,7 @@ files:
617
647
  - lib/rubocop/cop/style/guard_clause.rb
618
648
  - lib/rubocop/cop/style/hash_as_last_array_item.rb
619
649
  - lib/rubocop/cop/style/hash_each_methods.rb
650
+ - lib/rubocop/cop/style/hash_except.rb
620
651
  - lib/rubocop/cop/style/hash_like_case.rb
621
652
  - lib/rubocop/cop/style/hash_syntax.rb
622
653
  - lib/rubocop/cop/style/hash_transform_keys.rb
@@ -796,6 +827,7 @@ files:
796
827
  - lib/rubocop/formatter/tap_formatter.rb
797
828
  - lib/rubocop/formatter/text_util.rb
798
829
  - lib/rubocop/formatter/worst_offenders_formatter.rb
830
+ - lib/rubocop/lockfile.rb
799
831
  - lib/rubocop/magic_comment.rb
800
832
  - lib/rubocop/name_similarity.rb
801
833
  - lib/rubocop/options.rb
@@ -813,6 +845,7 @@ files:
813
845
  - lib/rubocop/string_interpreter.rb
814
846
  - lib/rubocop/target_finder.rb
815
847
  - lib/rubocop/target_ruby.rb
848
+ - lib/rubocop/util.rb
816
849
  - lib/rubocop/version.rb
817
850
  - lib/rubocop/warning.rb
818
851
  - lib/rubocop/yaml_duplication_checker.rb
@@ -823,7 +856,7 @@ metadata:
823
856
  homepage_uri: https://rubocop.org/
824
857
  changelog_uri: https://github.com/rubocop-hq/rubocop/blob/master/CHANGELOG.md
825
858
  source_code_uri: https://github.com/rubocop-hq/rubocop/
826
- documentation_uri: https://docs.rubocop.org/rubocop/1.5/
859
+ documentation_uri: https://docs.rubocop.org/rubocop/1.8/
827
860
  bug_tracker_uri: https://github.com/rubocop-hq/rubocop/issues
828
861
  post_install_message:
829
862
  rdoc_options: []