rubocop 0.77.0 → 0.81.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 (129) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.txt +1 -1
  3. data/README.md +3 -3
  4. data/config/default.yml +136 -60
  5. data/lib/rubocop.rb +20 -4
  6. data/lib/rubocop/ast/builder.rb +45 -42
  7. data/lib/rubocop/ast/node.rb +11 -18
  8. data/lib/rubocop/ast/node/block_node.rb +5 -1
  9. data/lib/rubocop/ast/node/case_match_node.rb +56 -0
  10. data/lib/rubocop/ast/node/def_node.rb +11 -0
  11. data/lib/rubocop/ast/node/forward_args_node.rb +18 -0
  12. data/lib/rubocop/ast/node/regexp_node.rb +2 -4
  13. data/lib/rubocop/ast/traversal.rb +29 -10
  14. data/lib/rubocop/cli/command/auto_genenerate_config.rb +7 -7
  15. data/lib/rubocop/cli/command/show_cops.rb +11 -4
  16. data/lib/rubocop/comment_config.rb +6 -1
  17. data/lib/rubocop/config.rb +28 -10
  18. data/lib/rubocop/config_loader.rb +19 -19
  19. data/lib/rubocop/config_obsoletion.rb +6 -4
  20. data/lib/rubocop/config_validator.rb +55 -95
  21. data/lib/rubocop/cop/autocorrect_logic.rb +7 -4
  22. data/lib/rubocop/cop/bundler/insecure_protocol_source.rb +2 -2
  23. data/lib/rubocop/cop/cop.rb +3 -1
  24. data/lib/rubocop/cop/gemspec/ordered_dependencies.rb +1 -1
  25. data/lib/rubocop/cop/generator.rb +3 -4
  26. data/lib/rubocop/cop/generator/configuration_injector.rb +1 -1
  27. data/lib/rubocop/cop/layout/array_alignment.rb +53 -10
  28. data/lib/rubocop/cop/layout/block_end_newline.rb +5 -3
  29. data/lib/rubocop/cop/layout/else_alignment.rb +8 -0
  30. data/lib/rubocop/cop/layout/empty_line_between_defs.rb +2 -1
  31. data/lib/rubocop/cop/layout/first_argument_indentation.rb +2 -2
  32. data/lib/rubocop/cop/layout/hash_alignment.rb +8 -4
  33. data/lib/rubocop/cop/layout/heredoc_indentation.rb +4 -4
  34. data/lib/rubocop/cop/layout/leading_comment_space.rb +33 -2
  35. data/lib/rubocop/cop/{metrics → layout}/line_length.rb +35 -79
  36. data/lib/rubocop/cop/layout/multiline_block_layout.rb +14 -5
  37. data/lib/rubocop/cop/layout/multiline_hash_brace_layout.rb +0 -4
  38. data/lib/rubocop/cop/layout/multiline_method_call_indentation.rb +1 -1
  39. data/lib/rubocop/cop/layout/space_around_operators.rb +49 -6
  40. data/lib/rubocop/cop/layout/space_before_block_braces.rb +17 -0
  41. data/lib/rubocop/cop/layout/space_before_first_arg.rb +8 -0
  42. data/lib/rubocop/cop/layout/space_inside_hash_literal_braces.rb +2 -9
  43. data/lib/rubocop/cop/lint/boolean_symbol.rb +12 -0
  44. data/lib/rubocop/cop/lint/debugger.rb +1 -1
  45. data/lib/rubocop/cop/lint/each_with_object_argument.rb +1 -1
  46. data/lib/rubocop/cop/lint/erb_new_arguments.rb +1 -1
  47. data/lib/rubocop/cop/lint/loop.rb +6 -4
  48. data/lib/rubocop/cop/lint/nested_method_definition.rb +2 -2
  49. data/lib/rubocop/cop/lint/non_deterministic_require_order.rb +89 -0
  50. data/lib/rubocop/cop/lint/raise_exception.rb +39 -0
  51. data/lib/rubocop/cop/lint/redundant_cop_disable_directive.rb +3 -3
  52. data/lib/rubocop/cop/lint/redundant_cop_enable_directive.rb +13 -8
  53. data/lib/rubocop/cop/lint/safe_navigation_chain.rb +1 -1
  54. data/lib/rubocop/cop/lint/struct_new_override.rb +58 -0
  55. data/lib/rubocop/cop/lint/suppressed_exception.rb +12 -22
  56. data/lib/rubocop/cop/lint/unused_method_argument.rb +32 -6
  57. data/lib/rubocop/cop/lint/useless_setter_call.rb +4 -0
  58. data/lib/rubocop/cop/migration/department_name.rb +47 -6
  59. data/lib/rubocop/cop/mixin/alignment.rb +1 -1
  60. data/lib/rubocop/cop/mixin/configurable_enforced_style.rb +4 -0
  61. data/lib/rubocop/cop/mixin/end_keyword_alignment.rb +6 -1
  62. data/lib/rubocop/cop/mixin/frozen_string_literal.rb +7 -7
  63. data/lib/rubocop/cop/mixin/hash_transform_method.rb +171 -0
  64. data/lib/rubocop/cop/mixin/line_length_help.rb +88 -0
  65. data/lib/rubocop/cop/mixin/method_complexity.rb +5 -0
  66. data/lib/rubocop/cop/mixin/rational_literal.rb +18 -0
  67. data/lib/rubocop/cop/mixin/statement_modifier.rb +2 -2
  68. data/lib/rubocop/cop/mixin/trailing_comma.rb +8 -12
  69. data/lib/rubocop/cop/naming/memoized_instance_variable_name.rb +1 -1
  70. data/lib/rubocop/cop/naming/method_name.rb +30 -0
  71. data/lib/rubocop/cop/naming/method_parameter_name.rb +1 -1
  72. data/lib/rubocop/cop/offense.rb +11 -0
  73. data/lib/rubocop/cop/registry.rb +7 -2
  74. data/lib/rubocop/cop/style/access_modifier_declarations.rb +26 -6
  75. data/lib/rubocop/cop/style/attr.rb +8 -0
  76. data/lib/rubocop/cop/style/block_delimiters.rb +60 -1
  77. data/lib/rubocop/cop/style/collection_methods.rb +2 -0
  78. data/lib/rubocop/cop/style/conditional_assignment.rb +2 -2
  79. data/lib/rubocop/cop/style/documentation.rb +43 -5
  80. data/lib/rubocop/cop/style/end_block.rb +6 -0
  81. data/lib/rubocop/cop/style/frozen_string_literal_comment.rb +89 -11
  82. data/lib/rubocop/cop/style/guard_clause.rb +3 -2
  83. data/lib/rubocop/cop/style/hash_each_methods.rb +89 -0
  84. data/lib/rubocop/cop/style/hash_transform_keys.rb +83 -0
  85. data/lib/rubocop/cop/style/hash_transform_values.rb +83 -0
  86. data/lib/rubocop/cop/style/if_unless_modifier.rb +38 -3
  87. data/lib/rubocop/cop/style/infinite_loop.rb +1 -1
  88. data/lib/rubocop/cop/style/inverse_methods.rb +9 -5
  89. data/lib/rubocop/cop/style/lambda.rb +1 -0
  90. data/lib/rubocop/cop/style/method_call_with_args_parentheses.rb +7 -205
  91. data/lib/rubocop/cop/style/method_call_with_args_parentheses/omit_parentheses.rb +169 -0
  92. data/lib/rubocop/cop/style/method_call_with_args_parentheses/require_parentheses.rb +54 -0
  93. data/lib/rubocop/cop/style/module_function.rb +56 -10
  94. data/lib/rubocop/cop/style/multiline_method_signature.rb +1 -1
  95. data/lib/rubocop/cop/style/multiline_when_then.rb +5 -1
  96. data/lib/rubocop/cop/style/nested_parenthesized_calls.rb +4 -4
  97. data/lib/rubocop/cop/style/numeric_predicate.rb +4 -3
  98. data/lib/rubocop/cop/style/one_line_conditional.rb +3 -2
  99. data/lib/rubocop/cop/style/or_assignment.rb +3 -2
  100. data/lib/rubocop/cop/style/percent_literal_delimiters.rb +7 -7
  101. data/lib/rubocop/cop/style/redundant_condition.rb +17 -4
  102. data/lib/rubocop/cop/style/redundant_sort.rb +2 -2
  103. data/lib/rubocop/cop/style/symbol_array.rb +2 -2
  104. data/lib/rubocop/cop/style/ternary_parentheses.rb +1 -1
  105. data/lib/rubocop/cop/style/trailing_comma_in_arguments.rb +34 -22
  106. data/lib/rubocop/cop/style/trailing_comma_in_array_literal.rb +41 -0
  107. data/lib/rubocop/cop/style/trailing_comma_in_block_args.rb +85 -0
  108. data/lib/rubocop/cop/style/trailing_comma_in_hash_literal.rb +44 -0
  109. data/lib/rubocop/cop/style/trailing_underscore_variable.rb +7 -1
  110. data/lib/rubocop/cop/style/while_until_modifier.rb +1 -1
  111. data/lib/rubocop/cop/style/yoda_condition.rb +16 -1
  112. data/lib/rubocop/cop/variable_force.rb +4 -1
  113. data/lib/rubocop/formatter/base_formatter.rb +2 -2
  114. data/lib/rubocop/formatter/clang_style_formatter.rb +1 -1
  115. data/lib/rubocop/formatter/formatter_set.rb +1 -0
  116. data/lib/rubocop/formatter/json_formatter.rb +6 -5
  117. data/lib/rubocop/formatter/junit_formatter.rb +74 -0
  118. data/lib/rubocop/formatter/tap_formatter.rb +1 -1
  119. data/lib/rubocop/node_pattern.rb +97 -11
  120. data/lib/rubocop/options.rb +8 -8
  121. data/lib/rubocop/processed_source.rb +1 -1
  122. data/lib/rubocop/result_cache.rb +2 -0
  123. data/lib/rubocop/rspec/shared_contexts.rb +5 -0
  124. data/lib/rubocop/runner.rb +5 -1
  125. data/lib/rubocop/target_ruby.rb +151 -0
  126. data/lib/rubocop/version.rb +1 -1
  127. metadata +38 -10
  128. data/lib/rubocop/cop/lint/end_in_method.rb +0 -40
  129. data/lib/rubocop/cop/style/braces_around_hash_parameters.rb +0 -209
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8789393bf78c1ae637e196f15a3b312a261b8239996ce92bcd99670ab358bea0
4
- data.tar.gz: 6b1e83fe89bcd3e003ea5f95307d212b3e5adce496ddc26dfe6ff92ea4dc3356
3
+ metadata.gz: af0dab74354064816d5756cb5a49ab7160c444292ef32e9ee7980dff8a18110f
4
+ data.tar.gz: 96288aa5f77f19813ef7cac495f7c86d912f3be28da021b01d30136a2ef28f99
5
5
  SHA512:
6
- metadata.gz: d0a92b3b466939337e7d100d255a9c08ff7db25c235c3645ad65e878151899000749a5e20b01eda2be3ec7e4384272cfed2dce12053dd87df4b01be83453c3d9
7
- data.tar.gz: d646dad7e86dcacd75a286f70c2843934acb9a7416a40edec51fa373d9f0b3da05f74eac21ad869c24b92b550e2efb66cdf0229dc6ef2fb772edc7a7a6ee5107
6
+ metadata.gz: 015244a9c6aff6e2d5640e68b286127944418221bb8c76db04273c5c35b5bc41e03bf7d85c44a3b630a0dd8a24f5a4531ddaf61adb0b75a0b39e2e6c2e08d8cf
7
+ data.tar.gz: 8e209ee81ebf1d5a3215292c7d7eddabaacb64e0fa1da7935372495ad13e5bdd896b7fd27fde25fc0e8ffaa7d1b0873f47c40f505d4828e23a52f0ca2ee847e6
@@ -1,4 +1,4 @@
1
- Copyright (c) 2012-19 Bozhidar Batsov
1
+ Copyright (c) 2012-20 Bozhidar Batsov
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -41,7 +41,7 @@ automatically fix some of the problems for you.
41
41
  $ gem install rubocop
42
42
  ```
43
43
 
44
- If you'd rather install RuboCop using `bundler`, don't require it in your `Gemfile`:
44
+ If you'd rather install RuboCop using `bundler`, add a line for it in your `Gemfile` (but set the `require` option to `false`, as it is a standalone tool):
45
45
 
46
46
  ```rb
47
47
  gem 'rubocop', require: false
@@ -53,7 +53,7 @@ haven't reached version 1.0 yet). To prevent an unwanted RuboCop update you
53
53
  might want to use a conservative version lock in your `Gemfile`:
54
54
 
55
55
  ```rb
56
- gem 'rubocop', '~> 0.77.0', require: false
56
+ gem 'rubocop', '~> 0.81.0', require: false
57
57
  ```
58
58
 
59
59
  ## Quickstart
@@ -213,5 +213,5 @@ RuboCop's changelog is available [here](CHANGELOG.md).
213
213
 
214
214
  ## Copyright
215
215
 
216
- Copyright (c) 2012-2019 Bozhidar Batsov. See [LICENSE.txt](LICENSE.txt) for
216
+ Copyright (c) 2012-2020 Bozhidar Batsov. See [LICENSE.txt](LICENSE.txt) for
217
217
  further details.
@@ -54,11 +54,13 @@ AllCops:
54
54
  - '**/Puppetfile'
55
55
  - '**/Rakefile'
56
56
  - '**/Snapfile'
57
+ - '**/Steepfile'
57
58
  - '**/Thorfile'
58
59
  - '**/Vagabondfile'
59
60
  - '**/Vagrantfile'
60
61
  Exclude:
