rbhint 0.85.1.rc2 → 0.87.1.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (148) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +9 -1
  3. data/bin/rubocop-profile +16 -0
  4. data/config/default.yml +118 -10
  5. data/lib/rbhint/version.rb +1 -1
  6. data/lib/rubocop.rb +15 -1
  7. data/lib/rubocop/cli.rb +0 -2
  8. data/lib/rubocop/cli/command/auto_genenerate_config.rb +40 -5
  9. data/lib/rubocop/cli/command/init_dotfile.rb +1 -1
  10. data/lib/rubocop/cli/command/show_cops.rb +1 -1
  11. data/lib/rubocop/config_loader.rb +24 -66
  12. data/lib/rubocop/config_obsoletion.rb +0 -1
  13. data/lib/rubocop/cop/autocorrect_logic.rb +14 -24
  14. data/lib/rubocop/cop/badge.rb +1 -1
  15. data/lib/rubocop/cop/base.rb +407 -0
  16. data/lib/rubocop/cop/bundler/insecure_protocol_source.rb +10 -20
  17. data/lib/rubocop/cop/commissioner.rb +48 -50
  18. data/lib/rubocop/cop/cop.rb +85 -236
  19. data/lib/rubocop/cop/corrector.rb +38 -115
  20. data/lib/rubocop/cop/correctors/multiline_literal_brace_corrector.rb +26 -0
  21. data/lib/rubocop/cop/gemspec/required_ruby_version.rb +6 -1
  22. data/lib/rubocop/cop/gemspec/ruby_version_globals_usage.rb +1 -1
  23. data/lib/rubocop/cop/generator.rb +1 -1
  24. data/lib/rubocop/cop/internal_affairs/node_type_predicate.rb +11 -14
  25. data/lib/rubocop/cop/layout/case_indentation.rb +18 -19
  26. data/lib/rubocop/cop/layout/class_structure.rb +2 -37
  27. data/lib/rubocop/cop/layout/empty_lines_around_access_modifier.rb +1 -0
  28. data/lib/rubocop/cop/layout/empty_lines_around_attribute_accessor.rb +1 -8
  29. data/lib/rubocop/cop/layout/end_alignment.rb +3 -2
  30. data/lib/rubocop/cop/layout/first_argument_indentation.rb +4 -0
  31. data/lib/rubocop/cop/layout/hash_alignment.rb +1 -2
  32. data/lib/rubocop/cop/layout/multiline_block_layout.rb +17 -7
  33. data/lib/rubocop/cop/layout/space_around_block_parameters.rb +22 -27
  34. data/lib/rubocop/cop/layout/space_around_method_call_operator.rb +27 -68
  35. data/lib/rubocop/cop/layout/space_inside_array_literal_brackets.rb +3 -2
  36. data/lib/rubocop/cop/legacy/corrections_proxy.rb +49 -0
  37. data/lib/rubocop/cop/legacy/corrector.rb +29 -0
  38. data/lib/rubocop/cop/lint/deprecated_open_ssl_constant.rb +4 -4
  39. data/lib/rubocop/cop/lint/duplicate_elsif_condition.rb +39 -0
  40. data/lib/rubocop/cop/lint/duplicate_methods.rb +2 -2
  41. data/lib/rubocop/cop/lint/implicit_string_concatenation.rb +3 -2
  42. data/lib/rubocop/cop/lint/interpolation_check.rb +13 -0
  43. data/lib/rubocop/cop/lint/literal_as_condition.rb +11 -1
  44. data/lib/rubocop/cop/lint/nested_method_definition.rb +14 -20
  45. data/lib/rubocop/cop/lint/non_deterministic_require_order.rb +2 -2
  46. data/lib/rubocop/cop/lint/parentheses_as_grouped_expression.rb +8 -3
  47. data/lib/rubocop/cop/lint/raise_exception.rb +8 -0
  48. data/lib/rubocop/cop/lint/rand_one.rb +1 -1
  49. data/lib/rubocop/cop/lint/redundant_cop_disable_directive.rb +27 -23
  50. data/lib/rubocop/cop/lint/redundant_splat_expansion.rb +2 -2
  51. data/lib/rubocop/cop/lint/regexp_as_condition.rb +6 -0
  52. data/lib/rubocop/cop/lint/safe_navigation_with_empty.rb +8 -0
  53. data/lib/rubocop/cop/lint/syntax.rb +11 -26
  54. data/lib/rubocop/cop/lint/unused_method_argument.rb +1 -1
  55. data/lib/rubocop/cop/lint/useless_access_modifier.rb +1 -1
  56. data/lib/rubocop/cop/metrics/block_length.rb +24 -2
  57. data/lib/rubocop/cop/metrics/block_nesting.rb +1 -1
  58. data/lib/rubocop/cop/metrics/class_length.rb +26 -3
  59. data/lib/rubocop/cop/metrics/cyclomatic_complexity.rb +1 -1
  60. data/lib/rubocop/cop/metrics/method_length.rb +24 -1
  61. data/lib/rubocop/cop/metrics/module_length.rb +26 -3
  62. data/lib/rubocop/cop/metrics/parameter_lists.rb +1 -1
  63. data/lib/rubocop/cop/metrics/perceived_complexity.rb +3 -3
  64. data/lib/rubocop/cop/metrics/utils/code_length_calculator.rb +129 -0
  65. data/lib/rubocop/cop/mixin/allowed_methods.rb +19 -0
  66. data/lib/rubocop/cop/mixin/auto_corrector.rb +12 -0
  67. data/lib/rubocop/cop/mixin/code_length.rb +4 -0
  68. data/lib/rubocop/cop/mixin/configurable_formatting.rb +1 -1
  69. data/lib/rubocop/cop/mixin/enforce_superclass.rb +3 -1
  70. data/lib/rubocop/cop/mixin/nil_methods.rb +3 -5
  71. data/lib/rubocop/cop/mixin/ordered_gem_node.rb +6 -1
  72. data/lib/rubocop/cop/mixin/statement_modifier.rb +3 -3
  73. data/lib/rubocop/cop/mixin/surrounding_space.rb +7 -2
  74. data/lib/rubocop/cop/mixin/too_many_lines.rb +3 -13
  75. data/lib/rubocop/cop/mixin/uncommunicative_name.rb +4 -2
  76. data/lib/rubocop/cop/mixin/visibility_help.rb +50 -0
  77. data/lib/rubocop/cop/naming/ascii_identifiers.rb +27 -4
  78. data/lib/rubocop/cop/naming/binary_operator_parameter_name.rb +2 -2
  79. data/lib/rubocop/cop/naming/method_name.rb +1 -1
  80. data/lib/rubocop/cop/naming/method_parameter_name.rb +1 -1
  81. data/lib/rubocop/cop/naming/predicate_name.rb +3 -5
  82. data/lib/rubocop/cop/naming/variable_name.rb +1 -1
  83. data/lib/rubocop/cop/naming/variable_number.rb +1 -1
  84. data/lib/rubocop/cop/offense.rb +16 -2
  85. data/lib/rubocop/cop/style/accessor_grouping.rb +147 -0
  86. data/lib/rubocop/cop/style/array_coercion.rb +63 -0
  87. data/lib/rubocop/cop/style/auto_resource_cleanup.rb +3 -2
  88. data/lib/rubocop/cop/style/bisected_attr_accessor.rb +146 -0
  89. data/lib/rubocop/cop/style/case_like_if.rb +217 -0
  90. data/lib/rubocop/cop/style/class_vars.rb +21 -0
  91. data/lib/rubocop/cop/style/commented_keyword.rb +5 -2
  92. data/lib/rubocop/cop/style/conditional_assignment.rb +1 -1
  93. data/lib/rubocop/cop/style/date_time.rb +1 -1
  94. data/lib/rubocop/cop/style/dir.rb +2 -2
  95. data/lib/rubocop/cop/style/empty_literal.rb +5 -5
  96. data/lib/rubocop/cop/style/expand_path_arguments.rb +2 -2
  97. data/lib/rubocop/cop/style/exponential_notation.rb +6 -8
  98. data/lib/rubocop/cop/style/float_division.rb +7 -10
  99. data/lib/rubocop/cop/style/format_string_token.rb +5 -5
  100. data/lib/rubocop/cop/style/hash_as_last_array_item.rb +62 -0
  101. data/lib/rubocop/cop/style/hash_like_case.rb +76 -0
  102. data/lib/rubocop/cop/style/if_unless_modifier.rb +11 -11
  103. data/lib/rubocop/cop/style/if_unless_modifier_of_if_unless.rb +12 -0
  104. data/lib/rubocop/cop/style/missing_else.rb +1 -11
  105. data/lib/rubocop/cop/style/multiline_block_chain.rb +10 -1
  106. data/lib/rubocop/cop/style/mutable_constant.rb +4 -4
  107. data/lib/rubocop/cop/style/nested_parenthesized_calls.rb +2 -5
  108. data/lib/rubocop/cop/style/numeric_predicate.rb +3 -4
  109. data/lib/rubocop/cop/style/parallel_assignment.rb +3 -3
  110. data/lib/rubocop/cop/style/proc.rb +1 -1
  111. data/lib/rubocop/cop/style/random_with_offset.rb +4 -10
  112. data/lib/rubocop/cop/style/redundant_assignment.rb +117 -0
  113. data/lib/rubocop/cop/style/redundant_exception.rb +14 -10
  114. data/lib/rubocop/cop/style/redundant_fetch_block.rb +122 -0
  115. data/lib/rubocop/cop/style/redundant_file_extension_in_require.rb +50 -0
  116. data/lib/rubocop/cop/style/redundant_freeze.rb +1 -1
  117. data/lib/rubocop/cop/style/redundant_parentheses.rb +7 -1
  118. data/lib/rubocop/cop/style/redundant_regexp_character_class.rb +2 -1
  119. data/lib/rubocop/cop/style/redundant_regexp_escape.rb +2 -2
  120. data/lib/rubocop/cop/style/redundant_sort.rb +3 -2
  121. data/lib/rubocop/cop/style/rescue_standard_error.rb +1 -1
  122. data/lib/rubocop/cop/style/signal_exception.rb +1 -1
  123. data/lib/rubocop/cop/style/stabby_lambda_parentheses.rb +3 -2
  124. data/lib/rubocop/cop/style/stderr_puts.rb +1 -1
  125. data/lib/rubocop/cop/style/struct_inheritance.rb +2 -2
  126. data/lib/rubocop/cop/style/symbol_proc.rb +1 -1
  127. data/lib/rubocop/cop/style/trailing_method_end_statement.rb +9 -32
  128. data/lib/rubocop/cop/style/trivial_accessors.rb +8 -7
  129. data/lib/rubocop/cop/style/yoda_condition.rb +18 -1
  130. data/lib/rubocop/cop/style/zero_length_predicate.rb +2 -2
  131. data/lib/rubocop/cop/team.rb +97 -81
  132. data/lib/rubocop/cop/utils/format_string.rb +1 -2
  133. data/lib/rubocop/cop/variable_force/variable.rb +5 -3
  134. data/lib/rubocop/file_finder.rb +4 -4
  135. data/lib/rubocop/formatter/disabled_config_formatter.rb +1 -1
  136. data/lib/rubocop/name_similarity.rb +1 -3
  137. data/lib/rubocop/options.rb +15 -8
  138. data/lib/rubocop/path_util.rb +2 -17
  139. data/lib/rubocop/rake_task.rb +6 -9
  140. data/lib/rubocop/result_cache.rb +9 -5
  141. data/lib/rubocop/rspec/cop_helper.rb +4 -4
  142. data/lib/rubocop/rspec/expect_offense.rb +52 -22
  143. data/lib/rubocop/rspec/shared_contexts.rb +8 -8
  144. data/lib/rubocop/runner.rb +33 -32
  145. data/lib/rubocop/target_ruby.rb +1 -1
  146. data/lib/rubocop/version.rb +1 -1
  147. metadata +25 -8
  148. data/lib/rubocop/cop/mixin/classish_length.rb +0 -37
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 575dc4f99f17504f68d1e06e7be4a0f50086cd89096bfeac5e0c5182aa46912a
4
- data.tar.gz: 78d0d28fb807ce20c1faf65cb98b334dd1b485c689ddcb180e1caf75168c87b2
3
+ metadata.gz: 453ee199166e2d56989dd915a4979ffc0f549756d77a1661a47bf2f3697f4e31
4
+ data.tar.gz: dc18a22216a7c263d578c4af69306f54367fcada023749ad4d7aad509953bcaa
5
5
  SHA512:
