File Manager
Viewing File: chefstyle.yml
#
# Bundler
#
Bundler/DuplicatedGem:
Enabled: true
#
# Lint
#
Lint/AmbiguousOperator:
Enabled: true
Lint/BlockAlignment:
Enabled: true
Lint/CircularArgumentReference:
Enabled: true
Lint/ConditionPosition:
Enabled: true
Lint/Debugger:
Enabled: true
Lint/DefEndAlignment:
Enabled: true
Lint/DuplicateCaseCondition:
Enabled: true
Lint/DuplicateMethods:
Enabled: true
Lint/DuplicatedKey:
Enabled: true
Lint/EachWithObjectArgument:
Enabled: true
Lint/ElseLayout:
Enabled: true
Lint/EmptyEnsure:
Enabled: true
Lint/EmptyExpression:
Enabled: true
Lint/EmptyInterpolation:
Enabled: true
Lint/EndAlignment:
Enabled: true
Lint/EndInMethod:
Enabled: true
Lint/EnsureReturn:
Enabled: true
Lint/FloatOutOfRange:
Enabled: true
Lint/FormatParameterMismatch:
Enabled: true
Lint/ImplicitStringConcatenation:
Enabled: true
Lint/InheritException:
Enabled: true
Lint/InvalidCharacterLiteral:
Enabled: true
Lint/LiteralInCondition:
Enabled: true
Lint/LiteralInInterpolation:
Enabled: true
Lint/Loop:
Enabled: true
Lint/MultipleCompare:
Enabled: true
Lint/NestedMethodDefinition:
Enabled: true
Lint/NextWithoutAccumulator:
Enabled: true
Lint/NonLocalExitFromIterator:
Enabled: true
Lint/PercentSymbolArray:
Eanbled: true
Lint/RandOne:
Enabled: true
Lint/RequireParentheses:
Enabled: true
Lint/SafeNavigationChain:
Enabled: true
Lint/StringConversionInInterpolation:
Enabled: true
Lint/UnderscorePrefixedVariableName:
Enabled: true
Lint/UnifiedInteger:
Enabled: true
Lint/UnneededDisable:
Enabled: true
Lint/UnreachableCode:
Enabled: true
Lint/UselessAccessModifier:
Enabled: true
Lint/UselessComparison:
Enabled: true
Lint/UselessElseWithoutRescue:
Enabled: true
Lint/UselessSetterCall:
Enabled: true
Lint/Void:
Enabled: true
#
# Disabled Lint
#
# These are disabled per https://github.com/chef/chef/pull/3038
Lint/UnusedBlockArgument:
Enabled: false
Lint/UnusedMethodArgument:
Enabled: false
# We ignore Exceptions a lot
Lint/HandleExceptions:
Enabled: false
# We also decorate Exceptions a lot
Lint/RescueException:
Enabled: false
# we have lots of not-insecure uses of eval
Security/Eval:
Enabled: false
# disabling this will make it easier to stage chefstyle rollouts
Lint/UnneededDisable:
Enabled: false
#
# Performance
#
Performance/Casecmp:
Enabled: true
Performance/CaseWhenSplat:
Enabled: true
Performance/CompareWithBlock:
Enabled: true
Performance/Count:
Enabled: true
Performance/Detect:
Enabled: true
Performance/DoubleStartEndWith:
Enabled: true
Performance/EndWith:
Enabled: true
Performance/FixedSize:
Enabled: true
Performance/FlatMap:
Enabled: true
Performance/HashEachMethods:
Enabled: true
Performance/LstripRstrip:
Enabled: true
Performance/RangeInclude:
Enabled: true
Performance/RedundantBlockCall:
Enabled: true
Performance/RedundantMatch:
Enabled: true
Performance/RedundantMerge:
Enabled: true
Performance/RedundantSortBy:
Enabled: true
Performance/RegexpMatch:
Enabled: true
Performance/ReverseEach:
Enabled: true
Performance/Sample:
Enabled: true
Performance/Size:
Enabled: true
Performance/SortWithBlock:
Enabled: true
Performance/StartWith:
Enabled: true
Performance/StringReplacement:
Enabled: true
Performance/TimesMap:
Enabled: true
#
# Rails
#
Rails/ActionFilter:
Enabled: true
Rails/Date:
Enabled: true
Rails/Delegate:
Enabled: true
Rails/FindBy:
Enabled: true
Rails/FindEach:
Enabled: true
Rails/HasAndBelongsToMany:
Enabled: true
Rails/Output:
Enabled: true
Rails/PluralizationGrammar:
Enabled: true
Rails/ReadWriteAttribute:
Enabled: true
Rails/ScopeArgs:
Enabled: true
Rails/TimeZone:
Enabled: true
Rails/Validation:
Enabled: true
#
# Metrics
#
# Metrics cops are all disabled, there would be too much refactoring
# work to do and we have much higher priorities.
Metrics/AbcSize:
Enabled: false
Metrics/BlockNesting:
Enabled: false
Metrics/BlockLength:
Enabled: false
Metrics/ClassLength:
Enabled: false
Metrics/CyclomaticComplexity:
Enabled: false
Metrics/LineLength:
Enabled: false
Metrics/MethodLength:
Enabled: false
Metrics/ModuleLength:
Enabled: false
Metrics/ParameterLists:
Enabled: false
Metrics/PerceivedComplexity:
Enabled: false
#
# Style
#
Style/AccessModifierIndentation:
Enabled: true
Style/AlignHash:
Enabled: true
Style/AndOr:
Enabled: true
Style/ArrayJoin:
Enabled: true
Style/AsciiIdentifiers:
Enabled: true
Style/Attr:
Enabled: true
Style/BeginBlock:
Enabled: true
Style/BlockDelimiters:
Enabled: true
Style/CharacterLiteral:
Enabled: true
Style/ClassMethods:
Enabled: true
Style/ColonMethodCall:
Enabled: true
Style/CommandLiteral:
Enabled: true
Style/ConstantName:
Enabled: true
Style/DefWithParentheses:
Enabled: true
Style/EachForSimpleLoop:
Enabled: true
Style/ElseAlignment:
Enabled: true
Style/EmptyLineBetweenDefs:
Enabled: true
Style/EmptyLines:
Enabled: true
Style/EmptyLinesAroundAccessModifier:
Enabled: true
Style/EmptyLinesAroundMethodBody:
Enabled: true
Style/EndBlock:
Enabled: true
Style/EndOfLine:
Enabled: true
Style/EvenOdd:
Enabled: true
Style/ExtraSpacing:
Enabled: true
Style/FlipFlop:
Enabled: true
Style/For:
Enabled: true
Style/FrozenStringLiteralComment:
Enabled: true
Style/IfUnlessModifierOfIfUnless:
Enabled: true
Style/IfWithSemicolon:
Enabled: true
Style/IndentAssignment:
Enabled: true
Style/IndentationConsistency:
Enabled: true
Style/IndentationWidth:
Enabled: true
Style/InfiniteLoop:
Enabled: true
Style/InitialIndentation:
Enabled: true
Style/LambdaCall:
Enabled: true
Style/MethodDefParentheses:
Enabled: true
Style/MultilineBlockLayout:
Enabled: true
Style/MultilineIfModifier:
Enabled: true
Style/MultilineIfThen:
Enabled: true
Style/MultilineMemoization:
Enabled: true
Style/MultilineMethodDefinitionBraceLayout:
Enabled: true
Style/MultilineOperationIndentation:
Enabled: true
EnforcedStyle: indented
Style/MultilineTernaryOperator:
Enabled: true
Style/NegatedWhile:
Enabled: true
Style/NestedModifier:
Enabled: true
Style/NestedTernaryOperator:
Enabled: true
Style/NilComparison:
Enabled: true
Style/NonNilCheck:
Enabled: true
# `foo.zero?` is slower and substantially more annoying to read than `foo == 0`
Style/NumericPredicate:
Enabled: true
EnforcedStyle: comparison
Style/OneLineConditional:
Enabled: true
Style/OpMethod:
Enabled: true
Style/OptionalArguments:
Enabled: true
Style/ParenthesesAroundCondition:
Enabled: true
# - The chef source code predominantly uses {} for %,%i,%q,%Q,%r,%w,%W
# - The old 1.9 pickaxe book predominantly uses {} for %,%q,%Q,%r,%w,%W,%x
# - The chef source code does not use %x enough to determine a preference
# - The old 1.9 pickaxe book does not use %i
# - %s is not used in chef code or the pickaxe book, and is %s{} for consistency
Style/PercentLiteralDelimiters:
Enabled: true
PreferredDelimiters:
'%': '{}'
'%i': '{}'
'%I': '{}'
'%q': '{}'
'%Q': '{}'
'%r': '{}'
'%s': '{}'
'%w': '{}'
'%W': '{}'
'%x': '{}'
Style/PercentQLiterals:
Enabled: true
Style/RedundantException:
Enabled: true
Style/RedundantFreeze:
Enabled: true
Style/RescueEnsureAlignment:
Enabled: true
Style/SafeNavigation:
Enabled: true
Style/SelfAssignment:
Enabled: true
Style/Semicolon:
AllowAsExpressionSeparator: true
Enabled: true
# we only 'raise' and do not 'fail'
Style/SignalException:
EnforcedStyle: only_raise
Enabled: true
Style/SpaceAfterColon:
Enabled: true
Style/SpaceAfterComma:
Enabled: true
Style/SpaceAfterMethodName:
Enabled: true
Style/SpaceAfterSemicolon:
Enabled: true
Style/SpaceAroundBlockParameters:
Enabled: true
Style/SpaceAroundEqualsInParameterDefault:
Enabled: true
Style/SpaceAroundOperators:
Enabled: true
Style/SpaceBeforeBlockBraces:
Enabled: true
Style/SpaceBeforeComment:
Enabled: true
Style/SpaceBeforeSemicolon:
Enabled: true
Style/SpaceAroundKeyword:
Enabled: true
Style/SpaceInLambdaLiteral:
Enabled: true
Style/SpaceInsideArrayPercentLiteral:
Enabled: true
Style/SpaceInsideBlockBraces:
Enabled: true
Style/SpaceInsideHashLiteralBraces:
Enabled: true
Style/SpaceInsideRangeLiteral:
Enabled: true
Style/SpaceInsideStringInterpolation:
Enabled: true
Style/StabbyLambdaParentheses:
Enabled: true
# core chef community prefers double quotes over single quotes
Style/StringLiterals:
EnforcedStyle: double_quotes
Enabled: true
Style/StructInheritance:
Enabled: true
Style/SymbolLiteral:
Enabled: true
Style/StringMethods:
Enabled: true
Style/Tab:
Enabled: true
Style/TrailingBlankLines:
Enabled: true
Style/TrailingCommaInArguments:
Enabled: true
# rubocop's default gets this completely backwards
Style/TrailingCommaInLiteral:
Enabled: true
EnforcedStyleForMultiline: comma
Style/TrailingUnderscoreVariable:
Enabled: true
Style/TrailingWhitespace:
Enabled: true
Style/UnneededCapitalW:
Enabled: true
#Style/UnneededPercentQ: # would like to enable this one but its buggy as of 0.35.1
# Enabled: true
Style/VariableName:
Enabled: true
Style/VariableInterpolation:
Enabled: true
Style/WhenThen:
Enabled: true
Style/WhileUntilDo:
Enabled: true
Style/WhileUntilModifier:
Enabled: true
Style/WordArray:
Enabled: true
#
# Disabled Style
#
# As of this commit we have 686 modules and classes without docs.
# This is a cop that we /should/ have enabled, but tactically we can't really enable.
Style/Documentation:
Enabled: false
Style/DocumentationMethod:
Enabled: false
# this makes whitespace formatting of DSL code impossible
Style/SpaceBeforeFirstArg:
Enabled: false
# whitespace in expressions is useful to enhance readability
Style/SpaceInsideBrackets:
Enabled: false
Style/SpaceInsideParens:
Enabled: false
Style/SpaceInsidePercentLiteralDelimiters:
Enabled: false
# more whitespace cops that we allow since they can enhance readability
Style/EmptyLinesAroundBlockBody:
Enabled: false
Style/EmptyLinesAroundClassBody:
Enabled: false
Style/EmptyLinesAroundModuleBody:
Enabled: false
# double negation is perfectly idiomatic ruby
Style/DoubleNegation:
Enabled: false
# format strings are also perfectly idiomatic ruby
Style/FormatString:
Enabled: false
# single line if/unless blocks may read more naturally than modifiers
Style/IfUnlessModifier:
Enabled: false
# we are ruby > 2.0 only so can disable the Encoding cop
Style/Encoding:
Enabled: false
# Dan is -1 on this one: https://github.com/chef/chef/pull/4526#issuecomment-179950045
Style/IndentHash:
Enabled: false
# This is overly aggressive and autofix broke stuff, would need to exclude classes
# - https://github.com/chef/chef/pull/4541
Style/TrivialAccessors:
Enabled: false
# Not a lot of offenses and this seems to catch code that looks otherwise fine to my eye
Style/MultilineBlockChain:
Enabled: false
# We see nothing at all wrong with a trailing `rescue nil`
Style/RescueModifier:
Enabled: false
# Resulted in a bit of a bikeshed over names with unicode chars vs silently hidden unicode chars in comments
Style/AsciiComments:
Enabled: false
# Parens around ternaries often make them more readable and reduces cognitive load over operator precidence
Style/TernaryParentheses:
Enabled: false
# Underscores in numbers are super ugly for port numbers, freebsd versions, etc.
# If we could mandate that this gets turned on only for numbers >= 1e9 which require three _'s then maybe.
Style/NumericLiterals:
Enabled: false
# I tend to find this more readable than long elsif chains
Style/EmptyCaseCondition:
Enabled: false
# This didn't quite do what we need
Style/MultilineArrayBraceLayout:
Enabled: false
# This rule isn't smart enough to figure out accessors vs. things that set stuff on the system (e.g. set_member method in group providers)
Style/AccessorMethodName:
Enabled: false
# Perl backrefs are just fine and the alternative is a lot of typing.
Style/PerlBackrefs:
Enabled: false