config/enabled.yml in cookstyle-1.4.0 vs config/enabled.yml in cookstyle-2.0.0

- old
+ new

@@ -1,42 +1,357 @@ # These are all the cops that are enabled in the default configuration. -Style/AccessModifierIndentation: +#################### Layout ############################### + +Layout/AccessModifierIndentation: Description: Check indentation of private/protected visibility modifiers. StyleGuide: '#indent-public-private-protected' Enabled: true -Style/AccessorMethodName: - Description: Check the naming of accessor methods for get_/set_. - StyleGuide: '#accessor_mutator_method_names' - Enabled: true - -Style/Alias: - Description: 'Use alias instead of alias_method.' - StyleGuide: '#alias-method' - Enabled: true - -Style/AlignArray: +Layout/AlignArray: Description: >- Align the elements of an array literal if they span more than one line. StyleGuide: '#align-multiline-arrays' Enabled: true -Style/AlignHash: +Layout/AlignHash: Description: >- Align the elements of a hash literal if they span more than one line. Enabled: true -Style/AlignParameters: +Layout/AlignParameters: Description: >- Align the parameters of a method call if they span more than one line. StyleGuide: '#no-double-indent' Enabled: true +Layout/BlockEndNewline: + Description: 'Put end statement of multiline block on its own line.' + Enabled: true + +Layout/CaseIndentation: + Description: 'Indentation of when in a case/when/[else/]end.' + StyleGuide: '#indent-when-to-case' + Enabled: true + +Layout/ClosingParenthesisIndentation: + Description: 'Checks the indentation of hanging closing parentheses.' + Enabled: true + +Layout/CommentIndentation: + Description: 'Indentation of comments.' + Enabled: true + +Layout/DotPosition: + Description: 'Checks the position of the dot in multi-line method calls.' + StyleGuide: '#consistent-multi-line-chains' + Enabled: true + +Layout/ElseAlignment: + Description: 'Align elses and elsifs correctly.' + Enabled: true + +Layout/EmptyLineBetweenDefs: + Description: 'Use empty lines between defs.' + StyleGuide: '#empty-lines-between-methods' + Enabled: true + +Layout/EmptyLines: + Description: "Don't use several empty lines in a row." + StyleGuide: '#two-or-more-empty-lines' + Enabled: true + +Layout/EmptyLinesAroundAccessModifier: + Description: "Keep blank lines around access modifiers." + StyleGuide: '#empty-lines-around-access-modifier' + Enabled: true + +Layout/EmptyLinesAroundBeginBody: + Description: "Keeps track of empty lines around begin-end bodies." + StyleGuide: '#empty-lines-around-bodies' + Enabled: true + +Layout/EmptyLinesAroundBlockBody: + Description: "Keeps track of empty lines around block bodies." + StyleGuide: '#empty-lines-around-bodies' + Enabled: true + +Layout/EmptyLinesAroundClassBody: + Description: "Keeps track of empty lines around class bodies." + StyleGuide: '#empty-lines-around-bodies' + Enabled: true + +Layout/EmptyLinesAroundExceptionHandlingKeywords: + Description: "Keeps track of empty lines around exception handling keywords." + StyleGuide: '#empty-lines-around-bodies' + Enabled: true + +Layout/EmptyLinesAroundModuleBody: + Description: "Keeps track of empty lines around module bodies." + StyleGuide: '#empty-lines-around-bodies' + Enabled: true + +Layout/EmptyLinesAroundMethodBody: + Description: "Keeps track of empty lines around method bodies." + StyleGuide: '#empty-lines-around-bodies' + Enabled: true + +Layout/EndOfLine: + Description: 'Use Unix-style line endings.' + StyleGuide: '#crlf' + Enabled: true + +Layout/ExtraSpacing: + Description: 'Do not use unnecessary spacing.' + Enabled: true + +Layout/InitialIndentation: + Description: >- + Checks the indentation of the first non-blank non-comment line in a file. + Enabled: true + +Layout/FirstParameterIndentation: + Description: 'Checks the indentation of the first parameter in a method call.' + Enabled: true + +Layout/IndentationConsistency: + Description: 'Keep indentation straight.' + StyleGuide: '#spaces-indentation' + Enabled: true + +Layout/IndentationWidth: + Description: 'Use 2 spaces for indentation.' + StyleGuide: '#spaces-indentation' + Enabled: true + +Layout/IndentArray: + Description: >- + Checks the indentation of the first element in an array + literal. + Enabled: true + +Layout/IndentAssignment: + Description: >- + Checks the indentation of the first line of the + right-hand-side of a multi-line assignment. + Enabled: true + +Layout/IndentHash: + Description: 'Checks the indentation of the first key in a hash literal.' + Enabled: true + +Layout/IndentHeredoc: + Description: 'This cops checks the indentation of the here document bodies.' + StyleGuide: '#squiggly-heredocs' + Enabled: true + +Layout/SpaceInLambdaLiteral: + Description: 'Checks for spaces in lambda literals.' + Enabled: true + +Layout/LeadingCommentSpace: + Description: 'Comments should start with a space.' + StyleGuide: '#hash-space' + Enabled: true + +Layout/MultilineArrayBraceLayout: + Description: >- + Checks that the closing brace in an array literal is + either on the same line as the last array element, or + a new line. + Enabled: true + +Layout/MultilineBlockLayout: + Description: 'Ensures newlines after multiline block do statements.' + Enabled: true + +Layout/MultilineHashBraceLayout: + Description: >- + Checks that the closing brace in a hash literal is + either on the same line as the last hash element, or + a new line. + Enabled: true + +Layout/MultilineMethodCallBraceLayout: + Description: >- + Checks that the closing brace in a method call is + either on the same line as the last method argument, or + a new line. + Enabled: true + +Layout/MultilineMethodCallIndentation: + Description: >- + Checks indentation of method calls with the dot operator + that span more than one line. + Enabled: true + +Layout/MultilineMethodDefinitionBraceLayout: + Description: >- + Checks that the closing brace in a method definition is + either on the same line as the last method parameter, or + a new line. + Enabled: true + +Layout/MultilineOperationIndentation: + Description: >- + Checks indentation of binary operations that span more than + one line. + Enabled: true + +Layout/EmptyLineAfterMagicComment: + Description: 'Add an empty line after magic comments to separate them from code.' + StyleGuide: '#separate-magic-comments-from-code' + Enabled: true + +Layout/RescueEnsureAlignment: + Description: 'Align rescues and ensures correctly.' + Enabled: true + +Layout/SpaceBeforeFirstArg: + Description: >- + Checks that exactly one space is used between a method name + and the first argument for method calls without parentheses. + Enabled: true + +Layout/SpaceAfterColon: + Description: 'Use spaces after colons.' + StyleGuide: '#spaces-operators' + Enabled: true + +Layout/SpaceAfterComma: + Description: 'Use spaces after commas.' + StyleGuide: '#spaces-operators' + Enabled: true + +Layout/SpaceAfterMethodName: + Description: >- + Do not put a space between a method name and the opening + parenthesis in a method definition. + StyleGuide: '#parens-no-spaces' + Enabled: true + +Layout/SpaceAfterNot: + Description: Tracks redundant space after the ! operator. + StyleGuide: '#no-space-bang' + Enabled: true + +Layout/SpaceAfterSemicolon: + Description: 'Use spaces after semicolons.' + StyleGuide: '#spaces-operators' + Enabled: true + +Layout/SpaceBeforeBlockBraces: + Description: >- + Checks that the left block brace has or doesn't have space + before it. + Enabled: true + +Layout/SpaceBeforeComma: + Description: 'No spaces before commas.' + Enabled: true + +Layout/SpaceBeforeComment: + Description: >- + Checks for missing space between code and a comment on the + same line. + Enabled: true + +Layout/SpaceBeforeSemicolon: + Description: 'No spaces before semicolons.' + Enabled: true + +Layout/SpaceInsideBlockBraces: + Description: >- + Checks that block braces have or don't have surrounding space. + For blocks taking parameters, checks that the left brace has + or doesn't have trailing space. + Enabled: true + +Layout/SpaceAroundBlockParameters: + Description: 'Checks the spacing inside and after block parameters pipes.' + Enabled: true + +Layout/SpaceAroundEqualsInParameterDefault: + Description: >- + Checks that the equals signs in parameter default assignments + have or don't have surrounding space depending on + configuration. + StyleGuide: '#spaces-around-equals' + Enabled: true + +Layout/SpaceAroundKeyword: + Description: 'Use a space around keywords if appropriate.' + Enabled: true + +Layout/SpaceAroundOperators: + Description: 'Use a single space around operators.' + StyleGuide: '#spaces-operators' + Enabled: true + +Layout/SpaceInsideArrayPercentLiteral: + Description: 'No unnecessary additional spaces between elements in %i/%w literals.' + Enabled: true + +Layout/SpaceInsidePercentLiteralDelimiters: + Description: 'No unnecessary spaces inside delimiters of %i/%w/%x literals.' + Enabled: true + +Layout/SpaceInsideBrackets: + Description: 'No spaces after [ or before ].' + StyleGuide: '#no-spaces-braces' + Enabled: true + +Layout/SpaceInsideHashLiteralBraces: + Description: "Use spaces inside hash literal braces - or don't." + StyleGuide: '#spaces-operators' + Enabled: true + +Layout/SpaceInsideParens: + Description: 'No spaces after ( or before ).' + StyleGuide: '#no-spaces-braces' + Enabled: true + +Layout/SpaceInsideRangeLiteral: + Description: 'No spaces inside range literals.' + StyleGuide: '#no-space-inside-range-literals' + Enabled: true + +Layout/SpaceInsideStringInterpolation: + Description: 'Checks for padding/surrounding spaces inside string interpolation.' + StyleGuide: '#string-interpolation' + Enabled: true + +Layout/Tab: + Description: 'No hard tabs.' + StyleGuide: '#spaces-indentation' + Enabled: true + +Layout/TrailingBlankLines: + Description: 'Checks trailing blank lines and final newline.' + StyleGuide: '#newline-eof' + Enabled: true + +Layout/TrailingWhitespace: + Description: 'Avoid trailing whitespace.' + StyleGuide: '#no-trailing-whitespace' + Enabled: true + +#################### Style ############################### + +Style/AccessorMethodName: + Description: Check the naming of accessor methods for get_/set_. + StyleGuide: '#accessor_mutator_method_names' + Enabled: true + +Style/Alias: + Description: 'Use alias instead of alias_method.' + StyleGuide: '#alias-method' + Enabled: true + Style/AndOr: Description: 'Use &&/|| instead of and/or.' StyleGuide: '#no-and-or-or' Enabled: true @@ -73,14 +388,10 @@ Style/BlockComments: Description: 'Do not use block comments.' StyleGuide: '#no-block-comments' Enabled: true -Style/BlockEndNewline: - Description: 'Put end statement of multiline block on its own line.' - Enabled: true - Style/BlockDelimiters: Description: >- Avoid using {...} for multi-line blocks (multiline chaining is always ugly). Prefer {...} over do...end for single-line blocks. @@ -94,15 +405,10 @@ Style/CaseEquality: Description: 'Avoid explicit use of the case equality operator(===).' StyleGuide: '#no-case-equality' Enabled: true -Style/CaseIndentation: - Description: 'Indentation of when in a case/when/[else/]end.' - StyleGuide: '#indent-when-to-case' - Enabled: true - Style/CharacterLiteral: Description: 'Checks for uses of character literals.' StyleGuide: '#no-character-literals' Enabled: true @@ -127,14 +433,10 @@ Style/ClassVars: Description: 'Avoid the use of class variables.' StyleGuide: '#no-class-vars' Enabled: true -Style/ClosingParenthesisIndentation: - Description: 'Checks the indentation of hanging closing parentheses.' - Enabled: true - Style/ColonMethodCall: Description: 'Do not use :: for method call.' StyleGuide: '#double-colons' Enabled: true @@ -148,14 +450,10 @@ Checks formatting of special comments (TODO, FIXME, OPTIMIZE, HACK, REVIEW). StyleGuide: '#annotate-keywords' Enabled: true -Style/CommentIndentation: - Description: 'Indentation of comments.' - Enabled: true - Style/ConditionalAssignment: Description: >- Use the return value of `if` and `case` statements for assignment to a variable and variable comparison instead of assigning that variable inside of each branch. @@ -176,15 +474,10 @@ Enabled: true Exclude: - 'spec/**/*' - 'test/**/*' -Style/DotPosition: - Description: 'Checks the position of the dot in multi-line method calls.' - StyleGuide: '#consistent-multi-line-chains' - Enabled: true - Style/DoubleNegation: Description: 'Checks for uses of double negation (!!).' StyleGuide: '#no-bang-bang' Enabled: true @@ -196,51 +489,18 @@ Style/EachWithObject: Description: 'Prefer `each_with_object` over `inject` or `reduce`.' Enabled: true -Style/ElseAlignment: - Description: 'Align elses and elsifs correctly.' - Enabled: true - Style/EmptyElse: Description: 'Avoid empty else-clauses.' Enabled: true Style/EmptyCaseCondition: Description: 'Avoid empty condition in case statements.' Enabled: true -Style/EmptyLineBetweenDefs: - Description: 'Use empty lines between defs.' - StyleGuide: '#empty-lines-between-methods' - Enabled: true - -Style/EmptyLines: - Description: "Don't use several empty lines in a row." - Enabled: true - -Style/EmptyLinesAroundAccessModifier: - Description: "Keep blank lines around access modifiers." - Enabled: true - -Style/EmptyLinesAroundBlockBody: - Description: "Keeps track of empty lines around block bodies." - Enabled: true - -Style/EmptyLinesAroundClassBody: - Description: "Keeps track of empty lines around class bodies." - Enabled: true - -Style/EmptyLinesAroundModuleBody: - Description: "Keeps track of empty lines around module bodies." - Enabled: true - -Style/EmptyLinesAroundMethodBody: - Description: "Keeps track of empty lines around method bodies." - Enabled: true - Style/EmptyLiteral: Description: 'Prefer literals to Array.new/Hash.new/String.new.' StyleGuide: '#literal-array-hash' Enabled: true @@ -252,24 +512,15 @@ Style/EndBlock: Description: 'Avoid the use of END blocks.' StyleGuide: '#no-END-blocks' Enabled: true -Style/EndOfLine: - Description: 'Use Unix-style line endings.' - StyleGuide: '#crlf' - Enabled: true - Style/EvenOdd: Description: 'Favor the use of Integer#even? && Integer#odd?' StyleGuide: '#predicate-methods' Enabled: true -Style/ExtraSpacing: - Description: 'Do not use unnecessary spacing.' - Enabled: true - Style/FileName: Description: 'Use snake_case for source file names.' StyleGuide: '#snake-case-files' Enabled: true @@ -277,19 +528,10 @@ Description: >- Add the frozen_string_literal comment to the top of files to help transition from Ruby 2.3.0 to Ruby 3.0. Enabled: true -Style/InitialIndentation: - Description: >- - Checks the indentation of the first non-blank non-comment line in a file. - Enabled: true - -Style/FirstParameterIndentation: - Description: 'Checks the indentation of the first parameter in a method call.' - Enabled: true - Style/FlipFlop: Description: 'Checks for flip flops' StyleGuide: '#no-flip-flops' Enabled: true @@ -301,10 +543,14 @@ Style/FormatString: Description: 'Enforce the use of Kernel#sprintf, Kernel#format or String#%.' StyleGuide: '#sprintf' Enabled: true +Style/FormatStringToken: + Description: 'Use a consistent style for format string tokens.' + Enabled: true + Style/GlobalVars: Description: 'Do not introduce global variables.' StyleGuide: '#instance-vars' Reference: 'http://www.zenspider.com/Languages/Ruby/QuickRef.html' Enabled: true @@ -340,66 +586,38 @@ Style/IfWithSemicolon: Description: 'Do not use if x; .... Use the ternary operator instead.' StyleGuide: '#no-semicolon-ifs' Enabled: true -Style/IndentationConsistency: - Description: 'Keep indentation straight.' - Enabled: true - -Style/IndentationWidth: - Description: 'Use 2 spaces for indentation.' - StyleGuide: '#spaces-indentation' - Enabled: true - Style/IdenticalConditionalBranches: Description: >- Checks that conditional statements do not have an identical line at the end of each branch, which can validly be moved out of the conditional. Enabled: true -Style/IndentArray: - Description: >- - Checks the indentation of the first element in an array - literal. - Enabled: true - -Style/IndentAssignment: - Description: >- - Checks the indentation of the first line of the - right-hand-side of a multi-line assignment. - Enabled: true - -Style/IndentHash: - Description: 'Checks the indentation of the first key in a hash literal.' - Enabled: true - Style/InfiniteLoop: Description: 'Use Kernel#loop for infinite loops.' StyleGuide: '#infinite-loop' Enabled: true +Style/InverseMethods: + Description: >- + Use the inverse method instead of `!.method` + if an inverse method is defined. + Enabled: true + Style/Lambda: Description: 'Use the new lambda literal syntax for single-line blocks.' StyleGuide: '#lambda-multi-line' Enabled: true -Style/SpaceInLambdaLiteral: - Description: 'Checks for spaces in lambda literals.' - Enabled: true - Style/LambdaCall: Description: 'Use lambda.call(...) instead of lambda.(...).' StyleGuide: '#proc-call' Enabled: true -Style/LeadingCommentSpace: - Description: 'Comments should start with a space.' - StyleGuide: '#hash-space' - Enabled: true - Style/LineEndConcatenation: Description: >- Use \ instead of + or << to concatenate two string literals at line end. Enabled: true @@ -424,38 +642,25 @@ Style/MethodMissing: Description: 'Avoid using `method_missing`.' StyleGuide: '#no-method-missing' Enabled: true +Style/MixinGrouping: + Description: 'Checks for grouping of mixins in `class` and `module` bodies.' + StyleGuide: '#mixin-grouping' + Enabled: true + Style/ModuleFunction: Description: 'Checks for usage of `extend self` in modules.' StyleGuide: '#module-function' Enabled: true -Style/MultilineArrayBraceLayout: - Description: >- - Checks that the closing brace in an array literal is - either on the same line as the last array element, or - a new line. - Enabled: true - Style/MultilineBlockChain: Description: 'Avoid multi-line chains of blocks.' StyleGuide: '#single-line-blocks' Enabled: true -Style/MultilineBlockLayout: - Description: 'Ensures newlines after multiline block do statements.' - Enabled: true - -Style/MultilineHashBraceLayout: - Description: >- - Checks that the closing brace in a hash literal is - either on the same line as the last hash element, or - a new line. - Enabled: true - Style/MultilineIfThen: Description: 'Do not use then for multi-line if/unless.' StyleGuide: '#no-then' Enabled: true @@ -466,43 +671,23 @@ Style/MultilineMemoization: Description: 'Wrap multiline memoizations in a `begin` and `end` block.' Enabled: true -Style/MultilineMethodCallBraceLayout: - Description: >- - Checks that the closing brace in a method call is - either on the same line as the last method argument, or - a new line. - Enabled: true - -Style/MultilineMethodCallIndentation: - Description: >- - Checks indentation of method calls with the dot operator - that span more than one line. - Enabled: true - -Style/MultilineMethodDefinitionBraceLayout: - Description: >- - Checks that the closing brace in a method definition is - either on the same line as the last method parameter, or - a new line. - Enabled: true - -Style/MultilineOperationIndentation: - Description: >- - Checks indentation of binary operations that span more than - one line. - Enabled: true - Style/MultilineTernaryOperator: Description: >- Avoid multi-line ?: (the ternary operator); use if/unless instead. StyleGuide: '#no-multiline-ternary' Enabled: true +Style/MultipleComparison: + Description: >- + Avoid comparing a variable with multiple items in a conditional, + use Array#include? instead. + Enabled: true + Style/MutableConstant: Description: 'Do not assign mutable objects to constants.' Enabled: true Style/NegatedIf: @@ -675,14 +860,10 @@ Style/RegexpLiteral: Description: 'Use / or %r around regular expressions.' StyleGuide: '#percent-r' Enabled: true -Style/RescueEnsureAlignment: - Description: 'Align rescues and ensures correctly.' - Enabled: true - Style/RescueModifier: Description: 'Avoid using rescue in its modifier form.' StyleGuide: '#no-rescue-modifiers' Enabled: true @@ -713,124 +894,10 @@ Style/SingleLineMethods: Description: 'Avoid single-line methods.' StyleGuide: '#no-single-line-methods' Enabled: true -Style/SpaceBeforeFirstArg: - Description: >- - Checks that exactly one space is used between a method name - and the first argument for method calls without parentheses. - Enabled: true - -Style/SpaceAfterColon: - Description: 'Use spaces after colons.' - StyleGuide: '#spaces-operators' - Enabled: true - -Style/SpaceAfterComma: - Description: 'Use spaces after commas.' - StyleGuide: '#spaces-operators' - Enabled: true - -Style/SpaceAfterMethodName: - Description: >- - Do not put a space between a method name and the opening - parenthesis in a method definition. - StyleGuide: '#parens-no-spaces' - Enabled: true - -Style/SpaceAfterNot: - Description: Tracks redundant space after the ! operator. - StyleGuide: '#no-space-bang' - Enabled: true - -Style/SpaceAfterSemicolon: - Description: 'Use spaces after semicolons.' - StyleGuide: '#spaces-operators' - Enabled: true - -Style/SpaceBeforeBlockBraces: - Description: >- - Checks that the left block brace has or doesn't have space - before it. - Enabled: true - -Style/SpaceBeforeComma: - Description: 'No spaces before commas.' - Enabled: true - -Style/SpaceBeforeComment: - Description: >- - Checks for missing space between code and a comment on the - same line. - Enabled: true - -Style/SpaceBeforeSemicolon: - Description: 'No spaces before semicolons.' - Enabled: true - -Style/SpaceInsideBlockBraces: - Description: >- - Checks that block braces have or don't have surrounding space. - For blocks taking parameters, checks that the left brace has - or doesn't have trailing space. - Enabled: true - -Style/SpaceAroundBlockParameters: - Description: 'Checks the spacing inside and after block parameters pipes.' - Enabled: true - -Style/SpaceAroundEqualsInParameterDefault: - Description: >- - Checks that the equals signs in parameter default assignments - have or don't have surrounding space depending on - configuration. - StyleGuide: '#spaces-around-equals' - Enabled: true - -Style/SpaceAroundKeyword: - Description: 'Use a space around keywords if appropriate.' - Enabled: true - -Style/SpaceAroundOperators: - Description: 'Use a single space around operators.' - StyleGuide: '#spaces-operators' - Enabled: true - -Style/SpaceInsideArrayPercentLiteral: - Description: 'No unnecessary additional spaces between elements in %i/%w literals.' - Enabled: true - -Style/SpaceInsidePercentLiteralDelimiters: - Description: 'No unnecessary spaces inside delimiters of %i/%w/%x literals.' - Enabled: true - -Style/SpaceInsideBrackets: - Description: 'No spaces after [ or before ].' - StyleGuide: '#no-spaces-braces' - Enabled: true - -Style/SpaceInsideHashLiteralBraces: - Description: "Use spaces inside hash literal braces - or don't." - StyleGuide: '#spaces-operators' - Enabled: true - -Style/SpaceInsideParens: - Description: 'No spaces after ( or before ).' - StyleGuide: '#no-spaces-braces' - Enabled: true - -Style/SpaceInsideRangeLiteral: - Description: 'No spaces inside range literals.' - StyleGuide: '#no-space-inside-range-literals' - Enabled: true - -Style/SpaceInsideStringInterpolation: - Description: 'Checks for padding/surrounding spaces inside string interpolation.' - StyleGuide: '#string-interpolation' - Enabled: true - Style/SpecialGlobalVars: Description: 'Avoid Perl-style global variables.' StyleGuide: '#no-cryptic-perlisms' Enabled: true @@ -853,47 +920,37 @@ Style/StructInheritance: Description: 'Checks for inheritance from Struct.new.' StyleGuide: '#no-extend-struct-new' Enabled: true +Style/SymbolArray: + Description: 'Use %i or %I for arrays of symbols.' + StyleGuide: '#percent-i' + Enabled: true + Style/SymbolLiteral: Description: 'Use plain symbols instead of string symbols when possible.' Enabled: true Style/SymbolProc: Description: 'Use symbols as procs instead of blocks when possible.' Enabled: true -Style/Tab: - Description: 'No hard tabs.' - StyleGuide: '#spaces-indentation' - Enabled: true - Style/TernaryParentheses: Description: 'Checks for use of parentheses around ternary conditions.' Enabled: true -Style/TrailingBlankLines: - Description: 'Checks trailing blank lines and final newline.' - StyleGuide: '#newline-eof' - Enabled: true - Style/TrailingCommaInArguments: Description: 'Checks for trailing comma in argument lists.' StyleGuide: '#no-trailing-params-comma' Enabled: true Style/TrailingCommaInLiteral: Description: 'Checks for trailing comma in array and hash literals.' StyleGuide: '#no-trailing-array-commas' Enabled: true -Style/TrailingWhitespace: - Description: 'Avoid trailing whitespace.' - StyleGuide: '#no-trailing-whitespace' - Enabled: true - Style/TrivialAccessors: Description: 'Prefer attr_* methods to trivial readers/writers.' StyleGuide: '#attr_family' Enabled: true @@ -960,15 +1017,20 @@ Style/WordArray: Description: 'Use %w or %W for arrays of words.' StyleGuide: '#percent-w' Enabled: true +Style/YodaCondition: + Description: 'Do not use literals as the first operand of a comparison.' + Reference: 'https://en.wikipedia.org/wiki/Yoda_conditions' + Enabled: true + Style/ZeroLengthPredicate: Description: 'Use #empty? when testing for objects of length 0.' Enabled: true -#################### Metrics ################################ +#################### Metrics ############################### Metrics/AbcSize: Description: >- A calculated magnitude based on number of assignments, branches, and conditions. @@ -1017,13 +1079,20 @@ Description: >- A complexity metric geared towards measuring complexity for a human reader. Enabled: true -#################### Lint ################################ +#################### Lint ################################## ### Warnings +Lint/AmbiguousBlockAssociation: + Description: >- + Checks for ambiguous block association with method when param passed without + parentheses. + StyleGuide: '#syntax' + Enabled: true + Lint/AmbiguousOperator: Description: >- Checks for ambiguous operators in the first argument of a method invocation without parentheses. StyleGuide: '#method-invocation-parens' @@ -1088,10 +1157,11 @@ Enabled: true Lint/EmptyEnsure: Description: 'Checks for empty ensure block.' Enabled: true + AutoCorrect: false Lint/EmptyExpression: Description: 'Checks for empty expressions.' Enabled: true @@ -1219,14 +1289,22 @@ Lint/RescueException: Description: 'Avoid rescuing the Exception class.' StyleGuide: '#no-blind-rescues' Enabled: true +Lint/RescueType: + Description: 'Avoid rescuing from non constants that could result in a `TypeError`.' + Enabled: true + Lint/SafeNavigationChain: Description: 'Do not chain ordinary method call after safe navigation operator.' Enabled: true +Lint/ScriptPermission: + Description: 'Grant script file execute permission.' + Enabled: true + Lint/ShadowedException: Description: >- Avoid rescuing a higher level exception before a lower level exception. Enabled: true @@ -1300,12 +1378,17 @@ Lint/Void: Description: 'Possible use of operator/literal/variable in void context.' Enabled: true -##################### Performance ############################# +#################### Performance ########################### +Performance/Caller: + Description: >- + Use `caller(n..n)` instead of `caller`. + Enabled: true + Performance/Casecmp: Description: >- Use `casecmp` rather than `downcase ==`, `upcase ==`, `== downcase`, or `== upcase`.. Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringcasecmp-vs-stringdowncase---code' Enabled: true @@ -1408,11 +1491,13 @@ Performance/RedundantSortBy: Description: 'Use `sort` instead of `sort_by { |x| x }`.' Enabled: true Performance/RegexpMatch: - Description: 'Use `match?` instead of `Regexp#match`, `String#match`, `Symbol#match`, `Regexp#===` or `=~` when `MatchData` is not used.' + Description: >- + Use `match?` instead of `Regexp#match`, `String#match`, `Symbol#match`, + `Regexp#===`, or `=~` when `MatchData` is not used. Enabled: true Performance/ReverseEach: Description: 'Use `reverse_each` instead of `reverse.each`.' Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerablereverseeach-vs-enumerablereverse_each-code' @@ -1455,16 +1540,41 @@ Performance/TimesMap: Description: 'Checks for .times.map calls.' Enabled: true -##################### Rails ################################## +#################### Rails ################################# Rails/ActionFilter: Description: 'Enforces consistent use of action filter methods.' Enabled: true +Rails/ApplicationJob: + Description: 'Check that jobs subclass ApplicationJob.' + Enabled: true + +Rails/ApplicationRecord: + Description: 'Check that models subclass ApplicationRecord.' + Enabled: true + +Rails/ActiveSupportAliases: + Description: >- + Avoid ActiveSupport aliases of standard ruby methods: + `String#starts_with?`, `String#ends_with?`, + `Array#append`, `Array#prepend`. + Enabled: true + +Rails/Blank: + Description: 'Enforce using `blank?` and `present?`.' + Enabled: true + # Convert checks for `nil` or `empty?` to `blank?` + NilOrEmpty: true + # Convert usages of not `present?` to `blank?` + NotPresent: true + # Convert usages of `unless` `present?` to `if` `blank?` + UnlessPresent: true + Rails/Date: Description: >- Checks the correct usage of date aware methods, such as Date.today, Date.current etc. Enabled: true @@ -1533,17 +1643,31 @@ Rails/PluralizationGrammar: Description: 'Checks for incorrect grammar when using methods like `3.day.ago`.' Enabled: true +Rails/Present: + Description: 'Enforce using `blank?` and `present?`.' + Enabled: true + NotNilAndNotEmpty: true + # Convert checks for not `nil` and not `empty?` to `present?` + NotBlank: true + # Convert usages of not `blank?` to `present?` + UnlessBlank: true + # Convert usages of `unless` `blank?` to `if` `present?` + Rails/ReadWriteAttribute: Description: >- Checks for read_attribute(:attr) and write_attribute(:attr, val). StyleGuide: 'https://github.com/bbatsov/rails-style-guide#read-attribute' Enabled: true +Rails/RelativeDateConstant: + Description: 'Do not assign relative date to constants.' + Enabled: true + Rails/RequestReferer: Description: 'Use consistent syntax for request.referer.' Enabled: true Rails/ReversibleMigration: @@ -1579,10 +1703,12 @@ Rails/Validation: Description: 'Use validates :attribute, hash of validations.' Enabled: true +#################### Security ############################## + Security/Eval: Description: 'The use of eval represents a serious security risk.' Enabled: true Security/JSONLoad: @@ -1607,22 +1733,21 @@ Prefer usage of `YAML.safe_load` over `YAML.load` due to potential security issues. See reference for more information. Reference: 'https://ruby-doc.org/stdlib-2.3.3/libdoc/yaml/rdoc/YAML.html#module-YAML-label-Security' Enabled: true -##################### Bundler ############################# +#################### Bundler ############################### Bundler/DuplicatedGem: Description: 'Checks for duplicate gem entries in Gemfile.' Enabled: true Include: - '**/Gemfile' - '**/gems.rb' Bundler/OrderedGems: Description: >- - Sort alphabetically gems appearing within a contiguous set - of lines in the Gemfile + Gems within groups in the Gemfile should be alphabetically sorted. Enabled: true Include: - '**/Gemfile' - '**/gems.rb'