61
62
  - 'node_modules/**/*'
63
+ - 'tmp/**/*'
62
64
  - 'vendor/**/*'
63
65
  - '.git/**/*'
64
66
  # Default formatter will be used if no `-f/--format` option is given.
@@ -196,9 +198,10 @@ Gemspec/RequiredRubyVersion:
196
198
  VersionAdded: '0.52'
197
199
  Include:
198
200
  - '**/*.gemspec'
199
- -
201
+
200
202
  Gemspec/RubyVersionGlobalsUsage:
201
203
  Description: Checks usage of RUBY_VERSION in gemspec.
204
+ StyleGuide: '#no-ruby-version-in-the-gemspec'
202
205
  Enabled: true
203
206
  VersionAdded: '0.72'
204
207
  Include:
@@ -252,10 +255,30 @@ Layout/ArrayAlignment:
252
255
  Description: >-
253
256
  Align the elements of an array literal if they span more than
254
257
  one line.
255
- StyleGuide: '#align-multiline-arrays'
258
+ StyleGuide: '#no-double-indent'
256
259
  Enabled: true
257
260
  VersionAdded: '0.49'
258
261
  VersionChanged: '0.77'
262
+ # Alignment of elements of a multi-line array.
263
+ #
264
+ # The `with_first_parameter` style aligns the following lines along the same
265
+ # column as the first element.
266
+ #
267
+ # array = [1, 2, 3,
268
+ # 4, 5, 6]
269
+ #
270
+ # The `with_fixed_indentation` style aligns the following lines with one
271
+ # level of indentation relative to the start of the line with start of array.
272
+ #
273
+ # array = [1, 2, 3,
274
+ # 4, 5, 6]
275
+ EnforcedStyle: with_first_element
276
+ SupportedStyles:
277
+ - with_first_element
278
+ - with_fixed_indentation
279
+ # By default, the indentation width from Layout/IndentationWidth is used
280
+ # But it can be overridden by setting this parameter
281
+ IndentationWidth: ~
259
282
 
260
283
  Layout/AssignmentIndentation:
261
284
  Description: >-
@@ -792,6 +815,7 @@ Layout/LeadingCommentSpace:
792
815
  VersionAdded: '0.49'
793
816
  VersionChanged: '0.73'
794
817
  AllowDoxygenCommentStyle: false
818
+ AllowGemfileRubyComment: false
795
819
 
796
820
  Layout/LeadingEmptyLines:
797
821
  Description: Check for unnecessary blank lines at the beginning of a file.
@@ -799,6 +823,29 @@ Layout/LeadingEmptyLines:
799
823
  VersionAdded: '0.57'
800
824
  VersionChanged: '0.77'
801
825
 
826
+ Layout/LineLength:
827
+ Description: 'Limit lines to 80 characters.'
828
+ StyleGuide: '#80-character-limits'
829
+ Enabled: true
830
+ VersionAdded: '0.25'
831
+ VersionChanged: '0.78'
832
+ AutoCorrect: false
833
+ Max: 80
834
+ # To make it possible to copy or click on URIs in the code, we allow lines
835
+ # containing a URI to be longer than Max.
836
+ AllowHeredoc: true
837
+ AllowURI: true
838
+ URISchemes:
839
+ - http
840
+ - https
841
+ # The IgnoreCopDirectives option causes the LineLength rule to ignore cop
842
+ # directives like '# rubocop: enable ...' when calculating a line's length.
843
+ IgnoreCopDirectives: true
844
+ # The IgnoredPatterns option is a list of !ruby/regexp and/or string
845
+ # elements. Strings will be converted to Regexp objects. A line that matches
846
+ # any regular expression listed in this option will be ignored by LineLength.
847
+ IgnoredPatterns: []
848
+
802
849
  Layout/MultilineArrayBraceLayout:
803
850
  Description: >-
804
851
  Checks that the closing brace in an array literal is
@@ -1042,6 +1089,10 @@ Layout/SpaceAroundOperators:
1042
1089
  # with an operator on the previous or next line, not counting empty lines
1043
1090
  # or comment lines.
1044
1091
  AllowForAlignment: true
1092
+ EnforcedStyleForExponentOperator: no_space
1093
+ SupportedStylesForExponentOperator:
1094
+ - space
1095
+ - no_space
1045
1096
 
1046
1097
  Layout/SpaceBeforeBlockBraces:
1047
1098
  Description: >-
@@ -1272,6 +1323,7 @@ Lint/BooleanSymbol:
1272
1323
  Description: 'Check for `:true` and `:false` symbols.'
1273
1324
  Enabled: true
1274
1325
  VersionAdded: '0.50'
1326
+ VersionChanged: '0.81'
1275
1327
 
1276
1328
  Lint/CircularArgumentReference:
1277
1329
  Description: "Default values in optional keyword arguments and optional ordinal arguments should not refer back to the name of the argument."
@@ -1344,11 +1396,6 @@ Lint/EmptyWhen:
1344
1396
  Enabled: true
1345
1397
  VersionAdded: '0.45'
1346
1398
 
1347
- Lint/EndInMethod:
1348
- Description: 'END blocks should not be placed inside method definitions.'
1349
- Enabled: true
1350
- VersionAdded: '0.9'
1351
-
1352
1399
  Lint/EnsureReturn:
1353
1400
  Description: 'Do not use return in an ensure block.'
1354
1401
  StyleGuide: '#no-return-ensure'
@@ -1471,6 +1518,12 @@ Lint/NextWithoutAccumulator:
1471
1518
  Enabled: true
1472
1519
  VersionAdded: '0.36'
1473
1520
 
1521
+ Lint/NonDeterministicRequireOrder:
1522
+ Description: 'Always sort arrays returned by Dir.glob when requiring files.'
1523
+ Enabled: true
1524
+ VersionAdded: '0.78'
1525
+ Safe: false
1526
+
1474
1527
  Lint/NonLocalExitFromIterator:
1475
1528
  Description: 'Do not use return in iterator to cause non-local exit.'
1476
1529
  Enabled: true
@@ -1509,6 +1562,12 @@ Lint/PercentSymbolArray:
1509
1562
  Enabled: true
1510
1563
  VersionAdded: '0.41'
1511
1564
 
1565
+ Lint/RaiseException:
1566
+ Description: Checks for `raise` or `fail` statements which are raising `Exception` class.
1567
+ StyleGuide: '#raise-exception'
1568
+ Enabled: pending
1569
+ VersionAdded: '0.81'
1570
+
1512
1571
  Lint/RandOne:
1513
1572
  Description: >-
1514
1573
  Checks for `rand(1)` calls. Such calls always return `0`
@@ -1537,7 +1596,7 @@ Lint/RedundantRequireStatement:
1537
1596
  Lint/RedundantSplatExpansion:
1538
1597
  Description: 'Checks for splat unnecessarily being called on literals.'
1539
1598
  Enabled: true
1540
- VersionChanged: '0.76'
1599
+ VersionAdded: '0.76'
1541
1600
 
1542
1601
  Lint/RedundantStringCoercion:
1543
1602
  Description: 'Checks for Object#to_s usage in string interpolation.'
@@ -1651,13 +1710,18 @@ Lint/ShadowingOuterLocalVariable:
1651
1710
  Enabled: true
1652
1711
  VersionAdded: '0.9'
1653
1712
 
1713
+ Lint/StructNewOverride:
1714
+ Description: 'Disallow overriding the `Struct` built-in methods via `Struct.new`.'
1715
+ Enabled: pending
1716
+ VersionAdded: '0.81'
1717
+
1654
1718
  Lint/SuppressedException:
1655
1719
  Description: "Don't suppress exceptions."
1656
1720
  StyleGuide: '#dont-hide-exceptions'
1657
1721
  Enabled: true
1658
- AllowComments: false
1722
+ AllowComments: true
1659
1723
  VersionAdded: '0.9'
1660
- VersionChanged: '0.77'
1724
+ VersionChanged: '0.81'
1661
1725
 
1662
1726
  Lint/Syntax:
1663
1727
  Description: 'Checks syntax error.'
@@ -1668,6 +1732,7 @@ Lint/Syntax:
1668
1732
  Lint/ToJSON:
1669
1733
  Description: 'Ensure #to_json includes an optional argument.'
1670
1734
  Enabled: true
1735
+ VersionAdded: '0.66'
1671
1736
 
1672
1737
  Lint/UnderscorePrefixedVariableName:
