Skip to content

Instantly share code, notes, and snippets.

@stephaniewilkinson
Created July 26, 2018 16:42
Show Gist options
  • Save stephaniewilkinson/1eabc6641e5e4d94cca1db180f8e671b to your computer and use it in GitHub Desktop.
Save stephaniewilkinson/1eabc6641e5e4d94cca1db180f8e671b to your computer and use it in GitHub Desktop.
AllCops:
TargetRubyVersion: 2.5.1
EnabledByDefault: true
#################### Bundler ##############################
Bundler/DuplicatedGem:
Enabled: true
Bundler/OrderedGems:
Enabled: true
#################### Layout ###############################
Layout/AccessModifierIndentation:
EnforcedStyle: indent
IndentationWidth: ~
Layout/AlignArray:
Enabled: true
Layout/AlignHash:
EnforcedHashRocketStyle: key
SupportedHashRocketStyles:
- key
- separator
- table
EnforcedColonStyle: key
SupportedColonStyles:
- key
- separator
- table
EnforcedLastArgumentHashStyle: always_inspect
SupportedLastArgumentHashStyles:
- always_inspect
- always_ignore
- ignore_implicit
- ignore_explicit
Layout/AlignParameters:
EnforcedStyle: with_first_parameter
SupportedStyles:
- with_first_parameter
- with_fixed_indentation
IndentationWidth: ~
Layout/BlockEndNewline:
Enabled: true
Layout/CaseIndentation:
EnforcedStyle: end
SupportedStyles:
- case
- end
IndentOneStep: false
IndentationWidth: ~
Layout/ClosingParenthesisIndentation:
Enabled: true
Layout/CommentIndentation:
Enabled: true
Layout/DotPosition:
EnforcedStyle: leading
SupportedStyles:
- leading
- trailing
Layout/ElseAlignment:
Enabled: true
Layout/EmptyLineAfterMagicComment:
Enabled: true
Layout/EmptyLines:
Enabled: true
Layout/EmptyLinesAroundAccessModifier:
Enabled: true
Layout/EmptyLinesAroundBeginBody:
Enabled: true
Layout/EmptyLineBetweenDefs:
AllowAdjacentOneLineDefs: false
NumberOfEmptyLines: 1
Layout/EmptyLinesAroundBlockBody:
EnforcedStyle: no_empty_lines
SupportedStyles:
- empty_lines
- no_empty_lines
Layout/EmptyLinesAroundExceptionHandlingKeywords:
Enabled: true
Layout/EmptyLinesAroundMethodBody:
Enabled: true
Layout/EmptyLinesAroundClassBody:
EnforcedStyle: no_empty_lines
SupportedStyles:
- empty_lines
- empty_lines_except_namespace
- empty_lines_special
- no_empty_lines
Layout/EmptyLinesAroundModuleBody:
EnforcedStyle: no_empty_lines
SupportedStyles:
- empty_lines
- empty_lines_except_namespace
- empty_lines_special
- no_empty_lines
Layout/EndOfLine:
EnforcedStyle: lf
Layout/ExtraSpacing:
AllowForAlignment: true
ForceEqualSignAlignment: false
Layout/FirstMethodArgumentLineBreak:
Enabled: true
Layout/FirstMethodParameterLineBreak:
Enabled: true
Layout/FirstParameterIndentation:
EnforcedStyle: special_for_inner_method_call_in_parentheses
SupportedStyles:
- consistent
- special_for_inner_method_call
- special_for_inner_method_call_in_parentheses
IndentationWidth: ~
Layout/IndentationConsistency:
EnforcedStyle: normal
SupportedStyles:
- normal
- rails
Layout/IndentationWidth:
Width: 2
IgnoredPatterns: []
Layout/IndentArray:
EnforcedStyle: consistent
SupportedStyles:
- special_inside_parentheses
- consistent
- align_brackets
IndentationWidth: ~
Layout/IndentAssignment:
IndentationWidth: ~
Layout/IndentHash:
EnforcedStyle: consistent
SupportedStyles:
- special_inside_parentheses
- consistent
- align_braces
IndentationWidth: ~
Layout/IndentHeredoc:
EnforcedStyle: auto_detection
SupportedStyles:
- auto_detection
- squiggly
- active_support
- powerpack
- unindent
Layout/IndentationConsistency:
Enabled: true
Layout/IndentationWidth:
Enabled: true
Layout/InitialIndentation:
Enabled: true
Layout/LeadingCommentSpace:
Enabled: true
Layout/MultilineArrayBraceLayout:
EnforcedStyle: symmetrical
SupportedStyles:
- symmetrical
- new_line
- same_line
Layout/MultilineAssignmentLayout:
SupportedTypes:
- block
- case
- class
- if
- kwbegin
- module
EnforcedStyle: same_line
SupportedStyles:
- same_line
- new_line
Layout/MultilineBlockLayout:
Enabled: true
Layout/MultilineHashBraceLayout:
EnforcedStyle: symmetrical
SupportedStyles:
- symmetrical
- new_line
- same_line
Layout/MultilineMethodCallBraceLayout:
EnforcedStyle: symmetrical
SupportedStyles:
- symmetrical
- new_line
- same_line
Layout/MultilineMethodCallIndentation:
EnforcedStyle: indented_relative_to_receiver
SupportedStyles:
- aligned
- indented
- indented_relative_to_receiver
IndentationWidth: ~
Layout/MultilineMethodDefinitionBraceLayout:
EnforcedStyle: symmetrical
SupportedStyles:
- symmetrical
- new_line
- same_line
Layout/MultilineOperationIndentation:
EnforcedStyle: aligned
SupportedStyles:
- aligned
- indented
IndentationWidth: ~
Layout/RescueEnsureAlignment:
Enabled: true
Layout/SpaceAfterColon:
Enabled: true
Layout/SpaceAfterComma:
Enabled: true
Layout/SpaceAfterMethodName:
Enabled: true
Layout/SpaceAfterNot:
Enabled: true
Layout/SpaceAfterSemicolon:
Enabled: true
Layout/SpaceAroundBlockParameters:
EnforcedStyleInsidePipes: no_space
SupportedStylesInsidePipes:
- space
- no_space
Layout/SpaceAroundEqualsInParameterDefault:
EnforcedStyle: space
SupportedStyles:
- space
- no_space
Layout/SpaceAroundKeyword:
Enabled: true
Layout/SpaceAroundOperators:
AllowForAlignment: true
Layout/SpaceBeforeBlockBraces:
EnforcedStyle: space
SupportedStyles:
- space
- no_space
Layout/SpaceBeforeComma:
Enabled: true
Layout/SpaceBeforeComment:
Enabled: true
Layout/SpaceBeforeFirstArg:
AllowForAlignment: true
Layout/SpaceBeforeSemicolon:
Enabled: true
Layout/SpaceInLambdaLiteral:
EnforcedStyle: require_no_space
SupportedStyles:
- require_no_space
- require_space
Layout/SpaceInsideArrayPercentLiteral:
Enabled: true
Layout/SpaceInsideBlockBraces:
EnforcedStyle: space
SupportedStyles:
- space
- no_space
EnforcedStyleForEmptyBraces: space
SupportedStylesForEmptyBraces:
- space
- no_space
SpaceBeforeBlockParameters: true
Layout/SpaceInsideHashLiteralBraces:
EnforcedStyle: no_space
SupportedStyles:
- space
- no_space
- compact
EnforcedStyleForEmptyBraces: no_space
SupportedStylesForEmptyBraces:
- space
- no_space
Layout/SpaceInsideParens:
Enabled: true
Layout/SpaceInsidePercentLiteralDelimiters:
Enabled: true
Layout/SpaceInsideRangeLiteral:
Enabled: true
Layout/SpaceInsideStringInterpolation:
EnforcedStyle: no_space
SupportedStyles:
- space
- no_space
Layout/Tab:
Enabled: true
Layout/TrailingBlankLines:
EnforcedStyle: final_newline
SupportedStyles:
- final_newline
- final_blank_line
Layout/TrailingWhitespace:
Enabled: true
Layout/BlockAlignment:
EnforcedStyleAlignWith: either
Layout/ConditionPosition:
Enabled: true
Layout/DefEndAlignment:
Enabled: true
EnforcedStyleAlignWith: start_of_line
Layout/EndAlignment:
EnforcedStyleAlignWith: variable
SupportedStylesAlignWith:
- keyword
- variable
- start_of_line
#################### Lint ##################################
Lint/CircularArgumentReference:
Enabled: true
Lint/Debugger:
Enabled: true
Include:
- app/**/*.rb
Lint/DeprecatedClassMethods:
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/EmptyWhen:
Enabled: true
Lint/EndInMethod:
Enabled: true
Lint/EnsureReturn:
Enabled: true
Lint/FloatOutOfRange:
Enabled: true
Lint/FormatParameterMismatch:
Enabled: true
Lint/HandleExceptions:
Enabled: true
Lint/ImplicitStringConcatenation:
Enabled: true
Lint/IneffectiveAccessModifier:
Enabled: true
Lint/InheritException:
EnforcedStyle: runtime_error
SupportedStyles:
- runtime_error
- standard_error
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/ParenthesesAsGroupedExpression:
Enabled: true
Lint/PercentStringArray:
Enabled: true
Lint/PercentSymbolArray:
Enabled: true
Lint/RandOne:
Enabled: true
Lint/RescueException:
Enabled: true
Lint/RescueType:
Enabled: true
Lint/SafeNavigationChain:
Whitelist:
- present?
- blank?
- presence
Lint/ScriptPermission:
Enabled: true
Lint/ShadowedException:
Enabled: true
Lint/ShadowingOuterLocalVariable:
Enabled: true
Lint/StringConversionInInterpolation:
Enabled: true
Lint/UnderscorePrefixedVariableName:
Enabled: true
Lint/UnifiedInteger:
Enabled: true
Lint/UnreachableCode:
Enabled: true
Lint/UnusedBlockArgument:
IgnoreEmptyBlocks: true
AllowUnusedKeywordArguments: false
Lint/UnusedMethodArgument:
AllowUnusedKeywordArguments: false
IgnoreEmptyMethods: true
Lint/UselessAccessModifier:
Enabled: true
Lint/UselessAssignment:
Enabled: true
Lint/UselessComparison:
Enabled: true
Lint/UselessElseWithoutRescue:
Enabled: true
#################### Performance ###########################
Performance/DoubleStartEndWith:
IncludeActiveSupportAliases: true
Performance/RedundantMerge:
MaxKeyValuePairs: 2
#################### Metrics ###############################
Metrics/AbcSize:
Max: 35
Metrics/BlockLength:
Max: 200
Metrics/ClassLength:
Max: 190
Metrics/CyclomaticComplexity:
Max: 20
Metrics/LineLength:
Max: 160
Metrics/MethodLength:
CountComments: false
Max: 50
Metrics/ParameterLists:
Max: 5
CountKeywordArgs: true
Metrics/PerceivedComplexity:
Max: 20
#################### Naming ################################
Naming/AccessorMethodName:
Enabled: true
Naming/ClassAndModuleCamelCase:
Enabled: true
Naming/ConstantName:
Enabled: true
Naming/MethodName:
Enabled: true
Naming/PredicateName:
NamePrefix:
- is_
- has_
- have_
NamePrefixBlacklist:
- is_
- has_
- have_
NameWhitelist:
- is_a
Naming/VariableName:
EnforcedStyle: snake_case
SupportedStyles:
- snake_case
- camelCase
Naming/VariableNumber:
Enabled: true
EnforcedStyle: snake_case
#################### Rails ################################
Rails/Output:
Enabled: false
#################### Styles ################################
Style/Alias:
EnforcedStyle: prefer_alias
SupportedStyles:
- prefer_alias
- prefer_alias_method
Style/ArrayJoin:
Enabled: true
Style/AsciiComments:
Enabled: true
Naming/AsciiIdentifiers:
Enabled: true
Style/Attr:
Enabled: true
Style/AutoResourceCleanup:
Enabled: true
Style/BarePercentLiterals:
EnforcedStyle: bare_percent
SupportedStyles:
- percent_q
- bare_percent
Style/BeginBlock:
Enabled: true
Style/BlockComments:
Enabled: true
Style/BlockDelimiters:
EnforcedStyle: line_count_based
SupportedStyles:
- line_count_based
- semantic
- braces_for_chaining
ProceduralMethods:
- benchmark
- bm
- bmbm
- create
- each_with_object
- measure
- new
- realtime
- tap
- with_object
FunctionalMethods:
- let
- let!
- subject
- watch
IgnoredMethods:
- lambda
- proc
- it
Style/BracesAroundHashParameters:
EnforcedStyle: context_dependent
SupportedStyles:
- braces
- no_braces
- context_dependent
Style/CaseEquality:
Enabled: true
Style/ClassMethods:
Enabled: true
Style/ClassVars:
Enabled: true
Style/CollectionMethods:
PreferredMethods:
collect: 'map'
collect!: 'map!'
inject: 'reduce'
detect: 'find'
find_all: 'select'
Style/ColonMethodCall:
Enabled: true
Style/CommandLiteral:
Enabled: true
Style/CommentAnnotation:
Enabled: true
Style/ConditionalAssignment:
EnforcedStyle: assign_to_condition
SupportedStyles:
- assign_to_condition
- assign_inside_condition
SingleLineConditionsOnly: true
IncludeTernaryExpressions: true
Style/Copyright:
Enabled: false
Style/DefWithParentheses:
Enabled: true
Style/Documentation:
Enabled: false
Style/DocumentationMethod:
Enabled: false
Style/EachForSimpleLoop:
Enabled: true
Style/EachWithObject:
Enabled: true
Style/EmptyLiteral:
Enabled: true
Style/EndBlock:
Enabled: true
Style/EvenOdd:
Enabled: true
Naming/FileName:
Enabled: true
Style/FlipFlop:
Enabled: true
Style/For:
EnforcedStyle: each
SupportedStyles:
- for
- each
Style/FormatString:
Enabled: true
Style/FormatStringToken:
Enabled: true
EnforcedStyle: template
Style/FrozenStringLiteralComment:
EnforcedStyle: always
SupportedStyles:
- when_needed
- always
- never
Style/GuardClause:
Enabled: true
Style/GlobalVars:
AllowedVariables: []
Style/HashSyntax:
EnforcedStyle: ruby19
SupportedStyles:
- ruby19
- hash_rockets
- no_mixed_keys
- ruby19_no_mixed_keys
UseHashRocketsWithSymbolValues: false
PreferHashRocketsForNonAlnumEndingSymbols: false
Style/IdenticalConditionalBranches:
Enabled: true
Style/IfInsideElse:
Enabled: true
Style/IfWithSemicolon:
Enabled: true
Style/ImplicitRuntimeError:
Enabled: false
Style/InfiniteLoop:
Enabled: true
Style/InverseMethods:
Enabled: true
InverseMethods:
:any?: :none?
:even?: :odd?
:==: :!=
:=~: :!~
:<: :>=
:>: :<=
InverseBlocks:
:select: :reject
:select!: :reject!
Style/LambdaCall:
Enabled: true
Style/LineEndConcatenation:
Enabled: true
Style/Lambda:
EnforcedStyle: literal
SupportedStyles:
- line_count_dependent
- lambda
- literal
Style/MethodDefParentheses:
Enabled: false
Style/MethodCallWithArgsParentheses:
Enabled: false
Style/MethodCallWithoutArgsParentheses:
Enabled: true
Style/MissingElse:
Enabled: false
Style/MixinGrouping:
Enabled: true
Style/MultilineIfModifier:
Enabled: true
Style/MultilineMemoization:
Enabled: true
Style/MultilineTernaryOperator:
Enabled: true
Style/MultipleComparison:
Enabled: true
Style/MutableConstant:
Enabled: true
Style/NegatedIf:
Enabled: true
Style/NegatedWhile:
Enabled: true
Style/NestedModifier:
Enabled: true
Style/NestedParenthesizedCalls:
Enabled: true
Style/NestedTernaryOperator:
Enabled: true
Style/Next:
Enabled: true
Style/NonNilCheck:
IncludeSemanticChanges: false
Style/NumericLiteralPrefix:
Enabled: true
Style/NumericLiterals:
MinDigits: 5
Strict: false
Style/NumericPredicate:
Enabled: true
Style/OneLineConditional:
Enabled: true
Style/OptionHash:
Enabled: true
Style/ParallelAssignment:
Enabled: true
Style/OptionalArguments:
Enabled: true
Style/ParenthesesAroundCondition:
AllowSafeAssignment: true
Style/PercentLiteralDelimiters:
Enabled: true
Style/PercentQLiterals:
Enabled: true
Style/PerlBackrefs:
Enabled: true
Style/PreferredHashMethods:
Enabled: true
Style/RaiseArgs:
Enabled: true
Style/RedundantReturn:
AllowMultipleReturnValues: false
Style/RedundantException:
Enabled: true
Style/RedundantFreeze:
Enabled: true
Style/RedundantParentheses:
Enabled: true
Style/RedundantReturn:
Enabled: true
Style/RedundantSelf:
Enabled: true
Style/RegexpLiteral:
Enabled: true
Style/RescueModifier:
Enabled: true
Style/SafeNavigation:
Enabled: true
Style/SelfAssignment:
Enabled: true
Style/Semicolon:
AllowAsExpressionSeparator: false
Style/Send:
Enabled: false
Style/SingleLineBlockParams:
Enabled: true
Style/SingleLineMethods:
Enabled: true
Style/SpecialGlobalVars:
Enabled: true
Style/StringLiterals:
EnforcedStyle: single_quotes
SupportedStyles:
- single_quotes
- double_quotes
ConsistentQuotesInMultiline: false
Style/StringLiteralsInInterpolation:
EnforcedStyle: single_quotes
SupportedStyles:
- single_quotes
- double_quotes
Style/SymbolArray:
EnforcedStyle: percent
SupportedStyles:
- percent
- brackets
Style/SymbolLiteral:
Enabled: true
Style/SymbolProc:
Enabled: true
Style/TernaryParentheses:
Enabled: true
Style/TrailingCommaInArguments:
EnforcedStyleForMultiline: no_comma
SupportedStylesForMultiline:
- comma
- consistent_comma
- no_comma
Style/TrailingUnderscoreVariable:
Enabled: true
Style/TrivialAccessors:
ExactNameMatch: true
AllowPredicates: true
AllowDSLWriters: false
IgnoreClassMethods: false
Whitelist:
- to_ary
- to_a
- to_c
- to_enum
- to_h
- to_hash
- to_i
- to_int
- to_io
- to_open
- to_path
- to_proc
- to_r
- to_regexp
- to_str
- to_s
- to_sym
Style/UnneededCapitalW:
Enabled: true
Style/UnneededInterpolation:
Enabled: true
Style/UnneededPercentQ:
Enabled: true
Style/VariableInterpolation:
Enabled: true
Style/WhenThen:
Enabled: true
Style/WhileUntilDo:
Enabled: true
Style/WhileUntilModifier:
Enabled: true
Style/WordArray:
EnforcedStyle: percent
SupportedStyles:
- percent
- brackets
MinSize: 0
WordRegex: !ruby/regexp '/\A[\p{Word}\n\t]+\z/'
Style/YodaCondition:
Enabled: true
Style/ZeroLengthPredicate:
Enabled: true
#################### Security #############################
Security/Eval:
Enabled: true
Security/JSONLoad:
Enabled: true
Security/MarshalLoad:
Enabled: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment