|
| 1 | +require: |
| 2 | + - rubocop-performance |
| 3 | + - rubocop-rspec |
| 4 | + |
| 5 | +AllCops: |
| 6 | + TargetRubyVersion: 3.0.1 |
| 7 | + NewCops: enable |
| 8 | + Exclude: |
| 9 | + - '.git/**/*' |
| 10 | + - '.idea/**/*' |
| 11 | + - 'init/*' |
| 12 | + - 'Rakefile' |
| 13 | + - '*.gemspec' |
| 14 | + - 'spec/**/*' |
| 15 | + - 'vendor/**/*' |
| 16 | + |
| 17 | +# Align the elements of a hash literal if they span more than one line. |
| 18 | +Layout/HashAlignment: |
| 19 | + EnforcedLastArgumentHashStyle: always_ignore |
| 20 | + |
| 21 | +# Alignment of parameters in multi-line method definition. |
| 22 | +# The `with_fixed_indentation` style aligns the following lines with one |
| 23 | +# level of indentation relative to the start of the line with the method |
| 24 | +# definition. |
| 25 | +# |
| 26 | +# def my_method(a, |
| 27 | +# b) |
| 28 | +Layout/ParameterAlignment: |
| 29 | + EnforcedStyle: with_fixed_indentation |
| 30 | + |
| 31 | +# Alignment of parameters in multi-line method call. |
| 32 | +# The `with_fixed_indentation` style aligns the following lines with one |
| 33 | +# level of indentation relative to the start of the line with the method call. |
| 34 | +# |
| 35 | +# my_method(a, |
| 36 | +# b) |
| 37 | +Layout/ArgumentAlignment: |
| 38 | + EnforcedStyle: with_fixed_indentation |
| 39 | + |
| 40 | +# a = case n |
| 41 | +# when 0 |
| 42 | +# x * 2 |
| 43 | +# else |
| 44 | +# y / 3 |
| 45 | +# end |
| 46 | +Layout/CaseIndentation: |
| 47 | + EnforcedStyle: end |
| 48 | + |
| 49 | +# Enforces a configured order of definitions within a class body |
| 50 | +Layout/ClassStructure: |
| 51 | + Enabled: true |
| 52 | + |
| 53 | +# Align `end` with the matching keyword or starting expression except for |
| 54 | +# assignments, where it should be aligned with the LHS. |
| 55 | +Layout/EndAlignment: |
| 56 | + EnforcedStyleAlignWith: variable |
| 57 | + AutoCorrect: true |
| 58 | + |
| 59 | +# The `consistent` style enforces that the first element in an array |
| 60 | +# literal where the opening bracket and the first element are on |
| 61 | +# seprate lines is indented the same as an array literal which is not |
| 62 | +# defined inside a method call. |
| 63 | +Layout/FirstArrayElementIndentation: |
| 64 | + EnforcedStyle: consistent |
| 65 | + |
| 66 | +# The `consistent` style enforces that the first key in a hash |
| 67 | +# literal where the opening brace and the first key are on |
| 68 | +# seprate lines is indented the same as a hash literal which is not |
| 69 | +# defined inside a method call. |
| 70 | +Layout/FirstHashElementIndentation: |
| 71 | + EnforcedStyle: consistent |
| 72 | + |
| 73 | +# Indent multi-line methods instead of aligning with periods |
| 74 | +Layout/MultilineMethodCallIndentation: |
| 75 | + EnforcedStyle: indented |
| 76 | + |
| 77 | +# Allow `debug` in tasks for now |
| 78 | +Lint/Debugger: |
| 79 | + Exclude: |
| 80 | + - 'RakeFile' |
| 81 | + |
| 82 | +# A calculated magnitude based on number of assignments, branches, and |
| 83 | +# conditions. |
| 84 | +# NOTE: This is temporarily disabled until we can eliminate existing Rubocop |
| 85 | +# complaints |
| 86 | +Metrics/AbcSize: |
| 87 | + Enabled: false |
| 88 | + |
| 89 | +# Avoid long blocks with many lines. |
| 90 | +Metrics/BlockLength: |
| 91 | + Exclude: |
| 92 | + - 'RakeFile' |
| 93 | + - 'db/seeds.rb' |
| 94 | + - 'spec/**/*.rb' |
| 95 | + |
| 96 | +# Avoid classes longer than 100 lines of code. |
| 97 | +# NOTE: This is temporarily disabled until we can eliminate existing Rubocop |
| 98 | +# complaints |
| 99 | +Metrics/ClassLength: |
| 100 | + Max: 200 |
| 101 | + Exclude: |
| 102 | + - 'spec/**/*.rb' |
| 103 | + |
| 104 | +# A complexity metric that is strongly correlated to the number of test cases |
| 105 | +# needed to validate a method. |
| 106 | +Metrics/CyclomaticComplexity: |
| 107 | + Max: 9 |
| 108 | + |
| 109 | +# Limit lines to 80 characters |
| 110 | +Layout/LineLength: |
| 111 | + Exclude: |
| 112 | + - 'RakeFile' |
| 113 | + - 'spec/**/*.rb' |
| 114 | + |
| 115 | +# Avoid methods longer than 15 lines of code. |
| 116 | +Metrics/MethodLength: |
| 117 | + Max: 20 |
| 118 | + IgnoredMethods: |
| 119 | + - swagger_path |
| 120 | + - operation |
| 121 | + |
| 122 | + |
| 123 | +# A complexity metric geared towards measuring complexity for a human reader. |
| 124 | +Metrics/PerceivedComplexity: |
| 125 | + Max: 10 |
| 126 | + |
| 127 | +Naming/FileName: |
| 128 | + Exclude: |
| 129 | + - 'lib/LittleWeasel.rb' |
| 130 | + |
| 131 | +# Allow `downcase == ` instead of forcing `casecmp` |
| 132 | +Performance/Casecmp: |
| 133 | + Enabled: false |
| 134 | + |
| 135 | +# Require children definitions to be nested or compact in classes and modules |
| 136 | +Style/ClassAndModuleChildren: |
| 137 | + Enabled: false |
| 138 | + |
| 139 | +# Document classes and non-namespace modules. |
| 140 | +# (Disabled for now, may revisit later) |
| 141 | +Style/Documentation: |
| 142 | + Enabled: false |
| 143 | + |
| 144 | +# Checks the formatting of empty method definitions. |
| 145 | +Style/EmptyMethod: |
| 146 | + EnforcedStyle: expanded |
| 147 | + |
| 148 | +# Add the frozen_string_literal comment to the top of files to help transition |
| 149 | +# to frozen string literals by default. |
| 150 | +Style/FrozenStringLiteralComment: |
| 151 | + EnforcedStyle: always |
| 152 | + |
| 153 | +# Check for conditionals that can be replaced with guard clauses |
| 154 | +Style/GuardClause: |
| 155 | + Enabled: false |
| 156 | + |
| 157 | +Style/MixinUsage: |
| 158 | + Exclude: |
| 159 | + - 'RakeFile' |
| 160 | + |
| 161 | +# Avoid multi-line method signatures. |
| 162 | +Style/MultilineMethodSignature: |
| 163 | + Enabled: true |
| 164 | + |
| 165 | +# Don't use option hashes when you can use keyword arguments. |
| 166 | +Style/OptionHash: |
| 167 | + Enabled: true |
| 168 | + |
| 169 | +# Use return instead of return nil. |
| 170 | +Style/ReturnNil: |
| 171 | + Enabled: true |
| 172 | + |
| 173 | +# Allow code like `return x, y` as it's occasionally handy. |
| 174 | +Style/RedundantReturn: |
| 175 | + AllowMultipleReturnValues: true |
| 176 | + |
| 177 | +# Prefer symbols instead of strings as hash keys. |
| 178 | +Style/StringHashKeys: |
| 179 | + Enabled: true |
| 180 | + |
| 181 | +# Checks if configured preferred methods are used over non-preferred. |
| 182 | +Style/StringMethods: |
| 183 | + Enabled: true |
| 184 | + |
| 185 | +# Checks for use of parentheses around ternary conditions. |
| 186 | +Style/TernaryParentheses: |
| 187 | + EnforcedStyle: require_parentheses_when_complex |
0 commit comments