1673
1738
  Description: 'Do not use prefix `_` for a variable that is used.'
@@ -1699,9 +1764,10 @@ Lint/UnusedMethodArgument:
1699
1764
  StyleGuide: '#underscore-unused-vars'
1700
1765
  Enabled: true
1701
1766
  VersionAdded: '0.21'
1702
- VersionChanged: '0.35'
1767
+ VersionChanged: '0.81'
1703
1768
  AllowUnusedKeywordArguments: false
1704
1769
  IgnoreEmptyMethods: true
1770
+ IgnoreNotImplementedMethods: true
1705
1771
 
1706
1772
  Lint/UriEscapeUnescape:
1707
1773
  Description: >-
@@ -1747,6 +1813,8 @@ Lint/UselessSetterCall:
1747
1813
  Description: 'Checks for useless setter call to a local variable.'
1748
1814
  Enabled: true
1749
1815
  VersionAdded: '0.13'
1816
+ VersionChanged: '0.80'
1817
+ Safe: false
1750
1818
 
1751
1819
  Lint/Void:
1752
1820
  Description: 'Possible use of operator/literal/variable in void context.'
@@ -1765,9 +1833,10 @@ Metrics/AbcSize:
1765
1833
  - https://en.wikipedia.org/wiki/ABC_Software_Metric
1766
1834
  Enabled: true
1767
1835
  VersionAdded: '0.27'
1768
- VersionChanged: '0.66'
1836
+ VersionChanged: '0.81'
1769
1837
  # The ABC size is a calculated magnitude, so this number can be an Integer or
1770
1838
  # a Float.
1839
+ IgnoredMethods: []
1771
1840
  Max: 15
1772
1841
 
1773
1842
  Metrics/BlockLength:
@@ -1807,31 +1876,10 @@ Metrics/CyclomaticComplexity:
1807
1876
  of test cases needed to validate a method.
1808
1877
  Enabled: true
1809
1878
  VersionAdded: '0.25'
1879
+ VersionChanged: '0.81'
1880
+ IgnoredMethods: []
1810
1881
  Max: 6
1811
1882
 
1812
- Metrics/LineLength:
1813
- Description: 'Limit lines to 80 characters.'
1814
- StyleGuide: '#80-character-limits'
1815
- Enabled: true
1816
- VersionAdded: '0.25'
1817
- VersionChanged: '0.68'
1818
- AutoCorrect: false
1819
- Max: 80
1820
- # To make it possible to copy or click on URIs in the code, we allow lines
1821
- # containing a URI to be longer than Max.
1822
- AllowHeredoc: true
1823
- AllowURI: true
1824
- URISchemes:
1825
- - http
1826
- - https
1827
- # The IgnoreCopDirectives option causes the LineLength rule to ignore cop
1828
- # directives like '# rubocop: enable ...' when calculating a line's length.
1829
- IgnoreCopDirectives: true
1830
- # The IgnoredPatterns option is a list of !ruby/regexp and/or string
1831
- # elements. Strings will be converted to Regexp objects. A line that matches
1832
- # any regular expression listed in this option will be ignored by LineLength.
1833
- IgnoredPatterns: []
1834
-
1835
1883
  Metrics/MethodLength:
1836
1884
  Description: 'Avoid methods longer than 10 lines of code.'
1837
1885
  StyleGuide: '#short-methods'
@@ -1863,6 +1911,8 @@ Metrics/PerceivedComplexity:
1863
1911
  human reader.
1864
1912
  Enabled: true
1865
1913
  VersionAdded: '0.25'
1914
+ VersionChanged: '0.81'
1915
+ IgnoredMethods: []
1866
1916
  Max: 7
1867
1917
 
1868
1918
  ################## Migration #############################
@@ -1871,7 +1921,8 @@ Migration/DepartmentName:
1871
1921
  Description: >-
1872
1922
  Check that cop names in rubocop:disable (etc) comments are
1873
1923
  given with department name.
1874
- Enabled: false
1924
+ Enabled: true
1925
+ VersionAdded: '0.75'
1875
1926
 
1876
1927
  #################### Naming ##############################
1877
1928
 
@@ -2053,6 +2104,7 @@ Naming/MethodParameterName:
2053
2104
  - ip
2054
2105
  - db
2055
2106
  - os
2107
+ - pp
2056
2108
  # Forbidden names that will register an offense
2057
2109
  ForbiddenNames: []
2058
2110
 
@@ -2161,10 +2213,12 @@ Style/AccessModifierDeclarations:
2161
2213
  Description: 'Checks style of how access modifiers are used.'
