AllCops: TargetRubyVersion: 2.5.0 Style/SingleLineMethods: Exclude: - 'test/**/*.rb' # Don't leave calls to pry lying around. Lint/Debugger: Enabled: true # ============================================================================== # Documentation # ============================================================================== Style/Documentation: Enabled: true Exclude: - 'test/**/*.rb' Style/DocumentationMethod: Enabled: true Exclude: - 'test/**/*.rb' # ============================================================================== # Naming # ============================================================================== Naming/MethodParameterName: AllowedNames: - el - id Naming/MethodName: Enabled: true Exclude: - 'lib/definitions/**/*.rb' - 'build/**/*.rb' Naming/ClassAndModuleCamelCase: Enabled: true Exclude: - 'lib/definitions/**/*.rb' - 'build/**/*.rb' # ============================================================================== # Layout # ============================================================================== Metrics/LineLength: Max: 150 Layout/EmptyLineAfterGuardClause: Enabled: false Layout/EmptyLinesAroundModuleBody: Enabled: false Layout/EmptyLinesAroundClassBody: Enabled: false Layout/EmptyLinesAroundBlockBody: Enabled: false # https://unix.stackexchange.com/a/18789 Layout/TrailingEmptyLines: EnforcedStyle: final_newline # ============================================================================== # Strings # ============================================================================== Style/StringLiterals: EnforcedStyle: double_quotes Style/FrozenStringLiteralComment: Enabled: false Naming/HeredocDelimiterNaming: Enabled: false Style/FormatString: EnforcedStyle: sprintf # ============================================================================== # Numbers # ============================================================================== Style/ZeroLengthPredicate: Enabled: false Style/NumericPredicate: Enabled: false # preferably `EnforcedStyle: snake_case`, but it varies. Naming/VariableNumber: Enabled: false # ============================================================================== # Braces, Brackets, and Parentheses # ============================================================================== Style/DefWithParentheses: Enabled: false Style/MethodCallWithoutArgsParentheses: Enabled: false # Only use braces if the function expects a hash argument. [different in Ruby 2.7+](https://blog.saeloun.com/2019/10/07/ruby-2-7-keyword-arguments-redesign.html) Style/BracesAroundHashParameters: Enabled: false Style/WordArray: EnforcedStyle: brackets Style/SymbolArray: EnforcedStyle: brackets # ============================================================================== # Trailing Commas # ============================================================================== Style/TrailingCommaInArguments: EnforcedStyleForMultiline: comma Style/TrailingCommaInArrayLiteral: EnforcedStyleForMultiline: comma Style/TrailingCommaInHashLiteral: EnforcedStyleForMultiline: comma # ============================================================================== # Fewer lines doesn't mean better code # ============================================================================== Metrics/ModuleLength: Enabled: false Metrics/ClassLength: Enabled: false Metrics/MethodLength: Enabled: false Metrics/BlockLength: Enabled: false # TODO: Look into adding an `EnforcedStyle` to not use guard clauses. Style/GuardClause: Enabled: false # TODO: Look into adding an `EnforcedStyle` to not use if/unless modifiers. Style/IfUnlessModifier: Enabled: false Style/Next: Enabled: false # ============================================================================== # Explicit, not redundant # ============================================================================== Style/RedundantReturn: Enabled: false Style/RedundantSelf: Enabled: false # ============================================================================== # Exceptions # ============================================================================== Lint/SuppressedException: AllowComments: true Style/RaiseArgs: EnforcedStyle: exploded # ============================================================================== # Unsorted # ============================================================================== # Default value (special_inside_parentheses) is ridiculous. # Look for yourself: https://www.rubydoc.info/gems/rubocop/0.69.0/RuboCop/Cop/Layout/IndentFirstHashElement Layout/FirstHashElementIndentation: EnforcedStyle: consistent # Default value (special_inside_parentheses) is ridiculous. # Look for yourself: https://www.rubydoc.info/gems/rubocop/0.69.0/RuboCop/Cop/Layout/IndentFirstArrayElement Layout/FirstArrayElementIndentation: EnforcedStyle: consistent Layout/HashAlignment: Enabled: false # `x&.y&.[](:argument)` isn't what I'd call "readable". # https://stackoverflow.com/questions/34794697/using-with-the-safe-navigation-operator-in-ruby Style/SafeNavigation: Enabled: false Style/NegatedIf: EnforcedStyle: postfix # TODO: File issue to ignore enums when using `EnforcedStyle: assign_inside_condition`. Style/ConditionalAssignment: Enabled: false Style/TernaryParentheses: EnforcedStyle: require_parentheses_when_complex Metrics/AbcSize: Enabled: false Metrics/CyclomaticComplexity: Enabled: false Metrics/PerceivedComplexity: Enabled: false Style/CommentedKeyword: Enabled: False Style/AsciiComments: Enabled: false Lint/EmptyWhen: Enabled: false