rubocop 1.13.0 → 1.17.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 (71) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -1
  3. data/config/default.yml +68 -8
  4. data/lib/rubocop.rb +9 -0
  5. data/lib/rubocop/cop/bundler/gem_comment.rb +1 -3
  6. data/lib/rubocop/cop/bundler/gem_version.rb +99 -0
  7. data/lib/rubocop/cop/internal_affairs/example_description.rb +1 -1
  8. data/lib/rubocop/cop/layout/argument_alignment.rb +29 -11
  9. data/lib/rubocop/cop/layout/case_indentation.rb +57 -9
  10. data/lib/rubocop/cop/layout/dot_position.rb +7 -1
  11. data/lib/rubocop/cop/layout/empty_line_after_guard_clause.rb +13 -15
  12. data/lib/rubocop/cop/layout/first_hash_element_indentation.rb +12 -0
  13. data/lib/rubocop/cop/layout/hash_alignment.rb +34 -9
  14. data/lib/rubocop/cop/layout/indentation_width.rb +13 -2
  15. data/lib/rubocop/cop/layout/redundant_line_break.rb +24 -10
  16. data/lib/rubocop/cop/layout/single_line_block_chain.rb +53 -0
  17. data/lib/rubocop/cop/layout/space_around_keyword.rb +28 -0
  18. data/lib/rubocop/cop/layout/space_around_operators.rb +6 -0
  19. data/lib/rubocop/cop/lint/deprecated_class_methods.rb +83 -39
  20. data/lib/rubocop/cop/lint/empty_block.rb +18 -2
  21. data/lib/rubocop/cop/lint/empty_in_pattern.rb +62 -0
  22. data/lib/rubocop/cop/lint/literal_as_condition.rb +13 -1
  23. data/lib/rubocop/cop/lint/missing_cop_enable_directive.rb +32 -17
  24. data/lib/rubocop/cop/lint/number_conversion.rb +1 -1
  25. data/lib/rubocop/cop/lint/redundant_cop_disable_directive.rb +105 -74
  26. data/lib/rubocop/cop/lint/redundant_cop_enable_directive.rb +5 -0
  27. data/lib/rubocop/cop/lint/symbol_conversion.rb +2 -12
  28. data/lib/rubocop/cop/lint/unreachable_loop.rb +12 -2
  29. data/lib/rubocop/cop/lint/unused_block_argument.rb +7 -1
  30. data/lib/rubocop/cop/lint/void.rb +1 -1
  31. data/lib/rubocop/cop/migration/department_name.rb +3 -1
  32. data/lib/rubocop/cop/mixin/check_line_breakable.rb +19 -3
  33. data/lib/rubocop/cop/mixin/frozen_string_literal.rb +6 -0
  34. data/lib/rubocop/cop/mixin/gem_declaration.rb +13 -0
  35. data/lib/rubocop/cop/mixin/hash_alignment_styles.rb +14 -3
  36. data/lib/rubocop/cop/mixin/string_literals_help.rb +3 -5
  37. data/lib/rubocop/cop/mixin/symbol_help.rb +13 -0
  38. data/lib/rubocop/cop/style/class_and_module_children.rb +17 -5
  39. data/lib/rubocop/cop/style/empty_literal.rb +8 -1
  40. data/lib/rubocop/cop/style/hash_each_methods.rb +18 -1
  41. data/lib/rubocop/cop/style/identical_conditional_branches.rb +58 -8
  42. data/lib/rubocop/cop/style/if_unless_modifier.rb +3 -4
  43. data/lib/rubocop/cop/style/in_pattern_then.rb +56 -0
  44. data/lib/rubocop/cop/style/method_call_with_args_parentheses/omit_parentheses.rb +2 -1
  45. data/lib/rubocop/cop/style/multiline_in_pattern_then.rb +62 -0
  46. data/lib/rubocop/cop/style/multiline_when_then.rb +2 -11
  47. data/lib/rubocop/cop/style/negated_if_else_condition.rb +17 -9
  48. data/lib/rubocop/cop/style/nil_lambda.rb +29 -12
  49. data/lib/rubocop/cop/style/quoted_symbols.rb +110 -0
  50. data/lib/rubocop/cop/style/raise_args.rb +2 -0
  51. data/lib/rubocop/cop/style/redundant_begin.rb +1 -1
  52. data/lib/rubocop/cop/style/redundant_self.rb +24 -2
  53. data/lib/rubocop/cop/style/regexp_literal.rb +9 -1
  54. data/lib/rubocop/cop/style/single_line_methods.rb +8 -3
  55. data/lib/rubocop/cop/style/sole_nested_conditional.rb +14 -5
  56. data/lib/rubocop/cop/style/string_literals.rb +1 -0
  57. data/lib/rubocop/cop/style/string_literals_in_interpolation.rb +1 -0
  58. data/lib/rubocop/cop/style/top_level_method_definition.rb +83 -0
  59. data/lib/rubocop/cop/style/trivial_accessors.rb +65 -0
  60. data/lib/rubocop/cop/style/when_then.rb +6 -2
  61. data/lib/rubocop/cop/variable_force/branch.rb +15 -0
  62. data/lib/rubocop/directive_comment.rb +58 -6
  63. data/lib/rubocop/formatter/junit_formatter.rb +21 -6
  64. data/lib/rubocop/options.rb +14 -20
  65. data/lib/rubocop/rake_task.rb +1 -1
  66. data/lib/rubocop/remote_config.rb +10 -2
  67. data/lib/rubocop/rspec/shared_contexts.rb +4 -0
  68. data/lib/rubocop/target_finder.rb +9 -2
  69. data/lib/rubocop/target_ruby.rb +1 -1
  70. data/lib/rubocop/version.rb +1 -1
  71. metadata +18 -9
