rubocop-airbnb 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +2 -0
  3. data/Gemfile +7 -0
  4. data/LICENSE.md +9 -0
  5. data/README.md +68 -0
  6. data/config/default.yml +39 -0
  7. data/config/rubocop-airbnb.yml +96 -0
  8. data/config/rubocop-bundler.yml +8 -0
  9. data/config/rubocop-gemspec.yml +9 -0
  10. data/config/rubocop-layout.yml +514 -0
  11. data/config/rubocop-lint.yml +315 -0
  12. data/config/rubocop-metrics.yml +47 -0
  13. data/config/rubocop-naming.yml +68 -0
  14. data/config/rubocop-performance.yml +143 -0
  15. data/config/rubocop-rails.yml +193 -0
  16. data/config/rubocop-rspec.yml +281 -0
  17. data/config/rubocop-security.yml +13 -0
  18. data/config/rubocop-style.yml +953 -0
  19. data/lib/rubocop-airbnb.rb +11 -0
  20. data/lib/rubocop/airbnb.rb +16 -0
  21. data/lib/rubocop/airbnb/inflections.rb +14 -0
  22. data/lib/rubocop/airbnb/inject.rb +20 -0
  23. data/lib/rubocop/airbnb/rails_autoloading.rb +55 -0
  24. data/lib/rubocop/airbnb/version.rb +8 -0
  25. data/lib/rubocop/cop/airbnb/class_name.rb +47 -0
  26. data/lib/rubocop/cop/airbnb/class_or_module_declared_in_wrong_file.rb +138 -0
  27. data/lib/rubocop/cop/airbnb/const_assigned_in_wrong_file.rb +74 -0
  28. data/lib/rubocop/cop/airbnb/continuation_slash.rb +25 -0
  29. data/lib/rubocop/cop/airbnb/default_scope.rb +20 -0
  30. data/lib/rubocop/cop/airbnb/factory_attr_references_class.rb +74 -0
  31. data/lib/rubocop/cop/airbnb/factory_class_use_string.rb +39 -0
  32. data/lib/rubocop/cop/airbnb/mass_assignment_accessible_modifier.rb +18 -0
  33. data/lib/rubocop/cop/airbnb/module_method_in_wrong_file.rb +104 -0
  34. data/lib/rubocop/cop/airbnb/no_timeout.rb +19 -0
  35. data/lib/rubocop/cop/airbnb/opt_arg_parameters.rb +38 -0
  36. data/lib/rubocop/cop/airbnb/phrase_bundle_keys.rb +67 -0
  37. data/lib/rubocop/cop/airbnb/risky_activerecord_invocation.rb +63 -0
  38. data/lib/rubocop/cop/airbnb/rspec_describe_or_context_under_namespace.rb +114 -0
  39. data/lib/rubocop/cop/airbnb/rspec_environment_modification.rb +58 -0
  40. data/lib/rubocop/cop/airbnb/simple_modifier_conditional.rb +23 -0
  41. data/lib/rubocop/cop/airbnb/spec_constant_assignment.rb +55 -0
  42. data/lib/rubocop/cop/airbnb/unsafe_yaml_marshal.rb +47 -0
  43. data/rubocop-airbnb.gemspec +32 -0
  44. data/spec/rubocop/cop/airbnb/class_name_spec.rb +78 -0
  45. data/spec/rubocop/cop/airbnb/class_or_module_declared_in_wrong_file_spec.rb +174 -0
  46. data/spec/rubocop/cop/airbnb/const_assigned_in_wrong_file_spec.rb +178 -0
  47. data/spec/rubocop/cop/airbnb/continuation_slash_spec.rb +162 -0
  48. data/spec/rubocop/cop/airbnb/default_scope_spec.rb +38 -0
  49. data/spec/rubocop/cop/airbnb/factory_attr_references_class_spec.rb +160 -0
  50. data/spec/rubocop/cop/airbnb/factory_class_use_string_spec.rb +26 -0
  51. data/spec/rubocop/cop/airbnb/mass_assignment_accessible_modifier_spec.rb +28 -0
  52. data/spec/rubocop/cop/airbnb/module_method_in_wrong_file_spec.rb +181 -0
  53. data/spec/rubocop/cop/airbnb/no_timeout_spec.rb +30 -0
  54. data/spec/rubocop/cop/airbnb/opt_arg_parameter_spec.rb +103 -0
  55. data/spec/rubocop/cop/airbnb/phrase_bundle_keys_spec.rb +74 -0
  56. data/spec/rubocop/cop/airbnb/risky_activerecord_invocation_spec.rb +54 -0
  57. data/spec/rubocop/cop/airbnb/rspec_describe_or_context_under_namespace_spec.rb +284 -0
  58. data/spec/rubocop/cop/airbnb/rspec_environment_modification_spec.rb +64 -0
  59. data/spec/rubocop/cop/airbnb/simple_modifier_conditional_spec.rb +122 -0
  60. data/spec/rubocop/cop/airbnb/spec_constant_assignment_spec.rb +80 -0
  61. data/spec/rubocop/cop/airbnb/unsafe_yaml_marshal_spec.rb +50 -0
  62. data/spec/spec_helper.rb +35 -0
  63. metadata +150 -0
