diff options
Diffstat (limited to '.rubocop.yml')
-rw-r--r-- | .rubocop.yml | 813 |
1 files changed, 739 insertions, 74 deletions
diff --git a/.rubocop.yml b/.rubocop.yml index 4226671d3a..8fd8c2c588 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,146 +1,811 @@ -inherit_from: - - .rubocop_todo.yml - AllCops: + DisabledByDefault: true TargetRubyVersion: 2.3 Exclude: - tmp/**/* - lib/bundler/vendor/**/* DisplayCopNames: true +# Bundler + +Bundler/DuplicatedGem: + Enabled: true + +Bundler/InsecureProtocolSource: + Enabled: true + +Bundler/OrderedGems: + Enabled: true + +# Gemspec + +Gemspec/OrderedDependencies: + Enabled: true + +Gemspec/RequiredRubyVersion: + Enabled: true + # Lint -# They are idiomatic -Lint/AssignmentInCondition: - Enabled: false +Lint/AmbiguousOperator: + Enabled: true + +Lint/AmbiguousRegexpLiteral: + Enabled: true + +Lint/BigDecimalNew: + Enabled: true + +Lint/BooleanSymbol: + Enabled: true + +Lint/Debugger: + Enabled: true + +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/EndInMethod: + Enabled: true + +Lint/EnsureReturn: + Enabled: true + +Lint/ErbNewArguments: + Enabled: true + +Lint/FlipFlop: + Enabled: true + +Lint/FloatOutOfRange: + Enabled: true + +Lint/FormatParameterMismatch: + Enabled: true + +Lint/ImplicitStringConcatenation: + Enabled: true + +Lint/InheritException: + Enabled: true + +Lint/LiteralAsCondition: + Enabled: true + +Lint/LiteralInInterpolation: + Enabled: true + +Lint/Loop: + Enabled: true -Lint/UnusedMethodArgument: - Enabled: false +Lint/MultipleCompare: + Enabled: true + +Lint/NestedPercentLiteral: + Enabled: true + +Lint/NextWithoutAccumulator: + Enabled: true + +Lint/NonLocalExitFromIterator: + Enabled: true + +Lint/OrderedMagicComments: + Enabled: true + +Lint/ParenthesesAsGroupedExpression: + Enabled: true + +Lint/PercentStringArray: + Enabled: true + +Lint/PercentSymbolArray: + Enabled: true + +Lint/RandOne: + Enabled: true + +Lint/RedundantWithIndex: + Enabled: true + +Lint/RedundantWithObject: + Enabled: true + +Lint/RegexpAsCondition: + Enabled: true + +Lint/RequireParentheses: + Enabled: true + +Lint/RescueException: + Enabled: true + +Lint/RescueType: + Enabled: true + +Lint/ReturnInVoidContext: + Enabled: true + +Lint/SafeNavigationChain: + Enabled: true + +Lint/SafeNavigationConsistency: + Enabled: true Lint/ScriptPermission: + Enabled: true Exclude: - 'lib/bundler/templates/Executable' +Lint/ShadowedArgument: + Enabled: true + +Lint/ShadowingOuterLocalVariable: + Enabled: true + +Lint/StringConversionInInterpolation: + Enabled: true + +Lint/Syntax: + Enabled: true + +Lint/UnderscorePrefixedVariableName: + Enabled: true + +Lint/UnifiedInteger: + Enabled: true + +Lint/UnneededCopDisableDirective: + Enabled: true + +Lint/UnneededCopEnableDirective: + Enabled: true + +Lint/UnneededSplatExpansion: + Enabled: true + +Lint/UnreachableCode: + Enabled: true + +Lint/UnusedBlockArgument: + Enabled: true + +Lint/UriEscapeUnescape: + Enabled: true + +Lint/UriRegexp: + Enabled: true + +Lint/UselessComparison: + Enabled: true + +Lint/UselessElseWithoutRescue: + Enabled: true + +Lint/UselessSetterCall: + Enabled: true + +Lint/Void: + Enabled: true + # Layout Layout/AccessModifierIndentation: + Enabled: true EnforcedStyle: outdent + Exclude: + - 'lib/bundler/cli.rb' + - 'lib/bundler/definition.rb' + - 'lib/bundler/feature_flag.rb' + - 'lib/bundler/gem_helpers.rb' + - 'lib/bundler/index.rb' + - 'lib/bundler/remote_specification.rb' + - 'lib/bundler/shared_helpers.rb' + - 'lib/bundler/source/path.rb' + - 'spec/realworld/gemfile_source_header_spec.rb' + +Layout/AlignArray: + Enabled: true Layout/AlignParameters: + Enabled: true EnforcedStyle: with_fixed_indentation +Layout/BlockAlignment: + Enabled: true + +Layout/CaseIndentation: + Enabled: true + +Layout/ClosingParenthesisIndentation: + Enabled: true + +Layout/CommentIndentation: + Enabled: true + +Layout/ConditionPosition: + Enabled: true + +Layout/DefEndAlignment: + Enabled: true + +Layout/DotPosition: + Enabled: true + EnforcedStyle: trailing + +Layout/ElseAlignment: + Enabled: true + +Layout/EmptyComment: + Enabled: true + +Layout/EmptyLineAfterMagicComment: + Enabled: true + +Layout/EmptyLineBetweenDefs: + Enabled: true + +Layout/EmptyLines: + Enabled: true + +Layout/EmptyLinesAroundAccessModifier: + Enabled: true + +Layout/EmptyLinesAroundArguments: + Enabled: true + +Layout/EmptyLinesAroundBeginBody: + Enabled: true + +Layout/EmptyLinesAroundBlockBody: + Enabled: true + +Layout/EmptyLinesAroundClassBody: + Enabled: true + +Layout/EmptyLinesAroundExceptionHandlingKeywords: + Enabled: true + +Layout/EmptyLinesAroundMethodBody: + Enabled: true + +Layout/EmptyLinesAroundModuleBody: + Enabled: true + Layout/EndAlignment: + Enabled: true EnforcedStyleAlignWith: variable AutoCorrect: true +Layout/EndOfLine: + Enabled: true + +Layout/ExtraSpacing: + Enabled: true + +Layout/FirstParameterIndentation: + Enabled: true + +Layout/IndentArray: + Enabled: true + EnforcedStyle: consistent + +Layout/IndentAssignment: + Enabled: true + +Layout/IndentHash: + Enabled: true + EnforcedStyle: special_inside_parentheses + +Layout/IndentationConsistency: + Enabled: true + +Layout/IndentationWidth: + Enabled: true + +Layout/InitialIndentation: + Enabled: true + +Layout/LeadingBlankLines: + Enabled: true + +Layout/LeadingCommentSpace: + Enabled: true + +Layout/MultilineArrayBraceLayout: + Enabled: true + +Layout/MultilineBlockLayout: + Enabled: true + +Layout/MultilineHashBraceLayout: + Enabled: true + +Layout/MultilineMethodCallBraceLayout: + Enabled: true + +Layout/MultilineMethodDefinitionBraceLayout: + Enabled: true + Layout/MultilineOperationIndentation: + Enabled: true EnforcedStyle: indented +Layout/SpaceBeforeComma: + Enabled: true + +Layout/SpaceBeforeComment: + Enabled: true + +Layout/SpaceBeforeFirstArg: + Enabled: true + +Layout/SpaceBeforeSemicolon: + Enabled: true + +Layout/SpaceInLambdaLiteral: + Enabled: true + +Layout/SpaceInsideArrayLiteralBrackets: + Enabled: true + +Layout/SpaceInsideArrayPercentLiteral: + Enabled: true + Layout/SpaceInsideBlockBraces: + Enabled: true SpaceBeforeBlockParameters: false -Layout/DotPosition: - EnforcedStyle: trailing +Layout/SpaceInsideHashLiteralBraces: + Enabled: true + +Layout/SpaceInsideParens: + Enabled: true + +Layout/SpaceInsidePercentLiteralDelimiters: + Enabled: true + +Layout/SpaceInsideRangeLiteral: + Enabled: true + +Layout/SpaceInsideReferenceBrackets: + Enabled: true + +Layout/SpaceInsideStringInterpolation: + Enabled: true + +Layout/Tab: + Enabled: true + +Layout/TrailingBlankLines: + Enabled: true + +Layout/TrailingWhitespace: + Enabled: true + +# Naming + +Naming/AsciiIdentifiers: + Enabled: true + +Naming/BinaryOperatorParameterName: + Enabled: true + +Naming/ClassAndModuleCamelCase: + Enabled: true + +Naming/ConstantName: + Enabled: true + +Naming/FileName: + Enabled: true + +Naming/HeredocDelimiterCase: + Enabled: true + +Naming/MethodName: + Enabled: true + +Naming/UncommunicativeBlockParamName: + Enabled: true + +Naming/VariableName: + Enabled: true + +Naming/VariableNumber: + Enabled: true + +# Performance + +Performance/Casecmp: + 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/LstripRstrip: + Enabled: true + +Performance/RedundantSortBy: + Enabled: true + +Performance/RegexpMatch: + Enabled: true + +Performance/ReverseEach: + Enabled: true + +Performance/Sample: + Enabled: true + +Performance/Size: + Enabled: true + +Performance/StartWith: + Enabled: true + +Performance/StringReplacement: + Enabled: true + +Performance/TimesMap: + Enabled: true + +Performance/UriDefaultParser: + Enabled: true + +# Security + +Security/JSONLoad: + Enabled: true # Style Style/Alias: + Enabled: true EnforcedStyle: prefer_alias_method -Style/FrozenStringLiteralComment: +Style/AndOr: + Enabled: true EnforcedStyle: always -Style/GuardClause: - Enabled: false +Style/ArrayJoin: + Enabled: true -Style/MultilineBlockChain: - Enabled: false +Style/AsciiComments: + Enabled: true -Style/PerlBackrefs: - Enabled: false +Style/Attr: + Enabled: true -Style/SingleLineBlockParams: - Enabled: false +Style/BarePercentLiterals: + Enabled: true -Style/TrivialAccessors: - Enabled: false +Style/BeginBlock: + Enabled: true -# We adopted raise instead of fail. -Style/SignalException: - EnforcedStyle: only_raise +Style/BlockComments: + Enabled: true -Style/StringLiterals: - EnforcedStyle: double_quotes +Style/BlockDelimiters: + Enabled: true -Style/StringLiteralsInInterpolation: - EnforcedStyle: double_quotes +Style/BracesAroundHashParameters: + Enabled: true -# Having these make it easier to *not* forget to add one when adding a new -# value and you can simply copy the previous line. -Style/TrailingCommaInArrayLiteral: - EnforcedStyleForMultiline: comma +Style/CharacterLiteral: + Enabled: true -Style/TrailingCommaInHashLiteral: - EnforcedStyleForMultiline: comma +Style/ClassCheck: + Enabled: true -Style/TrailingUnderscoreVariable: - Enabled: false +Style/ClassMethods: + Enabled: true -# `String.new` is preferred style with enabled frozen string literal -Style/EmptyLiteral: - Enabled: false +Style/ClassVars: + Enabled: true -# 1.8.7 support +Style/ColonMethodCall: + Enabled: true + +Style/ColonMethodDefinition: + Enabled: true + +Style/CommandLiteral: + Enabled: true + +Style/CommentAnnotation: + Enabled: true + +Style/DefWithParentheses: + Enabled: true + +Style/Dir: + Enabled: true + +Style/DoubleNegation: + Enabled: true +Style/EachForSimpleLoop: + Enabled: true + +Style/EmptyBlockParameter: + Enabled: true + +Style/EmptyCaseCondition: + Enabled: true + +Style/EmptyElse: + Enabled: true + +Style/EmptyLambdaParameter: + Enabled: true + +Style/Encoding: + Enabled: true + +Style/EndBlock: + Enabled: true + +Style/EvenOdd: + Enabled: true + +Style/For: + Enabled: true + +Style/FormatString: + Enabled: true + +Style/FrozenStringLiteralComment: + Enabled: true + EnforcedStyle: always + +# 1.8.7 support Style/HashSyntax: + Enabled: true EnforcedStyle: hash_rockets -Style/Lambda: - Enabled: false +Style/IdenticalConditionalBranches: + Enabled: true + +Style/IfInsideElse: + Enabled: true -Style/EachWithObject: - Enabled: false +Style/IfUnlessModifierOfIfUnless: + Enabled: true -Style/SpecialGlobalVars: - Enabled: false +Style/IfWithSemicolon: + Enabled: true -Style/TrailingCommaInArguments: - Enabled: false +Style/InfiniteLoop: + Enabled: true -Performance/FlatMap: - Enabled: false +Style/LambdaCall: + Enabled: true -Security/YAMLLoad: - Enabled: false +Style/LineEndConcatenation: + Enabled: true -# Metrics +Style/MethodCallWithoutArgsParentheses: + Enabled: true -# We've chosen to use Rubocop only for style, and not for complexity or quality checks. -Metrics/ClassLength: - Enabled: false +Style/MethodDefParentheses: + Enabled: true -Metrics/ModuleLength: - Enabled: false +Style/MinMax: + Enabled: true -Metrics/MethodLength: - Enabled: false +Style/MixinGrouping: + Enabled: true -Metrics/BlockNesting: - Enabled: false +Style/MultilineIfThen: + Enabled: true -Metrics/AbcSize: - Enabled: false +Style/MultilineMemoization: + Enabled: true -Metrics/CyclomaticComplexity: - Enabled: false +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/NilComparison: + Enabled: true + +Style/NonNilCheck: + Enabled: true + +Style/Not: + Enabled: true + +Style/NumericLiteralPrefix: + Enabled: true + +Style/NumericLiterals: + Enabled: true + +Style/OneLineConditional: + Enabled: true + +Style/OptionalArguments: + Enabled: true + +Style/OrAssignment: + Enabled: true + +Style/ParallelAssignment: + Enabled: true + +Style/ParenthesesAroundCondition: + Enabled: true + +Style/PercentLiteralDelimiters: + Enabled: true + +Style/PercentQLiterals: + Enabled: true + +Style/PreferredHashMethods: + Enabled: true + +Style/Proc: + Enabled: true + +Style/RandomWithOffset: + Enabled: true + +Style/RedundantBegin: + Enabled: true + +Style/RedundantConditional: + Enabled: true + +Style/RedundantException: + Enabled: true + +Style/RedundantParentheses: + Enabled: true + +Style/RedundantSelf: + Enabled: true + +Style/RegexpLiteral: + Enabled: true + +Style/RescueModifier: + Enabled: true + +Style/RescueStandardError: + Enabled: true + +Style/SelfAssignment: + Enabled: true + +Style/Semicolon: + Enabled: true + +# We adopted raise instead of fail. +Style/SignalException: + Enabled: true + EnforcedStyle: only_raise + +Style/SingleLineMethods: + Enabled: true + +Style/StabbyLambdaParentheses: + Enabled: true + +Style/StderrPuts: + Enabled: true + +Style/StringLiterals: + Enabled: true + EnforcedStyle: double_quotes + +Style/StringLiteralsInInterpolation: + Enabled: true + EnforcedStyle: double_quotes + +Style/StructInheritance: + Enabled: true + +Style/SymbolArray: + Enabled: true + EnforcedStyle: brackets + +Style/SymbolLiteral: + Enabled: true + +Style/SymbolProc: + Enabled: true + +Style/TernaryParentheses: + Enabled: true + +Style/TrailingBodyOnClass: + Enabled: true + +Style/TrailingBodyOnMethodDefinition: + Enabled: true + +Style/TrailingBodyOnModule: + Enabled: true + +# Having these make it easier to *not* forget to add one when adding a new +# value and you can simply copy the previous line. +Style/TrailingCommaInArrayLiteral: + Enabled: true + EnforcedStyleForMultiline: comma + +Style/TrailingCommaInHashLiteral: + Enabled: true + EnforcedStyleForMultiline: comma -Metrics/ParameterLists: - Enabled: false +Style/TrailingMethodEndStatement: + Enabled: true -Metrics/BlockLength: - Enabled: false +Style/UnlessElse: + Enabled: true -# It will be obvious which code is complex, Rubocop should only lint simple -# rules for us. -Metrics/PerceivedComplexity: - Enabled: false +Style/YodaCondition: + Enabled: true |