############ ## General ############ Layout/BlockAlignment: Description: 'Align block ends correctly.' Enabled: true Layout/CaseIndentation: Description: Indentation of when in a case/when/[else/]end. Enabled: true EnforcedStyle: case SupportedStyles: - case - end IndentOneStep: false Layout/ClosingParenthesisIndentation: Description: 'Checks the indentation of hanging closing parentheses.' Enabled: false Style/MutableConstant: Description: 'Freeze mutable objects assigned to constants.' Enabled: true Lint/ElseLayout: Description: 'Check for odd code arrangement in an else block.' Enabled: true # Supports --auto-correct Layout/EmptyLineBetweenDefs: Description: Use empty lines between defs. Enabled: true AllowAdjacentOneLineDefs: false Layout/EmptyLines: Description: "Don't use several empty lines in a row." Enabled: true Layout/EndAlignment: Description: 'Align ends correctly.' Enabled: true Layout/EndOfLine: Description: 'Use Unix-style line endings.' Enabled: true # Supports --auto-correct Layout/IndentationWidth: Description: Use 2 spaces for indentation. Enabled: true # Supports --auto-correct Layout/IndentationConsistency: Description: Keep indentation straight. Enabled: true Metrics/LineLength: Description: Limit lines to 80 characters. Enabled: false Max: 80 # Supports --auto-correct Layout/SpaceAroundOperators: Description: Use spaces around operators. Enabled: true # Supports --auto-correct Layout/SpaceBeforeBlockBraces: Description: Checks that the left block brace has or doesn't have space before it. Enabled: true EnforcedStyle: space SupportedStyles: - space - no_space # Supports --auto-correct Layout/SpaceAfterSemicolon: Description: Use spaces after semicolons. Enabled: true # Supports --auto-correct Layout/SpaceAfterColon: Description: Use spaces after colons. Enabled: true # Supports --auto-correct Layout/SpaceAfterComma: Description: Use spaces after commas. Enabled: true # Supports --auto-correct Layout/SpaceInsideReferenceBrackets: Description: No spaces after array[ or before ]. Enabled: true # Supports --auto-correct Layout/SpaceInsideArrayLiteralBrackets: Description: No spaces after array = [ or before ]. Enabled: true # Supports --auto-correct Layout/SpaceInsideParens: Description: No spaces after ( or before ). Enabled: true Layout/Tab: Description: No hard tabs. Enabled: true # Supports --auto-correct Layout/TrailingWhitespace: Description: Avoid trailing whitespace. Enabled: true # Supports --auto-correct Layout/TrailingBlankLines: Description: Checks trailing blank lines and final newline. Enabled: true EnforcedStyle: final_newline SupportedStyles: - final_newline - final_blank_line ## Syntax # Supports --auto-correct Style/AndOr: Description: Use &&/|| instead of and/or. Enabled: true # Supports --auto-correct Style/DefWithParentheses: Description: Use def with parentheses when there are arguments. Enabled: true Style/For: Description: Checks use of for or each in multiline loops. Enabled: true EnforcedStyle: each SupportedStyles: - for - each Style/IfUnlessModifier: Description: Favor modifier if/unless usage when you have a single-line body. Enabled: false Style/MethodCalledOnDoEndBlock: Description: Avoid chaining a method call on a do...end block. Enabled: true Style/MethodCallWithoutArgsParentheses: Description: 'Do not use parentheses for method calls with no arguments.' Enabled: true Style/MultilineBlockChain: Description: Avoid multi-line chains of blocks. Enabled: true Style/MultilineIfThen: Description: Never use then for multi-line if/unless. Enabled: true Style/MultilineTernaryOperator: Description: 'Avoid multi-line ?: (the ternary operator); use if/unless instead.' Enabled: true Style/NestedTernaryOperator: Description: Use one expression per branch in a ternary operator. Enabled: true Style/OneLineConditional: Description: Favor the ternary operator(?:) over if/then/else/end constructs. Enabled: true # Supports --auto-correct Style/ParenthesesAroundCondition: Description: Don't use parentheses around the condition of an if/unless/while. Enabled: true AllowSafeAssignment: true # Supports --auto-correct Style/RedundantReturn: Description: Don't use return where it's not required. Enabled: true AllowMultipleReturnValues: false # Supports --auto-correct Layout/SpaceAfterMethodName: Description: Never put a space between a method name and the opening parenthesis in a method definition. Enabled: true # Supports --auto-correct Layout/SpaceAroundEqualsInParameterDefault: Description: Checks that the equals signs in parameter default assignments have or don't have surrounding space depending on configuration. Enabled: true EnforcedStyle: space SupportedStyles: - space - no_space Style/UnlessElse: Description: Never use unless with else. Rewrite these with the positive case first. Enabled: true # Supports --auto-correct Lint/UnusedBlockArgument: Description: Checks for unused block arguments. Enabled: true ## Naming Naming/ClassAndModuleCamelCase: Description: Use CamelCase for classes and modules. Enabled: true # Supports --auto-correct Style/ClassMethods: Description: Use self when defining module/class methods. Enabled: true Style/ClassVars: Description: Avoid the use of class variables. Enabled: true Naming/ConstantName: Description: Constants should use SCREAMING_SNAKE_CASE. Enabled: true Naming/MethodName: Description: Use the configured style when naming methods. Enabled: true EnforcedStyle: snake_case SupportedStyles: - snake_case - camelCase # Supports --auto-correct Style/TrivialAccessors: Description: Prefer attr_* methods to trivial readers/writers. Enabled: true ExactNameMatch: true AllowPredicates: true AllowDSLWriters: 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 Naming/VariableName: Description: Use the configured style when naming variables. Enabled: true EnforcedStyle: snake_case SupportedStyles: - snake_case - camelCase ## Exceptions # Supports --auto-correct Lint/RescueException: Description: Avoid rescuing the Exception class. Enabled: true ## Collections # Supports --auto-correct Layout/AlignArray: Description: Align the elements of an array literal if they span more than one line. Enabled: true # Supports --auto-correct Style/HashSyntax: Description: 'Prefer Ruby 1.9 hash syntax { a: 1, b: 2 } over 1.8 syntax { :a => 1, :b => 2 }.' Enabled: true Exclude: - 'db/schema.rb' EnforcedStyle: ruby19 SupportedStyles: - ruby19 - hash_rockets Style/TrailingCommaInArrayLiteral: Enabled: true EnforcedStyleForMultiline: comma Style/TrailingCommaInHashLiteral: Enabled: true EnforcedStyleForMultiline: comma Style/TrailingCommaInArguments: Enabled: true EnforcedStyleForMultiline: comma # Supports --auto-correct Style/WordArray: Description: Use %w or %W for arrays of words. Enabled: true MinSize: 0 Layout/MultilineMethodCallIndentation: Enabled: false ## Strings # Supports --auto-correct Lint/StringConversionInInterpolation: Description: Checks for Object#to_s usage in string interpolation. Enabled: true # Supports --auto-correct Style/StringLiterals: Description: Checks if uses of quotes match the configured preference. Enabled: true EnforcedStyle: double_quotes SupportedStyles: - single_quotes - double_quotes