@@ -0,0 +1,13 @@
1
+ Security/Eval:
2
+ Description: The use of eval represents a serious security risk.
3
+ Enabled: true
4
+
5
+ Security/JSONLoad:
6
+ Enabled: false
7
+
8
+ Security/MarshalLoad:
9
+ Enabled: false
10
+
11
+ Security/YAMLLoad:
12
+ Enabled: false
13
+
@@ -0,0 +1,953 @@
1
+
2
+ # Supports --auto-correct
3
+ Style/Alias:
4
+ Description: Use alias_method instead of alias.
5
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#alias-method
6
+ Enabled: false
7
+
8
+ # Supports --auto-correct
9
+ Style/AndOr:
10
+ Description: Use &&/|| instead of and/or.
11
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-and-or-or
12
+ Enabled: true
13
+ EnforcedStyle: always
14
+ SupportedStyles:
15
+ - always
16
+ - conditionals
17
+
18
+ # Supports --auto-correct
19
+ Style/ArrayJoin:
20
+ Description: Use Array#join instead of Array#*.
21
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#array-join
22
+ Enabled: true
23
+
24
+ Style/AsciiComments:
25
+ Description: Use only ascii symbols in comments.
26
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#english-comments
27
+ Enabled: false
28
+
29
+ # Supports --auto-correct
30
+ Style/Attr:
31
+ Description: Checks for uses of Module#attr.
32
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#attr
33
+ Enabled: false
34
+
35
+ Style/AutoResourceCleanup:
36
+ Description: Suggests the usage of an auto resource cleanup version of a method (if
37
+ available).
38
+ Enabled: false
39
+
40
+ # Supports --auto-correct
41
+ Style/BarePercentLiterals:
42
+ Description: Checks if usage of %() or %Q() matches configuration.
43
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#percent-q-shorthand
44
+ Enabled: false
45
+ EnforcedStyle: bare_percent
46
+ SupportedStyles:
47
+ - percent_q
48
+ - bare_percent
49
+
50
+ Style/BeginBlock:
51
+ Description: Avoid the use of BEGIN blocks.
52
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-BEGIN-blocks
53
+ Enabled: false
54
+
55
+ # Supports --auto-correct
56
+ Style/BlockComments:
57
+ Description: Do not use block comments.
58
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-block-comments
59
+ Enabled: true
60
+
61
+ # Supports --auto-correct
62
+ Style/BlockDelimiters:
63
+ Description: Check for uses of braces or do/end around single line or multi-line blocks.
64
+ Enabled: true
65
+ EnforcedStyle: line_count_based
66
+ SupportedStyles:
67
+ # The `line_count_based` style enforces braces around single line blocks and
68
+ # do..end around multi-line blocks.
69
+ - line_count_based
70
+ # The `semantic` style enforces braces around functional blocks, where the
71
+ # primary purpose of the block is to return a value and do..end for
72
+ # procedural blocks, where the primary purpose of the block is its
73
+ # side-effects.
74
+ #
75
+ # This looks at the usage of a block's method to determine its type (e.g. is
76
+ # the result of a `map` assigned to a variable or passed to another
77
+ # method) but exceptions are permitted in the `ProceduralMethods`,
78
+ # `FunctionalMethods` and `IgnoredMethods` sections below.
79
+ - semantic
80
+ # The `braces_for_chaining` style enforces braces around single line blocks
81
+ # and do..end around multi-line blocks, except for multi-line blocks whose
82
+ # return value is being chained with another method (in which case braces
83
+ # are enforced).
84
+ - braces_for_chaining
85
+ ProceduralMethods:
86
+ # Methods that are known to be procedural in nature but look functional from
87
+ # their usage, e.g.
88
+ #
89
+ # time = Benchmark.realtime do
90
+ # foo.bar
91
+ # end
92
+ #
93
+ # Here, the return value of the block is discarded but the return value of
94
+ # `Benchmark.realtime` is used.
95
+ - benchmark
96
+ - bm
97
+ - bmbm
98
+ - create
99
+ - each_with_object
100
+ - measure
101
+ - new
102
+ - realtime
103
+ - tap
104
+ - with_object
105
+ FunctionalMethods:
106
+ # Methods that are known to be functional in nature but look procedural from
107
+ # their usage, e.g.
108
+ #
109
+ # let(:foo) { Foo.new }
110
+ #
111
+ # Here, the return value of `Foo.new` is used to define a `foo` helper but
112
+ # doesn't appear to be used from the return value of `let`.
113
+ - let
114
+ - let!
115
+ - subject
116
+ - watch
117
+ IgnoredMethods:
118
+ # Methods that can be either procedural or functional and cannot be
119
+ # categorised from their usage alone, e.g.
120
+ #
121
+ # foo = lambda do |x|
122
+ # puts "Hello, #{x}"
123
+ # end
124
+ #
125
+ # foo = lambda do |x|
126
+ # x * 100
127
+ # end
128
+ #
129
+ # Here, it is impossible to tell from the return value of `lambda` whether
130
+ # the inner block's return value is significant.
131
+ - lambda
132
+ - proc
133
+ - it
134
+
135
+ # Supports --auto-correct
136
+ Style/BracesAroundHashParameters:
137
+ Description: Enforce braces style around hash parameters.
138
+ Enabled: false
139
+ EnforcedStyle: no_braces
140
+ SupportedStyles:
141
+ - braces
142
+ - no_braces
143
+ - context_dependent
144
+
145
+ Style/CaseEquality:
146
+ Description: Avoid explicit use of the case equality operator(===).
147
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-case-equality
148
+ Enabled: false
149
+
150
+ # Supports --auto-correct
151
+ Style/CharacterLiteral:
152
+ Description: Checks for uses of character literals.
153
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-character-literals
154
+ Enabled: false
155
+
156
+ Style/ClassAndModuleChildren:
157
+ Description: Checks style of children classes and modules.
158
+ Enabled: false
159
+ EnforcedStyle: nested
160
+
161
+ # Supports --auto-correct
162
+ Style/ClassCheck:
163
+ Description: Enforces consistent use of `Object#is_a?` or `Object#kind_of?`.
164
+ Enabled: true
165
+ EnforcedStyle: is_a?
166
+
167
+ # Supports --auto-correct
168
+ Style/ClassMethods:
169
+ Description: Use self when defining module/class methods.
170
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#def-self-class-methods
171
+ Enabled: false
172
+
173
+ Style/ClassVars:
174
+ Description: Avoid the use of class variables.
175
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-class-vars
176
+ Enabled: true
177
+
178
+ # Supports --auto-correct
179
+ Style/CollectionMethods:
180
+ Description: Preferred collection methods.
181
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#map-find-select-reduce-size
182
+ Enabled: false
183
+ PreferredMethods:
184
+ collect: map
185
+ collect!: map!
186
+ inject: reduce
187
+ detect: detect
188
+ find: detect
189
+ find_all: select
190
+
191
+ # Supports --auto-correct
192
+ Style/ColonMethodCall:
193
+ Description: ! 'Do not use :: for method call.'
194
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#double-colons
195
+ Enabled: true
196
+
197
+ Style/ColonMethodDefinition:
198
+ Description: 'Do not use :: for defining class methods.'
199
+ StyleGuide: '#colon-method-definition'
200
+ Enabled: true
201
+
202
+ # Supports --auto-correct
203
+ Style/CommandLiteral:
204
+ Description: Use `` or %x around command literals.
205
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#percent-x
206
+ Enabled: true
207
+ EnforcedStyle: backticks
208
+ AllowInnerBackticks: false
209
+
210
+ # Supports --auto-correct
211
+ Style/CommentAnnotation:
212
+ Description: Checks formatting of special comments (TODO, FIXME, OPTIMIZE, HACK, REVIEW).
213
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#annotate-keywords
214
+ Enabled: false
215
+ Keywords:
216
+ - TODO
217
+ - FIXME
218
+ - OPTIMIZE
219
+ - HACK
220
+ - REVIEW
221
+
222
+ Style/CommentedKeyword:
223
+ Enabled: false
224
+
225
+ # Supports --auto-correct
226
+ Style/ConditionalAssignment:
227
+ Description: Use the return value of `if` and `case` statements for assignment to
228
+ a variable and variable comparison instead of assigning that variable inside of
229
+ each branch.
230
+ Enabled: false
231
+ SingleLineConditionsOnly: true
232
+
233
+ # Supports --auto-correct
234
+ Style/Copyright:
235
+ Description: Include a copyright notice in each file before any code.
236
+ Enabled: false
237
+ Notice: ^Copyright (\(c\) )?2[0-9]{3} .+
238
+ AutocorrectNotice: ''
239
+
240
+ Style/DateTime:
241
+ Enabled: false
242
+
243
+ # Supports --auto-correct
244
+ Style/DefWithParentheses:
245
+ Description: Use def with parentheses when there are arguments.
246
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#method-parens
247
+ Enabled: false
248
+
249
+ Style/Dir:
250
+ Enabled: false
251
+
252
+ # Don't force documentation
253
+ Style/Documentation:
254
+ Enabled: false
255
+
256
+ Style/DocumentationMethod:
257
+ Enabled: false
258
+
259
+ Style/DoubleNegation:
260
+ Description: Checks for uses of double negation (!!).
261
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-bang-bang
262
+ Enabled: false
263
+
264
+ Style/EachForSimpleLoop:
265
+ Description: >-
266
+ Use `Integer#times` for a simple loop which iterates a fixed
267
+ number of times.
268
+ Enabled: true
269
+
270
+ Style/EachWithObject:
271
+ Description: Prefer `each_with_object` over `inject` or `reduce`.
272
+ Enabled: false
273
+
274
+ Style/EmptyBlockParameter:
275
+ Description: 'Omit pipes for empty block parameters.'
276
+ Enabled: true
277
+
278
+ Style/EmptyCaseCondition:
279
+ Enabled: false
280
+
281
+ # Supports --auto-correct
282
+ Style/EmptyElse:
283
+ Description: Avoid empty else-clauses.
284
+ Enabled: false
285
+ EnforcedStyle: both
286
+ SupportedStyles:
287
+ - empty
288
+ - nil
289
+ - both
290
+
291
+ Style/EmptyLambdaParameter:
292
+ Description: 'Omit parens for empty lambda parameters.'
293
+ Enabled: true
294
+
295
+ # Supports --auto-correct
296
+ Style/EmptyLiteral:
297
+ Description: Prefer literals to Array.new/Hash.new/String.new.
298
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#literal-array-hash
299
+ Enabled: true
300
+
301
+ Style/EmptyMethod:
302
+ Enabled: false
303
+
304
+ # Supports --auto-correct
305
+ Style/Encoding:
306
+ Description: Use UTF-8 as the source file encoding.
307
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#utf-8
308
+ Enabled: false
309
+
310
+ Style/EndBlock:
311
+ Description: Avoid the use of END blocks.
312
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-END-blocks
313
+ Enabled: false
314
+
315
+ Style/EvalWithLocation:
316
+ Description: 'Pass `__FILE__` and `__LINE__` to `eval` method, as they are used by backtraces.'
317
+ Enabled: false
318
+
319
+ # Supports --auto-correct
320
+ Style/EvenOdd:
321
+ Description: Favor the use of Fixnum#even? && Fixnum#odd?
322
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#predicate-methods
323
+ Enabled: false
324
+
325
+ Style/FlipFlop:
326
+ Description: Checks for flip flops
327
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-flip-flops
328
+ Enabled: false
329
+
330
+ Style/For:
331
+ Description: Checks use of for or each in multiline loops.
332
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-for-loops
333
+ Enabled: false
334
+ EnforcedStyle: each
335
+ SupportedStyles:
336
+ - for
337
+ - each
338
+
339
+ Style/FormatString:
340
+ Description: Enforce the use of Kernel#sprintf, Kernel#format or String#%.
341
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#sprintf
342
+ Enabled: false
343
+ EnforcedStyle: format
344
+ SupportedStyles:
345
+ - format
346
+ - sprintf
347
+ - percent
348
+
349
+ Style/FormatStringToken:
350
+ Enabled: false
351
+
352
+ # Supports --auto-correct
353
+ Style/FrozenStringLiteralComment:
354
+ Description: Add the frozen_string_literal comment to the top of files to help transition
355
+ from Ruby 2.3.0 to Ruby 3.0.
356
+ Enabled: false
357
+ EnforcedStyle: when_needed
358
+ SupportedStyles:
359
+ - when_needed
360
+ - always
361
+
362
+ Style/GlobalVars:
363
+ Description: Do not introduce global variables.
364
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#instance-vars
365
+ Reference: http://www.zenspider.com/Languages/Ruby/QuickRef.html
366
+ Enabled: false
367
+ AllowedVariables: []
368
+
369
+ # This thing seems a little error prone, and is kind of annoying. Let's
370
+ # leave this up to the individual.
371
+ Style/GuardClause:
372
+ Enabled: false
373
+
374
+ # Don't force colon-style hash pairs. Sometimes ya just don't want 'em.
375
+ # (Allen approved!)
376
+ Style/HashSyntax:
377
+ Enabled: false
378
+
379
+ Style/IdenticalConditionalBranches:
380
+ Description: Checks that conditional statements do not have an identical line at the
381
+ end of each branch, which can validly be moved out of the conditional.
382
+ Enabled: false
383
+
384
+ Style/IfInsideElse:
385
+ Description: Finds if nodes inside else, which can be converted to elsif.
386
+ Enabled: false
387
+
388
+ # Don't force trailing if/unless for single-line conditionals
389
+ Style/IfUnlessModifier:
390
+ Enabled: false
391
+
392
+ Style/IfUnlessModifierOfIfUnless:
393
+ Description: >-
394
+ Checks for if and unless statements used as modifers of other if or unless statements.
395
+ Enabled: true
396
+
397
+ Style/IfWithSemicolon:
398
+ Description: Do not use if x; .... Use the ternary operator instead.
399
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-semicolon-ifs
400
+ Enabled: true
401
+
402
+ # Supports --auto-correct
403
+ Style/InfiniteLoop:
404
+ Description: Use Kernel#loop for infinite loops.
405
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#infinite-loop
406
+ Enabled: false
407
+
408
+ Style/InlineComment:
409
+ Description: Avoid inline comments.
410
+ Enabled: false
411
+
412
+ Style/InverseMethods:
413
+ Enabled: false
414
+
415
+ # Supports --auto-correct
416
+ Style/Lambda:
417
+ Description: Use the new lambda literal syntax for single-line blocks.
418
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#lambda-multi-line
419
+ Enabled: false
420
+
421
+ # Supports --auto-correct
422
+ Style/LambdaCall:
423
+ Description: Use lambda.call(...) instead of lambda.(...).
424
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#proc-call
425
+ Enabled: true
426
+ EnforcedStyle: call
427
+ SupportedStyles:
428
+ - call
429
+ - braces
430
+
431
+ # Supports --auto-correct
432
+ Style/LineEndConcatenation:
433
+ Description: Use \ instead of + or << to concatenate two string literals at line end.
434
+ Enabled: true
435
+
436
+ Style/MethodCallWithArgsParentheses:
437
+ Enabled: false
438
+
439
+ # Supports --auto-correct
440
+ Style/MethodCallWithoutArgsParentheses:
441
+ Description: Do not use parentheses for method calls with no arguments.
442
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-args-no-parens
443
+ Enabled: true
444
+
445
+ Style/MethodCalledOnDoEndBlock:
446
+ Description: Avoid chaining a method call on a do...end block.
447
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#single-line-blocks
448
+ Enabled: false
449
+
450
+ # Supports --auto-correct
451
+ Style/MethodDefParentheses:
452
+ Description: Checks if the method definitions have or don't have parentheses.
453
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#method-parens
454
+ Enabled: true
455
+ EnforcedStyle: require_parentheses
456
+ SupportedStyles:
457
+ - require_parentheses
458
+ - require_no_parentheses
459
+ Style/MethodMissing:
460
+ Enabled: false
461
+
462
+ Style/MinMax:
463
+ Enabled: false
464
+
465
+ Style/MissingElse:
466
+ Description: Require if/case expressions to have an else branches. If enabled, it
467
+ is recommended that Style/UnlessElse and Style/EmptyElse be enabled. This will conflict
468
+ with Style/EmptyElse if Style/EmptyElse is configured to style "both"
469
+ Enabled: false
470
+ EnforcedStyle: both
471
+ SupportedStyles:
472
+ - if
473
+ - case
474
+ - both
475
+
476
+ Style/MixinGrouping:
477
+ Description: This cop checks for grouping of mixins in `class` and `module` bodies. By default
478
+ it enforces mixins to be placed in separate declarations, but it can be configured to enforce
479
+ grouping them in one declaration.
480
+ Enabled: true
481
+
482
+ Style/MixinUsage:
483
+ Description: This cop checks that `include`, `extend` and `prepend` exists at the top level.
484
+ Using these at the top level affects the behavior of `Object`. There will not be using
485
+ `include`, `extend` and `prepend` at the top level. Let's use it inside `class` or `module`.
486
+ Enabled: true
487
+
488
+ Style/ModuleFunction:
489
+ Description: Checks for usage of `extend self` in modules.
490
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#module-function
491
+ Enabled: false
492
+
493
+ Style/MultilineBlockChain:
494
+ Description: Avoid multi-line chains of blocks.
495
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#single-line-blocks
496
+ Enabled: false
497
+
498
+ Style/MultilineIfModifier:
499
+ Enabled: true
500
+
501
+ # Supports --auto-correct
502
+ Style/MultilineIfThen:
503
+ Description: Do not use then for multi-line if/unless.
504
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-then
505
+ Enabled: true
506
+
507
+ Style/MultilineMemoization:
508
+ Enabled: false
509
+
510
+ Style/MultilineTernaryOperator:
511
+ Description: ! 'Avoid multi-line ?: (the ternary operator); use if/unless instead.'
512
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-multiline-ternary
513
+ Enabled: true
514
+
515
+ Style/MultipleComparison:
516
+ Enabled: false
517
+
518
+ # Supports --auto-correct
519
+ Style/MutableConstant:
520
+ Description: Do not assign mutable objects to constants.
521
+ Enabled: true
522
+
523
+ # Supports --auto-correct
524
+ Style/NegatedIf:
525
+ Description: Favor unless over if for negative conditions (or control flow or).
526
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#unless-for-negatives
527
+ Enabled: false
528
+
529
+ # Supports --auto-correct
530
+ Style/NegatedWhile:
531
+ Description: Favor until over while for negative conditions.
532
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#until-for-negatives
533
+ Enabled: false
534
+
535
+ Style/NestedModifier:
536
+ Enabled: true
537
+
538
+ Style/NestedParenthesizedCalls:
539
+ Description: Parenthesize method calls which are nested inside the argument list of
540
+ another parenthesized method call.
541
+ Enabled: true
542
+
543
+ Style/NestedTernaryOperator:
544
+ Description: Use one expression per branch in a ternary operator.
545
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-nested-ternary
546
+ Enabled: true
547
+
548
+ Style/Next:
549
+ Description: Use `next` to skip iteration instead of a condition at the end.
550
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-nested-conditionals
551
+ Enabled: false
552
+ EnforcedStyle: skip_modifier_ifs
553
+ MinBodyLength: 3
554
+ SupportedStyles:
555
+ - skip_modifier_ifs
556
+ - always
557
+
558
+ # Supports --auto-correct
559
+ Style/NilComparison:
560
+ Description: Prefer x.nil? to x == nil.
561
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#predicate-methods
562
+ Enabled: true
563
+
564
+ # Supports --auto-correct
565
+ Style/NonNilCheck:
566
+ Description: Checks for redundant nil checks.
567
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-non-nil-checks
568
+ Enabled: true
569
+ IncludeSemanticChanges: false
570
+
571
+ # Supports --auto-correct
572
+ Style/Not:
573
+ Description: Use ! instead of not.
574
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#bang-not-not
575
+ Enabled: true
576
+
577
+ Style/NumericLiteralPrefix:
578
+ EnforcedOctalStyle: zero_with_o
579
+ SupportedOctalStyles:
580
+ - zero_with_o
581
+ - zero_only
582
+ Enabled: true
583
+
584
+ # We just don't like this style.
585
+ Style/NumericLiterals:
586
+ Description: Add underscores to large numeric literals to improve their readability.
587
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#underscores-in-numerics
588
+ Enabled: false
589
+
590
+ Style/NumericPredicate:
591
+ Enabled: false
592
+
593
+ Style/OneLineConditional:
594
+ Description: Favor the ternary operator(?:) over if/then/else/end constructs.
595
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#ternary-operator
596
+ Enabled: true
597
+
598
+ Style/OptionHash:
599
+ Description: Don't use option hashes when you can use keyword arguments.
600
+ Enabled: false
601
+ SuspiciousParamNames:
602
+ - options
603
+ - opts
604
+ - args
605
+ - params
606
+ - parameters
607
+
608
+ Style/OptionalArguments:
609
+ Description: Checks for optional arguments that do not appear at the end of the argument
610
+ list
611
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#optional-arguments
612
+ Enabled: true
613
+
614
+ Style/OrAssignment:
615
+ Enabled: true
616
+
617
+ # Supports --auto-correct
618
+ Style/ParallelAssignment:
619
+ Description: Check for simple usages of parallel assignment. It will only warn when
620
+ the number of variables matches on both sides of the assignment.
621
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#parallel-assignment
622
+ Enabled: false
623
+
624
+ # Supports --auto-correct
625
+ Style/ParenthesesAroundCondition:
626
+ Description: Don't use parentheses around the condition of an if/unless/while.
627
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-parens-if
628
+ Enabled: true
629
+ AllowSafeAssignment: true
630
+
631
+ # Supports --auto-correct
632
+ Style/PercentLiteralDelimiters:
633
+ Description: Use `%`-literal delimiters consistently
634
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#percent-literal-braces
635
+ Enabled: true
636
+ PreferredDelimiters:
637
+ ! '%': ()
638
+ ! '%i': ()
639
+ ! '%q': ()
640
+ ! '%Q': ()
641
+ ! '%r': ! '{}'
642
+ ! '%s': ()
643
+ ! '%w': ()
644
+ ! '%W': ()
645
+ ! '%x': ()
646
+
647
+ # Supports --auto-correct
648
+ Style/PercentQLiterals:
649
+ Description: Checks if uses of %Q/%q match the configured preference.
650
+ Enabled: false
651
+ EnforcedStyle: lower_case_q
652
+ SupportedStyles:
653
+ - lower_case_q
654
+ - upper_case_q
655
+
656
+ # Supports --auto-correct
657
+ Style/PerlBackrefs:
658
+ Description: Avoid Perl-style regex back references.
659
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-perl-regexp-last-matchers
660
+ Enabled: true
661
+
662
+ # Supports --auto-correct
663
+ Style/PreferredHashMethods:
664
+ Description: Checks for use of deprecated Hash methods.
665
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#hash-key
666
+ Enabled: true
667
+
668
+ # Supports --auto-correct
669
+ Style/Proc:
670
+ Description: Use proc instead of Proc.new.
671
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#proc
672
+ Enabled: false
673
+
674
+ Style/RaiseArgs:
675
+ Description: Checks the arguments passed to raise/fail.
676
+ # Also https://github.com/airbnb/ruby#exception-class-messages
677
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#exception-class-messages
678
+ Enabled: true
679
+ EnforcedStyle: exploded
680
+ SupportedStyles:
681
+ - compact
682
+ - exploded
683
+
684
+ Style/RandomWithOffset:
685
+ Description: Prefer to use ranges when generating random numbers instead of integers with offsets.
686
+ StyleGuide: '#random-numbers'
687
+ Enabled: false
688
+
689
+ # Supports --auto-correct
690
+ Style/RedundantBegin:
691
+ Description: Don't use begin blocks when they are not needed.
692
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#begin-implicit
693
+ Enabled: true
694
+
695
+ Style/RedundantConditional:
696
+ Enabled: true
697
+
698
+ # Supports --auto-correct
699
+ Style/RedundantException:
700
+ Description: Checks for an obsolete RuntimeException argument in raise/fail.
701
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-explicit-runtimeerror
702
+ Enabled: true
703
+
704
+ # Supports --auto-correct
705
+ Style/RedundantFreeze:
706
+ Description: Checks usages of Object#freeze on immutable objects.
707
+ Enabled: true
708
+
709
+ # Supports --auto-correct
710
+ Style/RedundantParentheses:
711
+ Description: Checks for parentheses that seem not to serve any purpose.
712
+ Enabled: true
713
+
714
+ # Supports --auto-correct
715
+ Style/RedundantReturn:
716
+ Description: Don't use return where it's not required.
717
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-explicit-return
718
+ Enabled: true
719
+ AllowMultipleReturnValues: false
720
+
721
+ # Supports --auto-correct
722
+ Style/RedundantSelf:
723
+ Description: Don't use self where it's not needed.
724
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-self-unless-required
725
+ Enabled: true
726
+
727
+ # Supports --auto-correct
728
+ Style/RegexpLiteral:
729
+ Description: Use / or %r around regular expressions.
730
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#percent-r
731
+ Enabled: false
732
+ EnforcedStyle: slashes
733
+ SupportedStyles:
734
+ - slashes
735
+ - percent_r
736
+ - mixed
737
+ AllowInnerSlashes: false
738
+
739
+ # Supports --auto-correct
740
+ Style/RescueModifier:
741
+ Description: Avoid using rescue in its modifier form.
742
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-rescue-modifiers
743
+ Enabled: true
744
+
745
+ Style/RescueStandardError:
746
+ Description: 'Avoid rescuing without specifying an error class.'
747
+ Enabled: false
748
+
749
+ Style/ReturnNil:
750
+ Enabled: false
751
+
752
+ Style/SafeNavigation:
753
+ Enabled: false
754
+
755
+ # Supports --auto-correct
756
+ Style/SelfAssignment:
757
+ Description: Checks for places where self-assignment shorthand should have been used.
758
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#self-assignment
759
+ Enabled: true
760
+
761
+ # Supports --auto-correct
762
+ Style/Semicolon:
763
+ Description: Don't use semicolons to terminate expressions.
764
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-semicolon
765
+ Enabled: true
766
+ AllowAsExpressionSeparator: false
767
+
768
+ Style/Send:
769
+ Description: Prefer `Object#__send__` or `Object#public_send` to `send`, as `send`
770
+ may overlap with existing methods.
771
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#prefer-public-send
772
+ Enabled: false
773
+
774
+ # Supports --auto-correct
775
+ Style/SignalException:
776
+ Description: Checks for proper usage of fail and raise.
777
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#fail-method
778
+ Enabled: false
779
+ EnforcedStyle: semantic
780
+ SupportedStyles:
781
+ - only_raise
782
+ - only_fail
783
+ - semantic
784
+
785
+ Style/SingleLineBlockParams:
786
+ Description: Enforces the names of some block params.
787
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#reduce-blocks
788
+ Enabled: false
789
+ Methods:
790
+ - reduce:
791
+ - a
792
+ - e
793
+ - inject:
794
+ - a
795
+ - e
796
+
797
+ # Supports --auto-correct
798
+ Style/SingleLineMethods:
799
+ Description: Avoid single-line methods.
800
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-single-line-methods
801
+ Enabled: true
802
+ AllowIfMethodIsEmpty: true
803
+
804
+ # Supports --auto-correct
805
+ Style/SpecialGlobalVars:
806
+ Description: Avoid Perl-style global variables.
807
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-cryptic-perlisms
808
+ Enabled: true
809
+
810
+ Style/StabbyLambdaParentheses:
811
+ Description: Check for the usage of parentheses around stabby lambda arguments.
812
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#stabby-lambda-with-args
813
+ Enabled: false
814
+ EnforcedStyle: require_parentheses
815
+ SupportedStyles:
816
+ - require_parentheses
817
+ - require_no_parentheses
818
+
819
+ Style/StderrPuts:
820
+ Enabled: true
821
+
822
+ Style/StringHashKeys:
823
+ Description: 'Prefer symbols instead of strings as hash keys.'
824
+ StyleGuide: '#symbols-as-keys'
825
+ Enabled: false
826
+
827
+ # Allow double-quoted strings without interpolation. The customer is always right.
828
+ Style/StringLiterals:
829
+ Enabled: false
830
+
831
+ # Supports --auto-correct
832
+ Style/StringLiteralsInInterpolation:
833
+ Description: Checks if uses of quotes inside expressions in interpolated strings match
834
+ the configured preference.
835
+ Enabled: false
836
+ EnforcedStyle: single_quotes
837
+ SupportedStyles:
838
+ - single_quotes
839
+ - double_quotes
840
+
841
+ # Supports --auto-correct
842
+ Style/StringMethods:
843
+ Description: Checks if configured preferred methods are used over non-preferred.
844
+ Enabled: false
845
+ PreferredMethods:
846
+ intern: to_sym
847
+
848
+ Style/StructInheritance:
849
+ Description: Checks for inheritance from Struct.new.
850
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-extend-struct-new
851
+ Enabled: false
852
+
853
+ Style/SymbolArray:
854
+ Description: Use %i or %I for arrays of symbols.
855
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#percent-i
856
+ Enabled: false
857
+
858
+ # Supports --auto-correct
859
+ Style/SymbolLiteral:
860
+ Description: Use plain symbols instead of string symbols when possible.
861
+ Enabled: true
862
+
863
+ # Supports --auto-correct
864
+ Style/SymbolProc:
865
+ Description: Use symbols as procs instead of blocks when possible.
866
+ Enabled: false
867
+ IgnoredMethods:
868
+ - respond_to
869
+
870
+ Style/TernaryParentheses:
871
+ Enabled: false
872
+
873
+ Style/TrailingBodyOnMethodDefinition:
874
+ Description: 'Method body goes below definition.'
875
+ Enabled: true
876
+
877
+ Style/TrailingCommaInArguments:
878
+ Enabled: false
879
+
880
+ # Allow trailing commas (we like 'em!)
881
+ Style/TrailingCommaInLiteral:
882
+ Enabled: true
883
+ EnforcedStyleForMultiline: consistent_comma
884
+
885
+ # Supports --auto-correct
886
+ Style/TrailingUnderscoreVariable:
887
+ Description: Checks for the usage of unneeded trailing underscores at the end of parallel
888
+ variable assignment.
889
+ Enabled: false
890
+
891
+ # Allow question mark accessor methods
892
+ Style/TrivialAccessors:
893
+ AllowPredicates: true
894
+
895
+ Style/UnlessElse:
896
+ Description: Do not use unless with else. Rewrite these with the positive case first.
897
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-else-with-unless
898
+ Enabled: true
899
+
900
+ # Supports --auto-correct
901
+ Style/UnneededCapitalW:
902
+ Description: Checks for %W when interpolation is not needed.
903
+ Enabled: false
904
+
905
+ # Supports --auto-correct
906
+ Style/UnneededInterpolation:
907
+ Description: Checks for strings that are just an interpolated expression.
908
+ Enabled: false
909
+
910
+ # Supports --auto-correct
911
+ Style/UnneededPercentQ:
912
+ Description: Checks for %q/%Q when single quotes or double quotes would do.
913
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#percent-q
914
+ Enabled: false
915
+
916
+ # Supports --auto-correct
917
+ Style/VariableInterpolation:
918
+ Description: Don't interpolate global, instance and class variables directly in strings.
919
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#curlies-interpolate
920
+ Enabled: false
921
+
922
+ # Supports --auto-correct
923
+ Style/WhenThen:
924
+ Description: Use when x then ... for one-line cases.
925
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#one-line-cases
926
+ Enabled: false
927
+
928
+ # Supports --auto-correct
929
+ Style/WhileUntilDo:
930
+ Description: Checks for redundant do after while or until.
931
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-multiline-while-do
932
+ Enabled: true
933
+
934
+ # Supports --auto-correct
935
+ Style/WhileUntilModifier:
936
+ Description: Favor modifier while/until usage when you have a single-line body.
937
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#while-as-a-modifier
938
+ Enabled: false
939
+
940
+ # Supports --auto-correct
941
+ Style/WordArray:
942
+ Description: Use %w or %W for arrays of words.
943
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#percent-w
944
+ Enabled: false
945
+ MinSize: 0
946
+ WordRegex: !ruby/regexp /\A[\p{Word}]+\z/
947
+
948
+ Style/YodaCondition:
949
+ Enabled: false
950
+
951
+ Style/ZeroLengthPredicate:
952
+ Description: 'Use #empty? when testing for objects of length 0.'
953
+ Enabled: false