Skip to content

Commit

Permalink
Update to Rubocop 0.81.0
Browse files Browse the repository at this point in the history
This resolves a large number of bugs that impacted us on the Cookstyle
side and also adds support for Ruby 2.7 syntax to many cops.

Signed-off-by: Tim Smith <tsmith@chef.io>
  • Loading branch information
tas50 committed Apr 1, 2020
1 parent f5cc1f3 commit 95c3c8b
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 18 deletions.
8 changes: 6 additions & 2 deletions config/disable_all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,6 @@ Lint/EmptyInterpolation:
Enabled: false
Lint/EmptyWhen:
Enabled: false
Lint/EndInMethod:
Enabled: false
Lint/EnsureReturn:
Enabled: false
Lint/ErbNewArguments:
Expand Down Expand Up @@ -283,6 +281,8 @@ Lint/PercentStringArray:
Enabled: false
Lint/PercentSymbolArray:
Enabled: false
Lint/RaiseException:
Enabled: false
Lint/RandOne:
Enabled: false
Lint/RedundantCopDisableDirective:
Expand Down Expand Up @@ -325,6 +325,8 @@ Lint/ShadowedException:
Enabled: false
Lint/ShadowingOuterLocalVariable:
Enabled: false
Lint/StructNewOverride:
Enabled: false
Lint/SuppressedException:
Enabled: false
Lint/Syntax:
Expand Down Expand Up @@ -725,6 +727,8 @@ Style/TrailingCommaInArguments:
Enabled: false
Style/TrailingCommaInArrayLiteral:
Enabled: false
Style/TrailingCommaInBlockArgs:
Enabled: false
Style/TrailingCommaInHashLiteral:
Enabled: false
Style/TrailingMethodEndStatement:
Expand Down
77 changes: 62 additions & 15 deletions config/upstream.yml
Original file line number Diff line number Diff line change
Expand Up @@ -255,10 +255,30 @@ Layout/ArrayAlignment:
Description: >-
Align the elements of an array literal if they span more than
one line.
StyleGuide: '#align-multiline-arrays'
StyleGuide: '#no-double-indent'
Enabled: true
VersionAdded: '0.49'
VersionChanged: '0.77'
# Alignment of elements of a multi-line array.
#
# The `with_first_parameter` style aligns the following lines along the same
# column as the first element.
#
# array = [1, 2, 3,
# 4, 5, 6]
#
# The `with_fixed_indentation` style aligns the following lines with one
# level of indentation relative to the start of the line with start of array.
#
# array = [1, 2, 3,
# 4, 5, 6]
EnforcedStyle: with_first_element
SupportedStyles:
- with_first_element
- with_fixed_indentation
# By default, the indentation width from Layout/IndentationWidth is used
# But it can be overridden by setting this parameter
IndentationWidth: ~

Layout/AssignmentIndentation:
Description: >-
Expand Down Expand Up @@ -1303,6 +1323,7 @@ Lint/BooleanSymbol:
Description: 'Check for `:true` and `:false` symbols.'
Enabled: true
VersionAdded: '0.50'
VersionChanged: '0.81'

Lint/CircularArgumentReference:
Description: "Default values in optional keyword arguments and optional ordinal arguments should not refer back to the name of the argument."
Expand Down Expand Up @@ -1375,11 +1396,6 @@ Lint/EmptyWhen:
Enabled: true
VersionAdded: '0.45'

Lint/EndInMethod:
Description: 'END blocks should not be placed inside method definitions.'
Enabled: true
VersionAdded: '0.9'

Lint/EnsureReturn:
Description: 'Do not use return in an ensure block.'
StyleGuide: '#no-return-ensure'
Expand Down Expand Up @@ -1546,6 +1562,12 @@ Lint/PercentSymbolArray:
Enabled: true
VersionAdded: '0.41'

Lint/RaiseException:
Description: Checks for `raise` or `fail` statements which are raising `Exception` class.
StyleGuide: '#raise-exception'
Enabled: pending
VersionAdded: '0.81'

Lint/RandOne:
Description: >-
Checks for `rand(1)` calls. Such calls always return `0`
Expand Down Expand Up @@ -1574,7 +1596,7 @@ Lint/RedundantRequireStatement:
Lint/RedundantSplatExpansion:
Description: 'Checks for splat unnecessarily being called on literals.'
Enabled: true
VersionChanged: '0.76'
VersionAdded: '0.76'

Lint/RedundantStringCoercion:
Description: 'Checks for Object#to_s usage in string interpolation.'
Expand Down Expand Up @@ -1688,13 +1710,18 @@ Lint/ShadowingOuterLocalVariable:
Enabled: true
VersionAdded: '0.9'

Lint/StructNewOverride:
Description: 'Disallow overriding the `Struct` built-in methods via `Struct.new`.'
Enabled: pending
VersionAdded: '0.81'

Lint/SuppressedException:
Description: "Don't suppress exceptions."
StyleGuide: '#dont-hide-exceptions'
Enabled: true
AllowComments: false
AllowComments: true
VersionAdded: '0.9'
VersionChanged: '0.77'
VersionChanged: '0.81'

Lint/Syntax:
Description: 'Checks syntax error.'
Expand All @@ -1705,6 +1732,7 @@ Lint/Syntax:
Lint/ToJSON:
Description: 'Ensure #to_json includes an optional argument.'
Enabled: true
VersionAdded: '0.66'

