|
1 | | -# 37signals house style |
2 | | -inherit_gem: { rubocop-37signals: rubocop.yml } |
| 1 | +require: |
| 2 | + - rubocop-minitest |
| 3 | + - rubocop-packaging |
| 4 | + - rubocop-performance |
| 5 | + - rubocop-rails |
| 6 | + - rubocop-md |
3 | 7 |
|
4 | 8 | AllCops: |
| 9 | + TargetRubyVersion: 3.1 |
| 10 | + # RuboCop has a bunch of cops enabled by default. This setting tells RuboCop |
| 11 | + # to ignore them, so only the ones explicitly set in this file are enabled. |
| 12 | + DisabledByDefault: true |
| 13 | + SuggestExtensions: false |
5 | 14 | Exclude: |
6 | 15 | # These have been copied from the Rails repo |
7 | 16 | - test/unit/behaviors/* |
8 | 17 | # Don't second guess the generated schemas |
9 | 18 | - test/dummy/db/*schema.rb |
| 19 | + |
| 20 | +Performance: |
| 21 | + Exclude: |
| 22 | + - '**/test/**/*' |
| 23 | + |
| 24 | +# Prefer assert_not over assert ! |
| 25 | +Rails/AssertNot: |
| 26 | + Include: |
| 27 | + - '**/test/**/*' |
| 28 | + |
| 29 | +# Prefer assert_not_x over refute_x |
| 30 | +Rails/RefuteMethods: |
| 31 | + Include: |
| 32 | + - '**/test/**/*' |
| 33 | + |
| 34 | +Rails/IndexBy: |
| 35 | + Enabled: true |
| 36 | + |
| 37 | +Rails/IndexWith: |
| 38 | + Enabled: true |
| 39 | + |
| 40 | +# Prefer &&/|| over and/or. |
| 41 | +Style/AndOr: |
| 42 | + Enabled: true |
| 43 | + |
| 44 | +# Align `when` with `case`. |
| 45 | +Layout/CaseIndentation: |
| 46 | + Enabled: true |
| 47 | + |
| 48 | +Layout/ClosingHeredocIndentation: |
| 49 | + Enabled: true |
| 50 | + |
| 51 | +Layout/ClosingParenthesisIndentation: |
| 52 | + Enabled: true |
| 53 | + |
| 54 | +# Align comments with method definitions. |
| 55 | +Layout/CommentIndentation: |
| 56 | + Enabled: true |
| 57 | + |
| 58 | +Layout/ElseAlignment: |
| 59 | + Enabled: true |
| 60 | + |
| 61 | +# Align `end` with the matching keyword or starting expression except for |
| 62 | +# assignments, where it should be aligned with the LHS. |
| 63 | +Layout/EndAlignment: |
| 64 | + Enabled: true |
| 65 | + EnforcedStyleAlignWith: variable |
| 66 | + AutoCorrect: true |
| 67 | + |
| 68 | +Layout/EndOfLine: |
| 69 | + Enabled: true |
| 70 | + |
| 71 | +Layout/EmptyLineAfterMagicComment: |
| 72 | + Enabled: true |
| 73 | + |
| 74 | +Layout/EmptyLinesAroundAccessModifier: |
| 75 | + Enabled: true |
| 76 | + EnforcedStyle: only_before |
| 77 | + |
| 78 | +Layout/EmptyLinesAroundBlockBody: |
| 79 | + Enabled: true |
| 80 | + |
| 81 | +# In a regular class definition, no empty lines around the body. |
| 82 | +Layout/EmptyLinesAroundClassBody: |
| 83 | + Enabled: true |
| 84 | + |
| 85 | +# In a regular method definition, no empty lines around the body. |
| 86 | +Layout/EmptyLinesAroundMethodBody: |
| 87 | + Enabled: true |
| 88 | + |
| 89 | +# In a regular module definition, no empty lines around the body. |
| 90 | +Layout/EmptyLinesAroundModuleBody: |
| 91 | + Enabled: true |
| 92 | + |
| 93 | +# Use Ruby >= 1.9 syntax for hashes. Prefer { a: :b } over { :a => :b }. |
| 94 | +Style/HashSyntax: |
| 95 | + Enabled: true |
| 96 | + EnforcedShorthandSyntax: either |
| 97 | + |
| 98 | +# Method definitions after `private` or `protected` isolated calls need one |
| 99 | +# extra level of indentation. |
| 100 | +Layout/IndentationConsistency: |
| 101 | + Enabled: true |
| 102 | + EnforcedStyle: indented_internal_methods |
| 103 | + Exclude: |
| 104 | + - '**/*.md' |
| 105 | + |
| 106 | +# Two spaces, no tabs (for indentation). |
| 107 | +Layout/IndentationWidth: |
| 108 | + Enabled: true |
| 109 | + |
| 110 | +Layout/LeadingCommentSpace: |
| 111 | + Enabled: true |
| 112 | + |
| 113 | +Layout/SpaceAfterColon: |
| 114 | + Enabled: true |
| 115 | + |
| 116 | +Layout/SpaceAfterComma: |
| 117 | + Enabled: true |
| 118 | + |
| 119 | +Layout/SpaceAfterSemicolon: |
| 120 | + Enabled: true |
| 121 | + |
| 122 | +Layout/SpaceAroundEqualsInParameterDefault: |
| 123 | + Enabled: true |
| 124 | + |
| 125 | +Layout/SpaceAroundKeyword: |
| 126 | + Enabled: true |
| 127 | + |
| 128 | +Layout/SpaceAroundOperators: |
| 129 | + Enabled: true |
| 130 | + |
| 131 | +Layout/SpaceBeforeComma: |
| 132 | + Enabled: true |
| 133 | + |
| 134 | +Layout/SpaceBeforeComment: |
| 135 | + Enabled: true |
| 136 | + |
| 137 | +Layout/SpaceBeforeFirstArg: |
| 138 | + Enabled: true |
| 139 | + |
| 140 | +Style/DefWithParentheses: |
| 141 | + Enabled: true |
| 142 | + |
| 143 | +# Defining a method with parameters needs parentheses. |
| 144 | +Style/MethodDefParentheses: |
| 145 | + Enabled: true |
| 146 | + |
| 147 | +Style/ExplicitBlockArgument: |
| 148 | + Enabled: true |
| 149 | + |
| 150 | +Style/FrozenStringLiteralComment: |
| 151 | + Enabled: true |
| 152 | + EnforcedStyle: always |
| 153 | + Exclude: |
| 154 | + - 'actionview/test/**/*.builder' |
| 155 | + - 'actionview/test/**/*.ruby' |
| 156 | + - 'actionpack/test/**/*.builder' |
| 157 | + - 'actionpack/test/**/*.ruby' |
| 158 | + - 'activestorage/db/migrate/**/*.rb' |
| 159 | + - 'activestorage/db/update_migrate/**/*.rb' |
| 160 | + - 'actionmailbox/db/migrate/**/*.rb' |
| 161 | + - 'actiontext/db/migrate/**/*.rb' |
| 162 | + - '**/*.md' |
| 163 | + |
| 164 | +Style/MapToHash: |
| 165 | + Enabled: true |
| 166 | + |
| 167 | +Style/RedundantFreeze: |
| 168 | + Enabled: true |
| 169 | + |
| 170 | +# Use `foo {}` not `foo{}`. |
| 171 | +Layout/SpaceBeforeBlockBraces: |
| 172 | + Enabled: true |
| 173 | + |
| 174 | +# Use `foo { bar }` not `foo {bar}`. |
| 175 | +Layout/SpaceInsideBlockBraces: |
| 176 | + Enabled: true |
| 177 | + EnforcedStyleForEmptyBraces: space |
| 178 | + |
| 179 | +# Use `{ a: 1 }` not `{a:1}`. |
| 180 | +Layout/SpaceInsideHashLiteralBraces: |
| 181 | + Enabled: true |
| 182 | + |
| 183 | +Layout/SpaceInsideParens: |
| 184 | + Enabled: true |
| 185 | + |
| 186 | +# Check quotes usage according to lint rule below. |
| 187 | +Style/StringLiterals: |
| 188 | + Enabled: true |
| 189 | + EnforcedStyle: double_quotes |
| 190 | + |
| 191 | +# Detect hard tabs, no hard tabs. |
| 192 | +Layout/IndentationStyle: |
| 193 | + Enabled: true |
| 194 | + |
| 195 | +# Empty lines should not have any spaces. |
| 196 | +Layout/TrailingEmptyLines: |
| 197 | + Enabled: true |
| 198 | + |
| 199 | +# No trailing whitespace. |
| 200 | +Layout/TrailingWhitespace: |
| 201 | + Enabled: true |
| 202 | + |
| 203 | +# Use quotes for string literals when they are enough. |
| 204 | +Style/RedundantPercentQ: |
| 205 | + Enabled: true |
| 206 | + |
| 207 | +Lint/AmbiguousOperator: |
| 208 | + Enabled: true |
| 209 | + |
| 210 | +Lint/AmbiguousRegexpLiteral: |
| 211 | + Enabled: true |
| 212 | + |
| 213 | +Lint/DuplicateRequire: |
| 214 | + Enabled: true |
| 215 | + |
| 216 | +Lint/DuplicateMagicComment: |
| 217 | + Enabled: true |
| 218 | + |
| 219 | +Lint/DuplicateMethods: |
| 220 | + Enabled: true |
| 221 | + |
| 222 | +Lint/ErbNewArguments: |
| 223 | + Enabled: true |
| 224 | + |
| 225 | +Lint/EnsureReturn: |
| 226 | + Enabled: true |
| 227 | + |
| 228 | +Lint/MissingCopEnableDirective: |
| 229 | + Enabled: true |
| 230 | + |
| 231 | +# Use my_method(my_arg) not my_method( my_arg ) or my_method my_arg. |
| 232 | +Lint/RequireParentheses: |
| 233 | + Enabled: true |
| 234 | + |
| 235 | +Lint/RedundantCopDisableDirective: |
| 236 | + Enabled: true |
| 237 | + |
| 238 | +Lint/RedundantCopEnableDirective: |
| 239 | + Enabled: true |
| 240 | + |
| 241 | +Lint/RedundantStringCoercion: |
| 242 | + Enabled: true |
| 243 | + |
| 244 | +Lint/RedundantSafeNavigation: |
| 245 | + Enabled: true |
| 246 | + |
| 247 | +Lint/UriEscapeUnescape: |
| 248 | + Enabled: true |
| 249 | + |
| 250 | +Lint/UselessAssignment: |
| 251 | + Enabled: true |
| 252 | + |
| 253 | +Lint/DeprecatedClassMethods: |
| 254 | + Enabled: true |
| 255 | + |
| 256 | +Lint/InterpolationCheck: |
| 257 | + Enabled: true |
| 258 | + Exclude: |
| 259 | + - '**/test/**/*' |
| 260 | + |
| 261 | +Style/EvalWithLocation: |
| 262 | + Enabled: true |
| 263 | + Exclude: |
| 264 | + - '**/test/**/*' |
| 265 | + |
| 266 | +Style/ParenthesesAroundCondition: |
| 267 | + Enabled: true |
| 268 | + |
| 269 | +Style/HashTransformKeys: |
| 270 | + Enabled: true |
| 271 | + |
| 272 | +Style/HashTransformValues: |
| 273 | + Enabled: true |
| 274 | + |
| 275 | +Style/RedundantBegin: |
| 276 | + Enabled: true |
| 277 | + |
| 278 | +Style/RedundantReturn: |
| 279 | + Enabled: true |
| 280 | + AllowMultipleReturnValues: true |
| 281 | + |
| 282 | +Style/RedundantRegexpEscape: |
| 283 | + Enabled: true |
| 284 | + |
| 285 | +Style/Semicolon: |
| 286 | + Enabled: true |
| 287 | + AllowAsExpressionSeparator: true |
| 288 | + |
| 289 | +# Prefer Foo.method over Foo::method |
| 290 | +Style/ColonMethodCall: |
| 291 | + Enabled: true |
| 292 | + |
| 293 | +Style/TrivialAccessors: |
| 294 | + Enabled: true |
| 295 | + |
| 296 | +# Prefer a = b || c over a = b ? b : c |
| 297 | +Style/RedundantCondition: |
| 298 | + Enabled: true |
| 299 | + |
| 300 | +Style/RedundantDoubleSplatHashBraces: |
| 301 | + Enabled: true |
| 302 | + |
| 303 | +Performance/BindCall: |
| 304 | + Enabled: true |
| 305 | + |
| 306 | +Performance/FlatMap: |
| 307 | + Enabled: true |
| 308 | + |
| 309 | +Performance/MapCompact: |
| 310 | + Enabled: true |
| 311 | + |
| 312 | +Performance/SelectMap: |
| 313 | + Enabled: true |
| 314 | + |
| 315 | +Performance/RedundantMerge: |
| 316 | + Enabled: true |
| 317 | + |
| 318 | +Performance/StartWith: |
| 319 | + Enabled: true |
| 320 | + |
| 321 | +Performance/EndWith: |
| 322 | + Enabled: true |
| 323 | + |
| 324 | +Performance/RegexpMatch: |
| 325 | + Enabled: true |
| 326 | + |
| 327 | +Performance/ReverseEach: |
| 328 | + Enabled: true |
| 329 | + |
| 330 | +Performance/StringReplacement: |
| 331 | + Enabled: true |
| 332 | + |
| 333 | +Performance/DeletePrefix: |
| 334 | + Enabled: true |
| 335 | + |
| 336 | +Performance/DeleteSuffix: |
| 337 | + Enabled: true |
| 338 | + |
| 339 | +Performance/OpenStruct: |
| 340 | + Enabled: true |
| 341 | + |
| 342 | +Performance/InefficientHashSearch: |
| 343 | + Enabled: true |
| 344 | + |
| 345 | +Performance/ConstantRegexp: |
| 346 | + Enabled: true |
| 347 | + |
| 348 | +Performance/RedundantStringChars: |
| 349 | + Enabled: true |
| 350 | + |
| 351 | +Performance/StringInclude: |
| 352 | + Enabled: true |
| 353 | + |
| 354 | +Minitest/AssertPredicate: |
| 355 | + Enabled: true |
| 356 | + |
| 357 | +Minitest/AssertRaisesWithRegexpArgument: |
| 358 | + Enabled: true |
| 359 | + |
| 360 | +Minitest/AssertWithExpectedArgument: |
| 361 | + Enabled: true |
| 362 | + |
| 363 | +Minitest/LiteralAsActualArgument: |
| 364 | + Enabled: true |
| 365 | + |
| 366 | +Minitest/NonExecutableTestMethod: |
| 367 | + Enabled: true |
| 368 | + |
| 369 | +Minitest/SkipEnsure: |
| 370 | + Enabled: true |
| 371 | + |
| 372 | +Minitest/UnreachableAssertion: |
| 373 | + Enabled: true |
| 374 | + |
| 375 | +Markdown: |
| 376 | + # Whether to run RuboCop against non-valid snippets |
| 377 | + WarnInvalid: true |
| 378 | + # Whether to lint codeblocks without code attributes |
| 379 | + Autodetect: false |
0 commit comments