Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update RuboCop to 0.90 #100

Merged
merged 2 commits into from
Sep 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ task :vendor do

require "rubocop"
require "yaml" unless defined?(YAML)
cfg = RuboCop::Cop::Cop.all.inject({}) { |acc, cop| acc[cop.cop_name] = { "Enabled" => false }; acc }
cfg = RuboCop::Cop::Cop.all.each_with_object({}) { |cop, acc| acc[cop.cop_name] = { "Enabled" => false } unless cop.cop_name.start_with?("Chef") }
File.open(dst.join("disable_all.yml"), "w") { |fh| fh.write cfg.to_yaml }

sh %{git add #{dst}/{upstream,disable_all}.yml}
Expand Down
22 changes: 21 additions & 1 deletion config/disable_all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ Layout/EmptyLineAfterGuardClause:
Enabled: false
Layout/EmptyLineAfterMagicComment:
Enabled: false
Layout/EmptyLineAfterMultilineCondition:
Enabled: false
Layout/EmptyLineBetweenDefs:
Enabled: false
Layout/EmptyLinesAroundAccessModifier:
Expand Down Expand Up @@ -231,6 +233,8 @@ Lint/DuplicateHashKey:
Enabled: false
Lint/DuplicateMethods:
Enabled: false
Lint/DuplicateRequire:
Enabled: false
Lint/DuplicateRescueException:
Enabled: false
Lint/EachWithObjectArgument:
Expand All @@ -243,6 +247,8 @@ Lint/EmptyEnsure:
Enabled: false
Lint/EmptyExpression:
Enabled: false
Lint/EmptyFile:
Enabled: false
Lint/EmptyInterpolation:
Enabled: false
Lint/EmptyWhen:
Expand Down Expand Up @@ -361,6 +367,8 @@ Lint/ToJSON:
Enabled: false
Lint/TopLevelReturnWithArgument:
Enabled: false
Lint/TrailingCommaInAttributeDeclaration:
Enabled: false
Lint/UnderscorePrefixedVariableName:
Enabled: false
Lint/UnifiedInteger:
Expand All @@ -383,6 +391,8 @@ Lint/UselessAssignment:
Enabled: false
Lint/UselessElseWithoutRescue:
Enabled: false
Lint/UselessMethodDefinition:
Enabled: false
Lint/UselessSetterCall:
Enabled: false
Lint/Void:
Expand Down Expand Up @@ -477,6 +487,8 @@ Style/ClassCheck:
Enabled: false
Style/ClassMethods:
Enabled: false
Style/ClassMethodsDefinitions:
Enabled: false
Style/ClassVars:
Enabled: false
Style/CollectionMethods:
Expand All @@ -485,6 +497,8 @@ Style/ColonMethodCall:
Enabled: false
Style/ColonMethodDefinition:
Enabled: false
Style/CombinableLoops:
Enabled: false
Style/CommandLiteral:
Enabled: false
Style/CommentAnnotation:
Expand Down Expand Up @@ -591,6 +605,8 @@ Style/InlineComment:
Enabled: false
Style/IpAddresses:
Enabled: false
Style/KeywordParametersOrder:
Enabled: false
Style/Lambda:
Enabled: false
Style/LambdaCall:
Expand All @@ -607,6 +623,10 @@ Style/RedundantFetchBlock:
Enabled: false
Style/RedundantFileExtensionInRequire:
Enabled: false
Style/RedundantSelfAssignment:
Enabled: false
Style/SoleNestedConditional:
Enabled: false
Style/MethodCalledOnDoEndBlock:
Enabled: false
Style/MethodDefParentheses:
Expand Down Expand Up @@ -828,4 +848,4 @@ Security/MarshalLoad:
Security/Open:
Enabled: false
Security/YAMLLoad:
Enabled: false
Enabled: false
90 changes: 79 additions & 11 deletions config/upstream.yml
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,6 @@ Layout/DefEndAlignment:
SupportedStylesAlignWith:
- start_of_line
- def
AutoCorrect: false
Severity: warning

Layout/DotPosition:
Expand Down Expand Up @@ -436,6 +435,14 @@ Layout/EmptyLineAfterMagicComment:
Enabled: true
VersionAdded: '0.49'

Layout/EmptyLineAfterMultilineCondition:
Description: 'Enforces empty line after multiline condition.'
# This is disabled, because this style is not very common in practice.
Enabled: false
VersionAdded: '0.90'
Reference:
- https://github.com/airbnb/ruby#multiline-if-newline

Layout/EmptyLineBetweenDefs:
Description: 'Use empty lines between defs.'
StyleGuide: '#empty-lines-between-methods'
Expand Down Expand Up @@ -555,7 +562,6 @@ Layout/EndAlignment:
- keyword
- variable
- start_of_line
AutoCorrect: false
Severity: warning

Layout/EndOfLine:
Expand Down Expand Up @@ -1427,6 +1433,11 @@ Lint/DuplicateMethods:
Enabled: true
VersionAdded: '0.29'

Lint/DuplicateRequire:
Description: 'Check for duplicate `require`s and `require_relative`s.'
Enabled: pending
VersionAdded: '0.90'

Lint/DuplicateRescueException:
Description: 'Checks that there are no repeated exceptions used in `rescue` expressions.'
Enabled: pending
Expand All @@ -1453,13 +1464,18 @@ Lint/EmptyEnsure:
Enabled: true
VersionAdded: '0.10'
VersionChanged: '0.48'
AutoCorrect: false

Lint/EmptyExpression:
Description: 'Checks for empty expressions.'
Enabled: true
VersionAdded: '0.45'

Lint/EmptyFile:
Description: 'Enforces that Ruby source files are not empty.'
Enabled: pending
AllowComments: true
VersionAdded: '0.90'

Lint/EmptyInterpolation:
Description: 'Checks for empty string interpolation.'
Enabled: true
Expand Down Expand Up @@ -1856,6 +1872,11 @@ Lint/TopLevelReturnWithArgument:
Enabled: 'pending'
VersionAdded: '0.89'

Lint/TrailingCommaInAttributeDeclaration:
Description: 'This cop checks for trailing commas in attribute declarations.'
Enabled: pending
VersionAdded: '0.90'

Lint/UnderscorePrefixedVariableName:
Description: 'Do not use prefix `_` for a variable that is used.'
Enabled: true
Expand Down Expand Up @@ -1931,6 +1952,13 @@ Lint/UselessElseWithoutRescue:
Enabled: true
VersionAdded: '0.17'

Lint/UselessMethodDefinition:
Description: 'Checks for useless method definitions.'
Enabled: pending
VersionAdded: '0.90'
Safe: false
AllowComments: true

Lint/UselessSetterCall:
Description: 'Checks for useless setter call to a local variable.'
Enabled: true
Expand Down Expand Up @@ -2591,6 +2619,7 @@ Style/CaseLikeIf:
Description: 'This cop identifies places where `if-elsif` constructions can be replaced with `case-when`.'
StyleGuide: '#case-vs-if-else'
Enabled: 'pending'
Safe: false
VersionAdded: '0.88'

Style/CharacterLiteral:
Expand All @@ -2608,7 +2637,6 @@ Style/ClassAndModuleChildren:
# have the knowledge to perform either operation safely and thus requires
# manual oversight.
SafeAutoCorrect: false
AutoCorrect: false
Enabled: true
VersionAdded: '0.19'
#
Expand Down Expand Up @@ -2647,6 +2675,16 @@ Style/ClassMethods:
VersionAdded: '0.9'
VersionChanged: '0.20'

Style/ClassMethodsDefinitions:
Description: 'Enforces using `def self.method_name` or `class << self` to define class methods.'
StyleGuide: '#def-self-class-methods'
Enabled: false
VersionAdded: '0.89'
EnforcedStyle: def_self
SupportedStyles:
- def_self
- self_class

Style/ClassVars:
Description: 'Avoid the use of class variables.'
StyleGuide: '#no-class-vars'
Expand Down Expand Up @@ -2687,6 +2725,14 @@ Style/ColonMethodDefinition:
Enabled: true
VersionAdded: '0.52'

Style/CombinableLoops:
Description: >-
Checks for places where multiple consecutive loops over the same data
can be combined into a single loop.
Enabled: pending
Safe: false
VersionAdded: '0.90'

Style/CommandLiteral:
Description: 'Use `` or %x around command literals.'
StyleGuide: '#percent-x'
Expand Down Expand Up @@ -3021,7 +3067,7 @@ Style/FrozenStringLiteralComment:
# `never` will enforce that the frozen string literal comment does not
# exist in a file.
- never
Safe: false
SafeAutoCorrect: false

Style/GlobalStdStream:
Description: 'Enforces the use of `$stdout/$stderr/$stdin` instead of `STDOUT/STDERR/STDIN`.'
Expand Down Expand Up @@ -3101,15 +3147,17 @@ Style/HashSyntax:
PreferHashRocketsForNonAlnumEndingSymbols: false

Style/HashTransformKeys:
Description: 'Prefer `transform_keys` over `each_with_object` and `map`.'
Description: 'Prefer `transform_keys` over `each_with_object`, `map`, or `to_h`.'
Enabled: 'pending'
VersionAdded: '0.80'
VersionChanged: '0.90'
Safe: false

Style/HashTransformValues:
Description: 'Prefer `transform_values` over `each_with_object` and `map`.'
Description: 'Prefer `transform_values` over `each_with_object`, `map`, or `to_h`.'
Enabled: 'pending'
VersionAdded: '0.80'
VersionChanged: '0.90'
Safe: false

Style/IdenticalConditionalBranches:
Expand Down Expand Up @@ -3206,6 +3254,12 @@ Style/IpAddresses:
- "::"
# :: is a valid IPv6 address, but could potentially be legitimately in code

Style/KeywordParametersOrder:
Description: 'Enforces that optional keyword parameters are placed at the end of the parameters list.'
StyleGuide: '#keyword-parameters-order'
Enabled: pending
VersionAdded: '0.90'

Style/Lambda:
Description: 'Use the new lambda literal syntax for single-line blocks.'
StyleGuide: '#lambda-multi-line'
Expand Down Expand Up @@ -3579,7 +3633,6 @@ Style/NumericPredicate:
# object. Switching these methods has to be done with knowledge of the types
# of the variables which rubocop doesn't have.
SafeAutoCorrect: false
AutoCorrect: false
Enabled: true
VersionAdded: '0.42'
VersionChanged: '0.59'
Expand All @@ -3595,12 +3648,13 @@ Style/NumericPredicate:

Style/OneLineConditional:
Description: >-
Favor the ternary operator(?:) over
if/then/else/end constructs.
Favor the ternary operator (?:) or multi-line constructs over
single-line if/then/else/end constructs.
StyleGuide: '#ternary-operator'
Enabled: true
AlwaysCorrectToMultiline: false
VersionAdded: '0.9'
VersionChanged: '0.38'
VersionChanged: '0.90'

Style/OptionHash:
Description: "Don't use option hashes when you can use keyword arguments."
Expand Down Expand Up @@ -3831,6 +3885,12 @@ Style/RedundantSelf:
VersionAdded: '0.10'
VersionChanged: '0.13'

Style/RedundantSelfAssignment:
Description: 'Checks for places where redundant assignments are made for in place modification methods.'
Enabled: pending
Safe: false
VersionAdded: '0.90'

Style/RedundantSort:
Description: >-
Use `min` instead of `sort.first`,
Expand Down Expand Up @@ -3983,6 +4043,14 @@ Style/SlicingWithRange:
VersionAdded: '0.83'
Safe: false

Style/SoleNestedConditional:
Description: >-
Finds sole nested conditional nodes
which can be merged into outer conditional node.
Enabled: pending
VersionAdded: '0.89'
AllowModifier: false

Style/SpecialGlobalVars:
Description: 'Avoid Perl-style global variables.'
StyleGuide: '#no-cryptic-perlisms'
Expand Down
2 changes: 1 addition & 1 deletion lib/chefstyle/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true
module Chefstyle
VERSION = "1.3.1"
RUBOCOP_VERSION = "0.89.1"
RUBOCOP_VERSION = "0.90"
end