Lint/UnderscorePrefixedVariableName:
Description: 'Do not use prefix `_` for a variable that is used.'
Expand Down Expand Up @@ -1736,9 +1764,10 @@ Lint/UnusedMethodArgument:
StyleGuide: '#underscore-unused-vars'
Enabled: true
VersionAdded: '0.21'
VersionChanged: '0.35'
VersionChanged: '0.81'
AllowUnusedKeywordArguments: false
IgnoreEmptyMethods: true
IgnoreNotImplementedMethods: true

Lint/UriEscapeUnescape:
Description: >-
Expand Down Expand Up @@ -1804,9 +1833,10 @@ Metrics/AbcSize:
- https://en.wikipedia.org/wiki/ABC_Software_Metric
Enabled: true
VersionAdded: '0.27'
VersionChanged: '0.66'
VersionChanged: '0.81'
# The ABC size is a calculated magnitude, so this number can be an Integer or
# a Float.
IgnoredMethods: []
Max: 15

Metrics/BlockLength:
Expand Down Expand Up @@ -1846,6 +1876,8 @@ Metrics/CyclomaticComplexity:
of test cases needed to validate a method.
Enabled: true
VersionAdded: '0.25'
VersionChanged: '0.81'
IgnoredMethods: []
Max: 6

Metrics/MethodLength:
Expand Down Expand Up @@ -1879,6 +1911,8 @@ Metrics/PerceivedComplexity:
human reader.
Enabled: true
VersionAdded: '0.25'
VersionChanged: '0.81'
IgnoredMethods: []
Max: 7

################## Migration #############################
Expand All @@ -1888,6 +1922,7 @@ Migration/DepartmentName:
Check that cop names in rubocop:disable (etc) comments are
given with department name.
Enabled: true
VersionAdded: '0.75'

#################### Naming ##############################

Expand Down Expand Up @@ -2178,10 +2213,12 @@ Style/AccessModifierDeclarations:
Description: 'Checks style of how access modifiers are used.'
Enabled: true
VersionAdded: '0.57'
VersionChanged: '0.81'
EnforcedStyle: group
SupportedStyles:
- inline
- group
AllowModifiersOnSymbols: true

Style/Alias:
Description: 'Use alias instead of alias_method.'
Expand Down Expand Up @@ -2435,7 +2472,7 @@ Style/ClassVars:
# Align with the style guide.
Style/CollectionMethods:
Description: 'Preferred collection methods.'
StyleGuide: '#map-find-select-reduce-size'
StyleGuide: '#map-find-select-reduce-include-size'
Enabled: false
VersionAdded: '0.9'
VersionChanged: '0.27'
Expand All @@ -2452,6 +2489,7 @@ Style/CollectionMethods:
inject: 'reduce'
detect: 'find'
find_all: 'select'
member?: 'include?'

Style/ColonMethodCall:
Description: 'Do not use :: for method call.'
Expand Down Expand Up @@ -2677,6 +2715,7 @@ Style/EndBlock:
StyleGuide: '#no-END-blocks'
Enabled: true
VersionAdded: '0.9'
VersionChanged: '0.81'

Style/EvalWithLocation:
Description: 'Pass `__FILE__` and `__LINE__` to `eval` method, as they are used by backtraces.'
Expand Down Expand Up @@ -2937,7 +2976,7 @@ Style/LambdaCall:
Description: 'Use lambda.call(...) instead of lambda.(...).'
StyleGuide: '#proc-call'
Enabled: true
VersionAdded: '0.13.1'
VersionAdded: '0.13'
VersionChanged: '0.14'
EnforcedStyle: call
SupportedStyles:
Expand Down Expand Up @@ -3067,6 +3106,7 @@ Style/ModuleFunction:
SupportedStyles:
- module_function
- extend_self
- forbidden
Autocorrect: false
SafeAutoCorrect: false

Expand Down Expand Up @@ -3806,22 +3846,29 @@ Style/TrailingCommaInArrayLiteral:
StyleGuide: '#no-trailing-array-commas'
Enabled: true
VersionAdded: '0.53'
# If `comma`, the cop requires a comma after the last item in an array,
# but only when each item is on its own line.
# If `consistent_comma`, the cop requires a comma after the last item of all
# non-empty array literals.
# non-empty, multiline array literals.
EnforcedStyleForMultiline: no_comma
SupportedStylesForMultiline:
- comma
- consistent_comma
- no_comma

Style/TrailingCommaInBlockArgs:
Description: 'Checks for useless trailing commas in block arguments.'
Enabled: false
Safe: false
VersionAdded: '0.81'

Style/TrailingCommaInHashLiteral:
Description: 'Checks for trailing comma in hash literals.'
Enabled: true
# If `comma`, the cop requires a comma after the last item in a hash,
# but only when each item is on its own line.
# If `consistent_comma`, the cop requires a comma after the last item of all
# non-empty hash literals.
# non-empty, multiline hash literals.
EnforcedStyleForMultiline: no_comma
SupportedStylesForMultiline:
- comma
Expand Down
2 changes: 1 addition & 1 deletion lib/chefstyle/version.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module Chefstyle
VERSION = "0.15.1".freeze
RUBOCOP_VERSION = "0.80.1".freeze
RUBOCOP_VERSION = "0.81.0".freeze
end

0 comments on commit 95c3c8b

Please sign in to comment.