6
- metadata.gz: 898979dd42750d133f7f00c0ebd27616b6aaf02a5bb89dbae9c199467a8225e10c9eb35256ebd19a66a71b7e1bcff3323604ab1c196be61d121a456aab8f795b
7
- data.tar.gz: f406066ffa12d88b7741578f2d78fbcce59da7ddfaee360e8941eb591a11dee985d6eaa23a677abf6ceab97fe63b220f0426c26d0a1e14d061612c7e146e4d8f
6
+ metadata.gz: '08a0025cc56a80479461b6fa606a39e89d7be83528c373388f90ac692f4cb5d60f2e1227dd41b972b070423a6b7ad4054fe16d30b6a5cd47c8efd79e868407b0'
7
+ data.tar.gz: 6c601ee392a79720f1ab745a01d9f84fd2a4e60372d0a4cfd27947a4e0a67f75670046c274d2005ff57d63a5aeab784303d302f01ac1d1b4390f13f9ff8490dc
data/README.md CHANGED
@@ -40,7 +40,7 @@ haven't reached version 1.0 yet). To prevent an unwanted RbHint update you
40
40
  might want to use a conservative version lock in your `Gemfile`:
41
41
 
42
42
  ```rb
43
- gem 'rbhint', '~> 0.85.0', require: false
43
+ gem 'rbhint', '~> 0.87.1', require: false
44
44
  ```