@@ -131,3 +131,7 @@ end
131
131
  RSpec.shared_context 'ruby 3.0', :ruby30 do
132
132
  let(:ruby_version) { 3.0 }
133
133
  end
134
+
135
+ RSpec.shared_context 'ruby 3.1', :ruby31 do
136
+ let(:ruby_version) { 3.1 }
137
+ end
@@ -100,12 +100,19 @@ module RuboCop
100
100
  next true if dir.end_with?('/./', '/../')
101
101
  next true if File.fnmatch?(exclude_pattern, dir, flags)
102
102
 
103
- File.symlink?(dir.chomp('/')) && File.fnmatch?(exclude_pattern,
104
- "#{File.realpath(dir)}/", flags)
103
+ symlink_excluded_or_infinite_loop?(base_dir, dir, exclude_pattern, flags)
105
104
  end
106
105
  dirs.flat_map { |dir| wanted_dir_patterns(dir, exclude_pattern, flags) }.unshift(base_dir)
107
106
  end
108
107
 
108
+ def symlink_excluded_or_infinite_loop?(base_dir, current_dir, exclude_pattern, flags)
109
+ dir_realpath = File.realpath(current_dir)
110
+ File.symlink?(current_dir.chomp('/')) && (
111
+ File.fnmatch?(exclude_pattern, "#{dir_realpath}/", flags) ||
112
+ File.realpath(base_dir).start_with?(dir_realpath)
113
+ )
114
+ end
115
+
109
116
  def combined_exclude_glob_patterns(base_dir)
110
117
  exclude = @config_store.for(base_dir).for_all_cops['Exclude']
111
118
  patterns = exclude.select { |pattern| pattern.is_a?(String) && pattern.end_with?('/**/*') }
@@ -4,7 +4,7 @@ module RuboCop
4
4
  # The kind of Ruby that code inspected by RuboCop is written in.
5
5
  # @api private
6
6
  class TargetRuby
7
- KNOWN_RUBIES = [2.5, 2.6, 2.7, 3.0].freeze
7
+ KNOWN_RUBIES = [2.5, 2.6, 2.7, 3.0, 3.1].freeze
8
8
  DEFAULT_VERSION = KNOWN_RUBIES.first
9
9
 
10
10
  OBSOLETE_RUBIES = {
@@ -3,7 +3,7 @@
3
3
  module RuboCop
4
4
  # This module holds the RuboCop version information.
5
5
  module Version
6
- STRING = '1.13.0'
6
+ STRING = '1.17.0'
7
7
 
8
8
  MSG = '%<version>s (using Parser %<parser_version>s, '\
9
9
  'rubocop-ast %<rubocop_ast_version>s, ' \
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.13.0
4
+ version: 1.17.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bozhidar Batsov
8
8
  - Jonas Arvidsson
9
9
  - Yuji Nakayama
10
- autorequire:
10
+ autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2021-04-20 00:00:00.000000000 Z
13
+ date: 2021-06-15 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: parallel
@@ -100,7 +100,7 @@ dependencies:
100
100
  requirements:
101
101
  - - ">="
102
102
  - !ruby/object:Gem::Version
103
- version: 1.2.0
103
+ version: 1.7.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.2.0
113
+ version: 1.7.0
114
114
  - - "<"
115
115
  - !ruby/object:Gem::Version
116
116
  version: '2.0'
@@ -221,6 +221,7 @@ files:
221
221
  - lib/rubocop/cop/base.rb
222
222
  - lib/rubocop/cop/bundler/duplicated_gem.rb
223
223
  - lib/rubocop/cop/bundler/gem_comment.rb
224
+ - lib/rubocop/cop/bundler/gem_version.rb
224
225
  - lib/rubocop/cop/bundler/insecure_protocol_source.rb
225
226
  - lib/rubocop/cop/bundler/ordered_gems.rb
226
227
  - lib/rubocop/cop/commissioner.rb
@@ -333,6 +334,7 @@ files:
333
334
  - lib/rubocop/cop/layout/parameter_alignment.rb
334
335
  - lib/rubocop/cop/layout/redundant_line_break.rb
335
336
  - lib/rubocop/cop/layout/rescue_ensure_alignment.rb
337
+ - lib/rubocop/cop/layout/single_line_block_chain.rb
336
338
  - lib/rubocop/cop/layout/space_after_colon.rb
337
339
  - lib/rubocop/cop/layout/space_after_comma.rb
338
340
  - lib/rubocop/cop/layout/space_after_method_name.rb
@@ -395,6 +397,7 @@ files:
395
397
  - lib/rubocop/cop/lint/empty_ensure.rb
396
398
  - lib/rubocop/cop/lint/empty_expression.rb
397
399
  - lib/rubocop/cop/lint/empty_file.rb
400
+ - lib/rubocop/cop/lint/empty_in_pattern.rb
398
401
  - lib/rubocop/cop/lint/empty_interpolation.rb
399
402
  - lib/rubocop/cop/lint/empty_when.rb
400
403
  - lib/rubocop/cop/lint/ensure_return.rb
@@ -524,6 +527,7 @@ files:
524
527
  - lib/rubocop/cop/mixin/enforce_superclass.rb
525
528
  - lib/rubocop/cop/mixin/first_element_line_break.rb
526
529
  - lib/rubocop/cop/mixin/frozen_string_literal.rb
530
+ - lib/rubocop/cop/mixin/gem_declaration.rb
527
531
  - lib/rubocop/cop/mixin/hash_alignment_styles.rb
528
532
  - lib/rubocop/cop/mixin/hash_transform_method.rb
529
533
  - lib/rubocop/cop/mixin/heredoc.rb
@@ -559,6 +563,7 @@ files:
559
563
  - lib/rubocop/cop/mixin/string_help.rb
560
564
  - lib/rubocop/cop/mixin/string_literals_help.rb
561
565
  - lib/rubocop/cop/mixin/surrounding_space.rb
566
+ - lib/rubocop/cop/mixin/symbol_help.rb
562
567
  - lib/rubocop/cop/mixin/target_ruby_version.rb
563
568
  - lib/rubocop/cop/mixin/trailing_body.rb
564
569
  - lib/rubocop/cop/mixin/trailing_comma.rb
@@ -673,6 +678,7 @@ files:
673
678
  - lib/rubocop/cop/style/if_with_boolean_literal_branches.rb
674
679
  - lib/rubocop/cop/style/if_with_semicolon.rb
675
680
  - lib/rubocop/cop/style/implicit_runtime_error.rb
681
+ - lib/rubocop/cop/style/in_pattern_then.rb
676
682
  - lib/rubocop/cop/style/infinite_loop.rb
677
683
  - lib/rubocop/cop/style/inline_comment.rb
678
684
  - lib/rubocop/cop/style/inverse_methods.rb
@@ -696,6 +702,7 @@ files:
696
702
  - lib/rubocop/cop/style/multiline_block_chain.rb
697
703
  - lib/rubocop/cop/style/multiline_if_modifier.rb
698
704
  - lib/rubocop/cop/style/multiline_if_then.rb
705
+ - lib/rubocop/cop/style/multiline_in_pattern_then.rb
699
706
  - lib/rubocop/cop/style/multiline_memoization.rb
700
707
  - lib/rubocop/cop/style/multiline_method_signature.rb
701
708
  - lib/rubocop/cop/style/multiline_ternary_operator.rb
@@ -729,6 +736,7 @@ files:
729
736
  - lib/rubocop/cop/style/perl_backrefs.rb
730
737
  - lib/rubocop/cop/style/preferred_hash_methods.rb
731
738
  - lib/rubocop/cop/style/proc.rb
739
+ - lib/rubocop/cop/style/quoted_symbols.rb
732
740
  - lib/rubocop/cop/style/raise_args.rb
733
741
  - lib/rubocop/cop/style/random_with_offset.rb
734
742
  - lib/rubocop/cop/style/redundant_argument.rb
@@ -783,6 +791,7 @@ files:
783
791
  - lib/rubocop/cop/style/symbol_literal.rb
784
792
  - lib/rubocop/cop/style/symbol_proc.rb
785
793
  - lib/rubocop/cop/style/ternary_parentheses.rb
794
+ - lib/rubocop/cop/style/top_level_method_definition.rb
786
795
  - lib/rubocop/cop/style/trailing_body_on_class.rb
787
796
  - lib/rubocop/cop/style/trailing_body_on_method_definition.rb
788
797
  - lib/rubocop/cop/style/trailing_body_on_module.rb
@@ -872,9 +881,9 @@ metadata:
872
881
  homepage_uri: https://rubocop.org/
873
882
  changelog_uri: https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md
874
883
  source_code_uri: https://github.com/rubocop/rubocop/
875
- documentation_uri: https://docs.rubocop.org/rubocop/1.13/
884
+ documentation_uri: https://docs.rubocop.org/rubocop/1.17/
876
885
  bug_tracker_uri: https://github.com/rubocop/rubocop/issues
877
- post_install_message:
886
+ post_install_message:
878
887
  rdoc_options: []
879
888
  require_paths:
880
889
  - lib
@@ -889,8 +898,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
889
898
  - !ruby/object:Gem::Version
890
899
  version: '0'
891
900
  requirements: []
892
- rubygems_version: 3.1.2
893
- signing_key:
901
+ rubygems_version: 3.2.18
902
+ signing_key:
894
903
  specification_version: 4
895
904
  summary: Automatic Ruby code style checking tool.
896
905
  test_files: []