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

Fix commented out cops due to renames #981

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
63 changes: 29 additions & 34 deletions config/chefstyle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ Lint/DuplicateCaseCondition:
Enabled: true
Lint/DuplicateMethods:
Enabled: true
# Lint/DuplicatedKey: TODO broken with rubocop 1.25.1 move
# Enabled: true
Lint/DuplicateHashKey:
Enabled: true
Lint/EachWithObjectArgument:
Enabled: true
Lint/ElseLayout:
Expand All @@ -70,8 +70,6 @@ Lint/EmptyWhen:
Layout/EndAlignment:
Enabled: true
AutoCorrect: true
# Lint/EndInMethod: TODO broken with rubocop 1.25.1 move
# Enabled: true
Lint/EnsureReturn:
Enabled: true
Lint/FloatOutOfRange:
Expand All @@ -90,8 +88,8 @@ Lint/LiteralInInterpolation:
Enabled: true
Lint/Loop:
Enabled: true
# Lint/MultipleCompare: TODO broken with rubocop 1.25.1 move
# Enabled: true
Lint/MultipleComparison:
Enabled: true
Lint/NestedMethodDefinition:
Enabled: true
Lint/NextWithoutAccumulator:
Expand All @@ -114,14 +112,12 @@ Lint/ShadowedException:
Enabled: true
Lint/ShadowingOuterLocalVariable:
Enabled: true
# Lint/StringConversionInInterpolation: TODO broken with rubocop 1.25.1 move
# Enabled: true
Lint/UnderscorePrefixedVariableName:
Enabled: true
Lint/UnifiedInteger:
Enabled: true
# Lint/UnneededSplatExpansion: TODO broken with rubocop 1.25.1 move
# Enabled: true
Lint/RedundantSplatExpansion:
Enabled: true
Lint/UnreachableCode:
Enabled: true
Lint/UriEscapeUnescape:
Expand All @@ -130,8 +126,8 @@ Lint/UselessAccessModifier:
Enabled: true
Lint/UselessAssignment:
Enabled: true
# Lint/UselessComparison: TODO broken with rubocop 1.25.1 move
# Enabled: true
Lint/BinaryOperatorWithIdenticalOperands:
Enabled: true
Lint/UselessElseWithoutRescue:
Enabled: true
Lint/UselessSetterCall:
Expand Down Expand Up @@ -196,24 +192,23 @@ Metrics/ParameterLists:
Metrics/PerceivedComplexity:
Enabled: false


#
# Style/Naming/Layout
#

Layout/AccessModifierIndentation:
Enabled: true
# Layout/AlignArguments: TODO broken with rubocop 1.25.1 move
# Enabled: true
# EnforcedStyle: with_fixed_indentation
# Layout/AlignParameters: TODO broken with rubocop 1.25.1 move
# Enabled: true
# EnforcedStyle: with_fixed_indentation
Layout/ArgumentAlignment:
Enabled: true
EnforcedStyle: with_fixed_indentation
Layout/ParameterAlignment:
Enabled: true
EnforcedStyle: with_fixed_indentation
# the "ignore_implict" is here for keyword args in method calls which are
# "implicit" hashes, and those should not be treated like normal hashes
# Layout/AlignHash: TODO broken with rubocop 1.25.1 move
# Enabled: true
# EnforcedLastArgumentHashStyle: ignore_implicit
Layout/HashAlignment:
Enabled: true
EnforcedLastArgumentHashStyle: ignore_implicit
Style/AndOr:
Enabled: true
Style/ArrayJoin:
Expand Down Expand Up @@ -290,13 +285,13 @@ Style/IfUnlessModifierOfIfUnless:
Enabled: true
Style/IfWithSemicolon:
Enabled: true
# Layout/IndentAssignment: TODO broken with rubocop 1.25.1 move
# Enabled: true
# Layout/IndentFirstArgument: TODO broken with rubocop 1.25.1 move
# EnforcedStyle: consistent
# Enabled: true
# Layout/IndentHeredoc: TODO broken with rubocop 1.25.1 move
# Enabled: true
Layout/AssignmentIndentation:
Enabled: true
Layout/FirstArgumentIndentation:
EnforcedStyle: consistent
Enabled: true
Layout/HeredocIndentation:
Enabled: true
Layout/IndentationConsistency:
Enabled: true
Layout/IndentationWidth:
Expand Down Expand Up @@ -464,8 +459,8 @@ Style/SymbolProc:
Enabled: true
Layout/IndentationStyle:
Enabled: true
# Layout/TrailingBlankLines: TODO broken with rubocop 1.25.1 move
# Enabled: true
Layout/TrailingEmptyLines:
Enabled: true
Style/TrailingCommaInArguments:
Enabled: true
# rubocop's default gets this completely backwards
Expand All @@ -479,11 +474,11 @@ Style/TrailingUnderscoreVariable:
Enabled: true
Layout/TrailingWhitespace:
Enabled: true
# Style/UnneededCapitalW: TODO broken with rubocop 1.25.1 move
# Enabled: true
Style/RedundantCapitalW:
Enabled: true
Style/RedundantInterpolation:
Enabled: false # buggy: https://github.com/rubocop-hq/rubocop/issues/6099
#Style/UnneededPercentQ: # would like to enable this one but its buggy as of 0.35.1
#Style/RedundantPercentQ: # would like to enable this one but its buggy as of 0.35.1
# Enabled: true
Naming/VariableName:
Enabled: true
Expand Down
78 changes: 34 additions & 44 deletions config/cookstyle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2373,10 +2373,10 @@ Chef/Security/SshPrivateKey:

Layout/AccessModifierIndentation:
Enabled: true
# Layout/AlignArray: TODO broken with rubocop 1.25.1 move
# Enabled: true
# Layout/AlignHash: TODO broken with rubocop 1.25.1 move
# Enabled: true
Layout/ArrayAlignment:
Enabled: true
Layout/HashAlignment:
Enabled: true
Style/AndOr:
Enabled: true
Style/ArrayJoin:
Expand Down Expand Up @@ -2425,8 +2425,6 @@ Naming/ConstantName:
Enabled: true
Style/DefWithParentheses:
Enabled: true
# Style/DeprecatedHashMethods: TODO broken with rubocop 1.25.1 move
# Enabled: true
Layout/DotPosition:
Enabled: true
Style/EachWithObject:
Expand Down Expand Up @@ -2482,12 +2480,12 @@ Layout/IndentationWidth:
Enabled: true
Style/IdenticalConditionalBranches:
Enabled: true
# Layout/IndentArray: TODO broken with rubocop 1.25.1 move
# Enabled: true
# Layout/IndentAssignment: TODO broken with rubocop 1.25.1 move
# Enabled: true
# Layout/IndentHash: TODO broken with rubocop 1.25.1 move
# Enabled: true
Layout/FirstArrayElementIndentation:
Enabled: true
Layout/AssignmentIndentation:
Enabled: true
Layout/FirstHashElementIndentation:
Enabled: true
Style/InfiniteLoop:
Enabled: true
Style/Lambda:
Expand All @@ -2498,8 +2496,8 @@ Layout/LeadingCommentSpace:
Enabled: true
Style/LineEndConcatenation:
Enabled: true
# Style/MethodCallParentheses: TODO broken with rubocop 1.25.1 move
# Enabled: true
Style/MethodCallWithoutArgsParentheses:
Enabled: true
Style/MethodDefParentheses:
Enabled: true
Style/MultilineBlockChain:
Expand Down Expand Up @@ -2536,8 +2534,8 @@ Style/Not:
Enabled: true
Style/OneLineConditional:
Enabled: true
# Naming/OpMethod: TODO broken with rubocop 1.25.1 move
# Enabled: true
Naming/BinaryOperatorParameterName:
Enabled: true
Style/OptionalArguments:
Enabled: true
Style/ParallelAssignment:
Expand Down Expand Up @@ -2641,12 +2639,12 @@ Style/TrivialAccessors:
Enabled: true
Style/UnlessElse:
Enabled: true
# Style/UnneededCapitalW: TODO broken with rubocop 1.25.1 move
# Enabled: true
# Style/UnneededInterpolation: TODO broken with rubocop 1.25.1 move
# Enabled: true
# Style/UnneededPercentQ: TODO broken with rubocop 1.25.1 move
# Enabled: true
Style/RedundantCapitalW:
Enabled: true
Style/RedundantInterpolation:
Enabled: true
Style/RedundantPercentQ:
Enabled: true
Style/TrailingUnderscoreVariable:
Enabled: true
Style/VariableInterpolation:
Expand Down Expand Up @@ -2680,8 +2678,8 @@ Lint/DeprecatedClassMethods:
Enabled: true
Lint/DuplicateMethods:
Enabled: true
# Lint/DuplicatedKey: TODO broken with rubocop 1.25.1 move
# Enabled: true
Lint/DuplicateHashKey:
Enabled: true
Lint/EachWithObjectArgument:
Enabled: true
Lint/ElseLayout:
Expand All @@ -2693,8 +2691,6 @@ Lint/EmptyInterpolation:
Layout/EndAlignment:
Enabled: true
AutoCorrect: true
# Lint/EndInMethod: TODO broken with rubocop 1.25.1 move
# Enabled: true
Lint/EnsureReturn:
Enabled: true
Security/Eval:
Expand All @@ -2703,8 +2699,8 @@ Lint/FloatOutOfRange:
Enabled: true
Lint/FormatParameterMismatch:
Enabled: true
# Lint/HandleExceptions: TODO broken with rubocop 1.25.1 move
# Enabled: true
Lint/SuppressedException:
Enabled: true
Lint/ImplicitStringConcatenation:
Enabled: true
Exclude:
Expand Down Expand Up @@ -2733,12 +2729,12 @@ Lint/RescueException:
Enabled: true
Lint/ShadowingOuterLocalVariable:
Enabled: true
# Lint/StringConversionInInterpolation: TODO broken with rubocop 1.25.1 move
# Enabled: true
Lint/RedundantStringCoercion:
Enabled: true
Lint/UnderscorePrefixedVariableName:
Enabled: true
# Lint/UnneededCopDisableDirective: TODO broken with rubocop 1.25.1 move
# Enabled: true
Lint/RedundantCopDisableDirective:
Enabled: true
Lint/UnusedBlockArgument:
Enabled: true
Lint/UnusedMethodArgument:
Expand All @@ -2749,8 +2745,6 @@ Lint/UselessAccessModifier:
Enabled: true
Lint/UselessAssignment:
Enabled: true
# Lint/UselessComparison: TODO broken with rubocop 1.25.1 move
# Enabled: true
Lint/UselessElseWithoutRescue:
Enabled: true
Lint/UselessSetterCall:
Expand Down Expand Up @@ -2938,16 +2932,16 @@ Style/RedundantConditional:
Enabled: true

# catches people writing a regex check wrong
# Lint/RegexpInCondition: TODO broken with rubocop 1.25.1 move
# Enabled: true
Lint/RegexpAsCondition:
Enabled: true

# Avoids pointless / complex code
Lint/RedundantWithObject:
Enabled: true

# avoid requiring things that come for free
# Lint/UnneededRequireStatement: TODO broken with rubocop 1.25.1 move
# Enabled: true
Lint/RedundantRequireStatement:
Enabled: true

# Avoid poorly formatted methods
Style/TrailingBodyOnMethodDefinition:
Expand All @@ -2970,8 +2964,8 @@ Lint/BigDecimalNew:
Enabled: true

# remove bogus rubocop comments. We already enabled Disable directives
# Lint/UnneededCopEnableDirective: TODO broken with rubocop 1.25.1 move
# Enabled: true
Lint/RedundantCopEnableDirective:
Enabled: true

# get people on a much simpler ruby 2.4+ way of doing things
Style/UnpackFirst:
Expand Down Expand Up @@ -3058,10 +3052,6 @@ Style/RedundantAssignment:
Lint/Syntax:
Enabled: true

# remove extra requires like 'thread'
Lint/RedundantRequireStatement:
Enabled: true

# simplify stripping strings
Style/Strip:
Enabled: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ class DeprecatedShelloutMethods < Base

MSG = 'Many legacy specialized shell_out methods were replaced in Chef Infra Client 14.3 and removed in Chef Infra Client 15. Use shell_out and any additional options if necessary.'
RESTRICT_ON_SEND = %i( shell_out_compact
shell_out_compact!
shell_out_compact_timeout
shell_out_compact_timeout!
shell_out_with_timeout
shell_out_with_timeout!
shell_out_with_systems_locale
shell_out_with_systems_locale!
shell_out_compact!
shell_out_compact_timeout
shell_out_compact_timeout!
shell_out_with_timeout
shell_out_with_timeout!
shell_out_with_systems_locale
shell_out_with_systems_locale!
).freeze

def on_send(node)
Expand Down
2 changes: 1 addition & 1 deletion lib/rubocop/cop/chef/security/ssh_private_key.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def on_send(node)
node.arguments.each do |arg|
next unless arg.str_type? || arg.dstr_type?

if arg.value.start_with?('-----BEGIN RSA PRIVATE', '-----BEGIN EC PRIVATE') # cookstyle: disable Chef/Security/SshPrivateKey
if arg.value.start_with?('-----BEGIN RSA PRIVATE', '-----BEGIN EC PRIVATE')
add_offense(node, severity: :warning)
end
end
Expand Down