45
45
 
46
46
  ## Quickstart
@@ -65,6 +65,14 @@ RbHint supports the following Ruby implementations:
65
65
 
66
66
  See [compatibility](https://docs.rubocop.org/rubocop/compatibility.html) for further details.
67
67
 
68
+ ## Readme Badge
69
+
70
+ If you use RuboCop in your project, you can include one of these badges in your readme to let people know that your code is written following the community Ruby Style Guide.
71
+
72
+ [![Ruby Style Guide](https://img.shields.io/badge/code_style-rubocop-brightgreen.svg)](https://github.com/rubocop-hq/rubocop)
73
+
74
+ [![Ruby Style Guide](https://img.shields.io/badge/code_style-community-brightgreen.svg)](https://rubystyle.guide)
75
+
68
76
  ## Team
69
77
 
70
78
  Currently, `rbhint` is maintained by [Zee Spencer](https://github.com/zspencer).
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'stackprof'
5
+
6
+ StackProf.start
7
+ start = Process.clock_gettime(Process::CLOCK_MONOTONIC)
8
+ begin
9
+ load "#{__dir__}/../exe/rubocop"
10
+ ensure
11
+ delta = Process.clock_gettime(Process::CLOCK_MONOTONIC) - start
12
+ StackProf.stop
13
+ Dir.mkdir('tmp') unless File.exist?('tmp')
14
+ StackProf.results('tmp/stackprof.dump')
15
+ puts "Finished in #{delta.round(1)} seconds"
16
+ end
@@ -180,6 +180,9 @@ Bundler/OrderedGems:
180
180
  VersionAdded: '0.46'
181
181
  VersionChanged: '0.47'
182
182
  TreatCommentsAsGroupSeparators: true
183
+ # By default, "-" and "_" are ignored for order purposes.
184
+ # This can be overridden by setting this parameter to true.
185
+ ConsiderPunctuation: false
183
186
  Include:
184
187
  - '**/*.gemfile'
185
188
  - '**/Gemfile'
@@ -200,6 +203,9 @@ Gemspec/OrderedDependencies:
200
203
  Enabled: true
201
204
  VersionAdded: '0.51'
202
205
  TreatCommentsAsGroupSeparators: true
206
+ # By default, "-" and "_" are ignored for order purposes.
207
+ # This can be overridden by setting this parameter to true.
208
+ ConsiderPunctuation: false
203
209
  Include:
204
210
  - '**/*.gemspec'
205
211
 
@@ -1397,6 +1403,11 @@ Lint/DuplicateCaseCondition:
1397
1403
  Enabled: true
1398
1404
  VersionAdded: '0.45'
1399
1405
 
1406
+ Lint/DuplicateElsifCondition:
1407
+ Description: 'Do not repeat conditions used in if `elsif`.'
1408
+ Enabled: 'pending'
1409
+ VersionAdded: '0.88'
1410
+
1400
1411
  Lint/DuplicateHashKey:
1401
1412
  Description: 'Check for duplicate keys in hash literals.'
1402
1413
  Enabled: true
@@ -1508,7 +1519,9 @@ Lint/InheritException:
1508
1519
  Lint/InterpolationCheck:
1509
1520
  Description: 'Raise warning for interpolation in single q strs.'
1510
1521
  Enabled: true
1522
+ SafeAutoCorrect: false
1511
1523
  VersionAdded: '0.50'
1524
+ VersionChanged: '0.87'
1512
1525
 
1513
1526
  Lint/LiteralAsCondition:
1514
1527
  Description: 'Checks of literals used in conditions.'
@@ -1620,7 +1633,9 @@ Lint/RaiseException:
1620
1633
  Description: Checks for `raise` or `fail` statements which are raising `Exception` class.
1621
1634
  StyleGuide: '#raise-exception'
1622
1635
  Enabled: pending
1636
+ Safe: false
1623
1637
  VersionAdded: '0.81'
1638
+ VersionChanged: '0.86'
1624
1639
  AllowedImplicitNamespaces:
1625
1640
  - 'Gem'
1626
1641
 
@@ -1677,6 +1692,7 @@ Lint/RegexpAsCondition:
1677
1692
  The regexp literal matches `$_` implicitly.
1678
1693
  Enabled: true
1679
1694
  VersionAdded: '0.51'
1695
+ VersionChanged: '0.86'
1680
1696
 
1681
1697
  Lint/RequireParentheses:
1682
1698
  Description: >-
@@ -1733,6 +1749,7 @@ Lint/SafeNavigationWithEmpty:
1733
1749
  Description: 'Avoid `foo&.empty?` in conditionals.'
1734
1750
  Enabled: true
1735
1751
  VersionAdded: '0.62'
1752
+ VersionChanged: '0.87'
1736
1753
 
1737
1754
  Lint/ScriptPermission:
1738
1755
  Description: 'Grant script file execute permission.'
@@ -1899,9 +1916,10 @@ Metrics/BlockLength:
1899
1916
  Description: 'Avoid long blocks with many lines.'
1900
1917
  Enabled: true
1901
1918
  VersionAdded: '0.44'
1902
- VersionChanged: '0.66'
1919
+ VersionChanged: '0.87'
1903
1920
  CountComments: false # count full line comments?
1904
1921
  Max: 25
1922
+ CountAsOne: []
1905
1923
  ExcludedMethods:
1906
1924
  # By default, exclude the `#refine` method, as it tends to have larger
1907
1925
  # associated blocks.
@@ -1922,8 +1940,10 @@ Metrics/ClassLength:
1922
1940
  Description: 'Avoid classes longer than 100 lines of code.'
1923
1941
  Enabled: true
1924
1942
  VersionAdded: '0.25'
1943
+ VersionChanged: '0.87'
1925
1944
  CountComments: false # count full line comments?
1926
1945
  Max: 100
1946
+ CountAsOne: []
1927
1947
 
1928
1948
  # Avoid complex methods.
1929
1949
  Metrics/CyclomaticComplexity:
@@ -1941,17 +1961,20 @@ Metrics/MethodLength:
1941
1961
  StyleGuide: '#short-methods'
1942
1962
  Enabled: true
1943
1963
  VersionAdded: '0.25'
1944
- VersionChanged: '0.59.2'
1964
+ VersionChanged: '0.87'
1945
1965
  CountComments: false # count full line comments?
1946
1966
  Max: 10
1967
+ CountAsOne: []
1947
1968
  ExcludedMethods: []
1948
1969
 
1949
1970
  Metrics/ModuleLength:
1950
1971
  Description: 'Avoid modules longer than 100 lines of code.'
1951
1972
  Enabled: true
1952
1973
  VersionAdded: '0.31'
1974
+ VersionChanged: '0.87'
1953
1975
  CountComments: false # count full line comments?
1954
1976
  Max: 100
1977
+ CountAsOne: []
1955
1978
 
1956
1979
  Metrics/ParameterLists:
1957
1980
  Description: 'Avoid parameter lists longer than three or four parameters.'
@@ -1989,10 +2012,12 @@ Naming/AccessorMethodName:
1989
2012
  VersionAdded: '0.50'
1990
2013
 
1991
2014
  Naming/AsciiIdentifiers:
1992
- Description: 'Use only ascii symbols in identifiers.'
2015
+ Description: 'Use only ascii symbols in identifiers and constants.'
1993
2016
  StyleGuide: '#english-identifiers'
1994
2017
  Enabled: true
1995
2018
  VersionAdded: '0.50'
2019
+ VersionChanged: '0.87'
2020
+ AsciiConstants: true
1996
2021
 
1997
2022
  Naming/BinaryOperatorParameterName:
1998
2023
  Description: 'When defining binary operators, name the argument other.'
@@ -2159,17 +2184,18 @@ Naming/MethodParameterName:
2159
2184
  AllowNamesEndingInNumbers: true
2160
2185
  # Allowed names that will not register an offense
2161
2186
  AllowedNames:
2162
- - io
2163
- - id
2164
- - to
2187
+ - at
2165
2188
  - by
2166
- - 'on'
2189
+ - db
2190
+ - id
2167
2191
  - in
2168
- - at
2192
+ - io
2169
2193
  - ip
2170
- - db
2194
+ - of
2195
+ - 'on'
2171
2196
  - os
2172
2197
  - pp
2198
+ - to
2173
2199
  # Forbidden names that will register an offense
2174
2200
  ForbiddenNames: []
2175
2201
 
@@ -2285,6 +2311,17 @@ Style/AccessModifierDeclarations:
2285
2311
  - group
2286
2312
  AllowModifiersOnSymbols: true
2287
2313
 
2314
+ Style/AccessorGrouping:
2315
+ Description: 'Checks for grouping of accessors in `class` and `module` bodies.'
2316
+ Enabled: 'pending'
2317
+ VersionAdded: '0.87'
2318
+ EnforcedStyle: grouped
2319
+ SupportedStyles:
2320
+ # separated: each accessor goes in a separate statement.
2321
+ # grouped: accessors are grouped into a single statement.
2322
+ - separated
2323
+ - grouped
2324
+
2288
2325
  Style/Alias:
2289
2326
  Description: 'Use alias instead of alias_method.'
2290
2327
  StyleGuide: '#alias-method-lexically'
@@ -2309,6 +2346,14 @@ Style/AndOr:
2309
2346
  - always
2310
2347
  - conditionals
2311
2348
 
2349
+ Style/ArrayCoercion:
2350
+ Description: >-
2351
+ Use Array() instead of explicit Array check or [*var], when dealing
2352
+ with a variable you want to treat as an Array, but you're not certain it's an array.
2353
+ StyleGuide: '#array-coercion'
2354
+ Enabled: 'pending'
2355
+ VersionAdded: '0.88'
2356
+
2312
2357
  Style/ArrayJoin:
2313
2358
  Description: 'Use Array#join instead of Array#*.'
2314
2359
  StyleGuide: '#array-join'
@@ -2352,6 +2397,13 @@ Style/BeginBlock:
2352
2397
  Enabled: true
2353
2398
  VersionAdded: '0.9'
2354
2399
 
2400
+ Style/BisectedAttrAccessor:
2401
+ Description: >-
2402
+ Checks for places where `attr_reader` and `attr_writer`
2403
+ for the same method can be combined into single `attr_accessor`.
2404
+ Enabled: 'pending'
2405
+ VersionAdded: '0.87'
2406
+
2355
2407
  Style/BlockComments:
2356
2408
  Description: 'Do not use block comments.'
2357
2409
  StyleGuide: '#no-block-comments'
@@ -2484,6 +2536,12 @@ Style/CaseEquality:
2484
2536
  # String === "string"
2485
2537
  AllowOnConstant: false
2486
2538
 
2539
+ Style/CaseLikeIf:
2540
+ Description: 'This cop identifies places where `if-elsif` constructions can be replaced with `case-when`.'
2541
+ StyleGuide: '#case-vs-if-else'
2542
+ Enabled: 'pending'
2543
+ VersionAdded: '0.88'
2544
+
2487
2545
  Style/CharacterLiteral:
2488
2546
  Description: 'Checks for uses of character literals.'
2489
2547
  StyleGuide: '#no-character-literals'
@@ -2726,6 +2784,7 @@ Style/DoubleNegation:
2726
2784
  VersionAdded: '0.19'
2727
2785
  VersionChanged: '0.84'
2728
2786
  EnforcedStyle: allowed_in_returns
2787
+ SafeAutoCorrect: false
2729
2788
  SupportedStyles:
2730
2789
  - allowed_in_returns
2731
2790
  - forbidden
@@ -2922,6 +2981,18 @@ Style/GuardClause:
2922
2981
  # needs to have to trigger this cop
2923
2982
  MinBodyLength: 1
2924
2983
 
2984
+ Style/HashAsLastArrayItem:
2985
+ Description: >-
2986
+ Checks for presence or absence of braces around hash literal as a last
2987
+ array item depending on configuration.
2988
+ StyleGuide: '#hash-literal-as-last-array-item'
2989
+ Enabled: 'pending'
2990
+ VersionAdded: '0.88'
2991
+ EnforcedStyle: braces
2992
+ SupportedStyles:
2993
+ - braces
2994
+ - no_braces
2995
+
2925
2996
  Style/HashEachMethods:
2926
2997
  Description: 'Use Hash#each_key and Hash#each_value.'
2927
2998
  StyleGuide: '#hash-each'
@@ -2929,6 +3000,16 @@ Style/HashEachMethods:
2929
3000
  VersionAdded: '0.80'
2930
3001
  Safe: false
2931
3002
 
3003
+ Style/HashLikeCase:
3004
+ Description: >-
3005
+ Checks for places where `case-when` represents a simple 1:1
3006
+ mapping and can be replaced with a hash lookup.
3007
+ Enabled: 'pending'
3008
+ VersionAdded: '0.88'
3009
+ # `MinBranchesCount` defines the number of branches `case` needs to have
3010
+ # to trigger this cop
3011
+ MinBranchesCount: 3
3012
+
2932
3013
  Style/HashSyntax:
2933
3014
  Description: >-
2934
3015
  Prefer Ruby 1.9 hash syntax { a: 1, b: 2 } over 1.8 syntax
@@ -2992,6 +3073,7 @@ Style/IfUnlessModifierOfIfUnless:
2992
3073
  Avoid modifier if/unless usage on conditionals.
2993
3074
  Enabled: true
2994
3075
  VersionAdded: '0.39'
3076
+ VersionChanged: '0.87'
2995
3077
 
2996
3078
  Style/IfWithSemicolon:
2997
3079
  Description: 'Do not use if x; .... Use the ternary operator instead.'
@@ -3578,6 +3660,11 @@ Style/RandomWithOffset:
3578
3660
  Enabled: true
3579
3661
  VersionAdded: '0.52'
3580
3662
 
3663
+ Style/RedundantAssignment:
3664
+ Description: 'Checks for redundant assignment before returning.'
3665
+ Enabled: 'pending'
3666
+ VersionAdded: '0.87'
3667
+
3581
3668
  Style/RedundantBegin:
3582
3669
  Description: "Don't use begin blocks when they are not needed."
3583
3670
  StyleGuide: '#begin-implicit'
@@ -3607,6 +3694,27 @@ Style/RedundantException:
3607
3694
  VersionAdded: '0.14'
3608
3695
  VersionChanged: '0.29'
3609
3696
 
3697
+ Style/RedundantFetchBlock:
3698
+ Description: >-
3699
+ Use `fetch(key, value)` instead of `fetch(key) { value }`
3700
+ when value has Numeric, Rational, Complex, Symbol or String type, `false`, `true`, `nil` or is a constant.
3701
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#hashfetch-with-argument-vs-hashfetch--block-code'
3702
+ Enabled: 'pending'
3703
+ Safe: false
3704
+ # If enabled, this cop will autocorrect usages of
3705
+ # `fetch` being called with block returning a constant.
3706
+ # This can be dangerous since constants will not be defined at that moment.
3707
+ SafeForConstants: false
3708
+ VersionAdded: '0.86'
3709
+
3710
+ Style/RedundantFileExtensionInRequire:
3711
+ Description: >-
3712
+ Checks for the presence of superfluous `.rb` extension in
3713
+ the filename provided to `require` and `require_relative`.
3714
+ StyleGuide: '#no-explicit-rb-to-require'
3715
+ Enabled: 'pending'
3716
+ VersionAdded: '0.88'
3717
+
3610
3718
  Style/RedundantFreeze:
3611
3719
  Description: "Checks usages of Object#freeze on immutable objects."
3612
3720
  Enabled: true
@@ -3908,7 +4016,7 @@ Style/SymbolLiteral:
3908
4016
  Style/SymbolProc:
3909
4017
  Description: 'Use symbols as procs instead of blocks when possible.'
3910
4018
  Enabled: true
3911
- SafeAutoCorrect: false
4019
+ Safe: false
3912
4020
  VersionAdded: '0.26'
3913
4021
  VersionChanged: '0.64'
3914
4022
  # A list of method names to be ignored by the check.
@@ -2,6 +2,6 @@
2
2
 
3
3
  module RbHint
4
4
  module Version
5
- STRING = '0.85.1.rc2'
5
+ STRING = '0.87.1.rc1'
6
6
  end
7
7
  end
@@ -30,6 +30,7 @@ require_relative 'rubocop/cop/ignored_node'
30
30
  require_relative 'rubocop/cop/autocorrect_logic'
31
31
  require_relative 'rubocop/cop/badge'
32
32
  require_relative 'rubocop/cop/registry'
33
+ require_relative 'rubocop/cop/base'
33
34
  require_relative 'rubocop/cop/cop'
34
35
  require_relative 'rubocop/cop/commissioner'
35
36
  require_relative 'rubocop/cop/corrector'
@@ -52,11 +53,12 @@ require_relative 'rubocop/cop/mixin/annotation_comment'
52
53
  require_relative 'rubocop/cop/mixin/array_min_size'
53
54
  require_relative 'rubocop/cop/mixin/array_syntax'
54
55
  require_relative 'rubocop/cop/mixin/alignment'
56
+ require_relative 'rubocop/cop/mixin/allowed_methods'
57
+ require_relative 'rubocop/cop/mixin/auto_corrector'
55
58
  require_relative 'rubocop/cop/mixin/check_assignment'
56
59
  require_relative 'rubocop/cop/mixin/check_line_breakable'
57
60
  require_relative 'rubocop/cop/mixin/configurable_max'
58
61
  require_relative 'rubocop/cop/mixin/code_length' # relies on configurable_max
59
- require_relative 'rubocop/cop/mixin/classish_length' # relies on code_length
60
62
  require_relative 'rubocop/cop/mixin/configurable_enforced_style'
61
63
  require_relative 'rubocop/cop/mixin/configurable_formatting'
62
64
  require_relative 'rubocop/cop/mixin/configurable_naming'
@@ -113,6 +115,7 @@ require_relative 'rubocop/cop/mixin/trailing_body'
113
115
  require_relative 'rubocop/cop/mixin/trailing_comma'
114
116
  require_relative 'rubocop/cop/mixin/uncommunicative_name'
115
117
  require_relative 'rubocop/cop/mixin/unused_argument'
118
+ require_relative 'rubocop/cop/mixin/visibility_help'
116
119
 
117
120
  require_relative 'rubocop/cop/utils/format_string'
118
121
 
@@ -248,6 +251,7 @@ require_relative 'rubocop/cop/lint/deprecated_class_methods'
248
251
  require_relative 'rubocop/cop/lint/deprecated_open_ssl_constant'
249
252
  require_relative 'rubocop/cop/lint/disjunctive_assignment_in_constructor'
250
253
  require_relative 'rubocop/cop/lint/duplicate_case_condition'
254
+ require_relative 'rubocop/cop/lint/duplicate_elsif_condition'
251
255
  require_relative 'rubocop/cop/lint/duplicate_hash_key'
252
256
  require_relative 'rubocop/cop/lint/duplicate_methods'
253
257
  require_relative 'rubocop/cop/lint/each_with_object_argument'
@@ -326,6 +330,7 @@ require_relative 'rubocop/cop/metrics/utils/iterating_block'
326
330
  require_relative 'rubocop/cop/metrics/cyclomatic_complexity'
327
331
  # relies on cyclomatic_complexity
328
332
  require_relative 'rubocop/cop/metrics/utils/abc_size_calculator'
333
+ require_relative 'rubocop/cop/metrics/utils/code_length_calculator'
329
334
  require_relative 'rubocop/cop/metrics/abc_size'
330
335
  require_relative 'rubocop/cop/metrics/block_length'
331
336
  require_relative 'rubocop/cop/metrics/block_nesting'
@@ -353,17 +358,21 @@ require_relative 'rubocop/cop/naming/variable_name'
353
358
  require_relative 'rubocop/cop/naming/variable_number'
354
359
 
355
360
  require_relative 'rubocop/cop/style/access_modifier_declarations'
361
+ require_relative 'rubocop/cop/style/accessor_grouping'
356
362
  require_relative 'rubocop/cop/style/alias'
357
363
  require_relative 'rubocop/cop/style/and_or'
364
+ require_relative 'rubocop/cop/style/array_coercion'
358
365
  require_relative 'rubocop/cop/style/array_join'
359
366
  require_relative 'rubocop/cop/style/ascii_comments'
360
367
  require_relative 'rubocop/cop/style/attr'
361
368
  require_relative 'rubocop/cop/style/auto_resource_cleanup'
362
369
  require_relative 'rubocop/cop/style/bare_percent_literals'
363
370
  require_relative 'rubocop/cop/style/begin_block'
371
+ require_relative 'rubocop/cop/style/bisected_attr_accessor'
364
372
  require_relative 'rubocop/cop/style/block_comments'
365
373
  require_relative 'rubocop/cop/style/block_delimiters'
366
374
  require_relative 'rubocop/cop/style/case_equality'
375
+ require_relative 'rubocop/cop/style/case_like_if'
367
376
  require_relative 'rubocop/cop/style/character_literal'
368
377
  require_relative 'rubocop/cop/style/class_and_module_children'
369
378
  require_relative 'rubocop/cop/style/class_check'
@@ -407,7 +416,9 @@ require_relative 'rubocop/cop/style/format_string_token'
407
416
  require_relative 'rubocop/cop/style/frozen_string_literal_comment'
408
417
  require_relative 'rubocop/cop/style/global_vars'
409
418
  require_relative 'rubocop/cop/style/guard_clause'
419
+ require_relative 'rubocop/cop/style/hash_as_last_array_item'
410
420
  require_relative 'rubocop/cop/style/hash_each_methods'
421
+ require_relative 'rubocop/cop/style/hash_like_case'
411
422
  require_relative 'rubocop/cop/style/hash_syntax'
412
423
  require_relative 'rubocop/cop/style/hash_transform_keys'
413
424
  require_relative 'rubocop/cop/style/hash_transform_values'
@@ -426,6 +437,9 @@ require_relative 'rubocop/cop/style/lambda_call'
426
437
  require_relative 'rubocop/cop/style/line_end_concatenation'
427
438
  require_relative 'rubocop/cop/style/method_call_without_args_parentheses'
428
439
  require_relative 'rubocop/cop/style/method_call_with_args_parentheses'
440
+ require_relative 'rubocop/cop/style/redundant_assignment'
441
+ require_relative 'rubocop/cop/style/redundant_fetch_block'
442
+ require_relative 'rubocop/cop/style/redundant_file_extension_in_require'
429
443
  require_relative 'rubocop/cop/style/method_call_with_args_parentheses/omit_parentheses'
430
444
  require_relative 'rubocop/cop/style/method_call_with_args_parentheses/require_parentheses'
431
445
  require_relative 'rubocop/cop/style/method_called_on_do_end_block'