2162
2214
  Enabled: true
2163
2215
  VersionAdded: '0.57'
2216
+ VersionChanged: '0.81'
2164
2217
  EnforcedStyle: group
2165
2218
  SupportedStyles:
2166
2219
  - inline
2167
2220
  - group
2221
+ AllowModifiersOnSymbols: true
2168
2222
 
2169
2223
  Style/Alias:
2170
2224
  Description: 'Use alias instead of alias_method.'
@@ -2343,24 +2397,12 @@ Style/BlockDelimiters:
2343
2397
  # # also good
2344
2398
  # collection.each do |element| puts element end
2345
2399
  AllowBracesOnProceduralOneLiners: false
2346
-
2347
- Style/BracesAroundHashParameters:
2348
- Description: 'Enforce braces style around hash parameters.'
2349
- Enabled: true
2350
- VersionAdded: '0.14.1'
2351
- VersionChanged: '0.28'
2352
- EnforcedStyle: no_braces
2353
- SupportedStyles:
2354
- # The `braces` style enforces braces around all method parameters that are
2355
- # hashes.
2356
- - braces
2357
- # The `no_braces` style checks that the last parameter doesn't have braces
2358
- # around it.
2359
- - no_braces
2360
- # The `context_dependent` style checks that the last parameter doesn't have
2361
- # braces around it, but requires braces if the second to last parameter is
2362
- # also a hash literal.
2363
- - context_dependent
2400
+ # The BracesRequiredMethods overrides all other configurations except
2401
+ # IgnoredMethods. It can be used to enforce that all blocks for specific
2402
+ # methods use braces. For example, you can use this to enforce Sorbet
2403
+ # signatures use braces even when the rest of your codebase enforces
2404
+ # the `line_count_based` style.
2405
+ BracesRequiredMethods: []
2364
2406
 
2365
2407
  Style/CaseEquality:
2366
2408
  Description: 'Avoid explicit use of the case equality operator(===).'
@@ -2430,7 +2472,7 @@ Style/ClassVars:
2430
2472
  # Align with the style guide.
2431
2473
  Style/CollectionMethods:
2432
2474
  Description: 'Preferred collection methods.'
2433
- StyleGuide: '#map-find-select-reduce-size'
2475
+ StyleGuide: '#map-find-select-reduce-include-size'
2434
2476
  Enabled: false
2435
2477
  VersionAdded: '0.9'
2436
2478
  VersionChanged: '0.27'
@@ -2447,6 +2489,7 @@ Style/CollectionMethods:
2447
2489
  inject: 'reduce'
2448
2490
  detect: 'find'
2449
2491
  find_all: 'select'
2492
+ member?: 'include?'
2450
2493
 
2451
2494
  Style/ColonMethodCall:
2452
2495
  Description: 'Do not use :: for method call.'
@@ -2672,6 +2715,7 @@ Style/EndBlock:
2672
2715
  StyleGuide: '#no-END-blocks'
2673
2716
  Enabled: true
2674
2717
  VersionAdded: '0.9'
2718
+ VersionChanged: '0.81'
2675
2719
 
2676
2720
  Style/EvalWithLocation:
2677
2721
  Description: 'Pass `__FILE__` and `__LINE__` to `eval` method, as they are used by backtraces.'
@@ -2746,7 +2790,7 @@ Style/FrozenStringLiteralComment:
2746
2790
  to help transition to frozen string literals by default.
2747
2791
  Enabled: true
2748
2792
  VersionAdded: '0.36'
2749
- VersionChanged: '0.69'
2793
+ VersionChanged: '0.79'
2750
2794
  EnforcedStyle: always
2751
2795
  SupportedStyles:
2752
2796
  # `always` will always add the frozen string literal comment to a file
@@ -2754,9 +2798,14 @@ Style/FrozenStringLiteralComment:
2754
2798
  # string literal. If you run code against multiple versions of Ruby, it is
2755
2799
  # possible that this will create errors in Ruby 2.3.0+.
2756
2800
  - always
2801
+ # `always_true` will add the frozen string literal comment to a file,
2802
+ # similarly to the `always` style, but will also change any disabled
2803
+ # comments (e.g. `# frozen_string_literal: false`) to be enabled.
2804
+ - always_true
2757
2805
  # `never` will enforce that the frozen string literal comment does not
2758
2806
  # exist in a file.
2759
2807
  - never
2808
+ Safe: false
2760
2809
 
2761
2810
  Style/GlobalVars:
2762
2811
  Description: 'Do not introduce global variables.'
@@ -2777,6 +2826,13 @@ Style/GuardClause:
2777
2826
  # needs to have to trigger this cop
2778
2827
  MinBodyLength: 1
2779
2828
 
2829
+ Style/HashEachMethods:
2830
+ Description: 'Use Hash#each_key and Hash#each_value.'
2831
+ StyleGuide: '#hash-each'
2832
+ Enabled: pending
2833
+ VersionAdded: '0.80'
2834
+ Safe: false
2835
+
2780
2836
  Style/HashSyntax:
2781
2837
  Description: >-
2782
2838
  Prefer Ruby 1.9 hash syntax { a: 1, b: 2 } over 1.8 syntax
@@ -2800,6 +2856,18 @@ Style/HashSyntax:
2800
2856
  # Do not suggest { a?: 1 } over { :a? => 1 } in ruby19 style
2801
2857
  PreferHashRocketsForNonAlnumEndingSymbols: false
2802
2858
 
2859
+ Style/HashTransformKeys:
2860
+ Description: 'Prefer `transform_keys` over `each_with_object` and `map`.'
2861
+ Enabled: 'pending'
2862
+ VersionAdded: '0.80'
2863
+ Safe: false
2864
+
2865
+ Style/HashTransformValues:
2866
+ Description: 'Prefer `transform_values` over `each_with_object` and `map`.'
2867
+ Enabled: 'pending'
2868
+ VersionAdded: '0.80'
2869
+ Safe: false
2870
+
2803
2871
  Style/IdenticalConditionalBranches:
2804
2872
  Description: >-
2805
2873
  Checks that conditional statements do not have an identical
@@ -2908,7 +2976,7 @@ Style/LambdaCall:
2908
2976
  Description: 'Use lambda.call(...) instead of lambda.(...).'
2909
2977
  StyleGuide: '#proc-call'
2910
2978
  Enabled: true
2911
- VersionAdded: '0.13.1'
2979
+ VersionAdded: '0.13'
2912
2980
  VersionChanged: '0.14'
2913
2981
  EnforcedStyle: call
2914
2982
  SupportedStyles:
@@ -3038,6 +3106,7 @@ Style/ModuleFunction:
3038
3106
  SupportedStyles:
3039
3107
  - module_function
3040
3108
  - extend_self
3109
+ - forbidden
3041
3110
  Autocorrect: false
3042
3111
  SafeAutoCorrect: false
3043
3112
 
@@ -3777,22 +3846,29 @@ Style/TrailingCommaInArrayLiteral:
3777
3846
  StyleGuide: '#no-trailing-array-commas'
3778
3847
  Enabled: true
3779
3848
  VersionAdded: '0.53'
3849
+ # If `comma`, the cop requires a comma after the last item in an array,
3780
3850
  # but only when each item is on its own line.
3781
3851
  # If `consistent_comma`, the cop requires a comma after the last item of all
3782
- # non-empty array literals.
3852
+ # non-empty, multiline array literals.
3783
3853
  EnforcedStyleForMultiline: no_comma
3784
3854
  SupportedStylesForMultiline:
3785
3855
  - comma
3786
3856
  - consistent_comma
3787
3857
  - no_comma
3788
3858
 
3859
+ Style/TrailingCommaInBlockArgs:
3860
+ Description: 'Checks for useless trailing commas in block arguments.'
3861
+ Enabled: false
3862
+ Safe: false
3863
+ VersionAdded: '0.81'
3864
+
3789
3865
  Style/TrailingCommaInHashLiteral:
3790
3866
  Description: 'Checks for trailing comma in hash literals.'
3791
3867
  Enabled: true
3792
3868
  # If `comma`, the cop requires a comma after the last item in a hash,
3793
3869
  # but only when each item is on its own line.
3794
3870
  # If `consistent_comma`, the cop requires a comma after the last item of all
3795
- # non-empty hash literals.
3871
+ # non-empty, multiline hash literals.
3796
3872
  EnforcedStyleForMultiline: no_comma
3797
3873
  SupportedStylesForMultiline:
3798
3874
  - comma
@@ -3842,7 +3918,7 @@ Style/TrivialAccessors:
3842
3918
  # Commonly used in DSLs
3843
3919
  AllowDSLWriters: false
3844
3920
  IgnoreClassMethods: false
3845
- AllowedMethod:
3921
+ AllowedMethods:
3846
3922
  - to_ary
3847
3923
  - to_a
3848
3924
  - to_c