to_factory 2.0.0 → 3.0.0.pre.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. checksums.yaml +5 -5
  2. data/.github/workflows/test.yml +35 -0
  3. data/.gitignore +1 -0
  4. data/.rubocop-disabled.yml +95 -0
  5. data/.rubocop-enabled.yml +1194 -0
  6. data/.rubocop.yml +938 -0
  7. data/CHANGELOG.md +11 -0
  8. data/Gemfile +6 -1
  9. data/README.md +11 -10
  10. data/Rakefile +17 -9
  11. data/lib/to_factory/collation.rb +9 -9
  12. data/lib/to_factory/file_sync.rb +11 -11
  13. data/lib/to_factory/file_writer.rb +18 -2
  14. data/lib/to_factory/finders/factory.rb +8 -2
  15. data/lib/to_factory/finders/model.rb +11 -13
  16. data/lib/to_factory/generation/attribute.rb +10 -12
  17. data/lib/to_factory/generation/factory.rb +3 -3
  18. data/lib/to_factory/klass_inference.rb +4 -6
  19. data/lib/to_factory/options_parser.rb +4 -4
  20. data/lib/to_factory/parsing/file.rb +87 -14
  21. data/lib/to_factory/representation.rb +9 -6
  22. data/lib/to_factory/version.rb +1 -1
  23. data/lib/to_factory.rb +7 -17
  24. data/spec/db/migrate/1_create_users.rb +4 -4
  25. data/spec/db/migrate/2_create_projects.rb +4 -4
  26. data/spec/db/migrate/3_create_not_namespaced.rb +4 -4
  27. data/spec/db/migrate/4_add_birthday_to_users.rb +3 -3
  28. data/spec/db/migrate/5_add_serialized_attributes_to_users.rb +3 -3
  29. data/spec/example_factories/admin.rb +6 -6
  30. data/spec/example_factories/admin_with_header.rb +7 -7
  31. data/spec/example_factories/inherited_project_with_header.rb +7 -0
  32. data/spec/example_factories/project_with_header.rb +4 -4
  33. data/spec/example_factories/user.rb +5 -5
  34. data/spec/example_factories/user_admin.rb +11 -11
  35. data/spec/example_factories/user_admin_root.rb +12 -12
  36. data/spec/example_factories/user_admin_super_admin.rb +6 -6
  37. data/spec/example_factories/user_admin_with_header.rb +12 -12
  38. data/spec/example_factories/user_with_header.rb +6 -6
  39. data/spec/integration/empty_factory_file_spec.rb +19 -0
  40. data/spec/integration/file_sync_spec.rb +16 -24
  41. data/spec/integration/file_writer_spec.rb +13 -9
  42. data/spec/integration/lint_spec.rb +4 -3
  43. data/spec/integration/multiple_to_factory_calls_spec.rb +96 -0
  44. data/spec/integration/non_active_record_classes_spec.rb +40 -0
  45. data/spec/integration/to_factory_method_spec.rb +21 -20
  46. data/spec/spec_helper.rb +9 -18
  47. data/spec/support/broken_models/invalid_ruby_file.rb +1 -0
  48. data/spec/support/broken_models/project.rb +3 -0
  49. data/spec/support/data_creation.rb +11 -13
  50. data/spec/support/match_sexp.rb +0 -1
  51. data/spec/support/non_active_record/inherited_project.rb +3 -0
  52. data/spec/support/non_active_record/project.rb +3 -0
  53. data/spec/support/non_active_record/some_other_service_inheriting_from_something_else.rb +4 -0
  54. data/spec/support/non_active_record/some_service.rb +2 -0
  55. data/spec/support/non_active_record/something_else.rb +2 -0
  56. data/spec/support/ruby_parser_exception_causing_string.rb +29 -29
  57. data/spec/unit/collation_spec.rb +9 -10
  58. data/spec/unit/file_writer_spec.rb +4 -8
  59. data/spec/unit/finders/factory_spec.rb +7 -9
  60. data/spec/unit/finders/model_spec.rb +35 -8
  61. data/spec/unit/generation/attribute_spec.rb +22 -22
  62. data/spec/unit/generation/factory_spec.rb +38 -14
  63. data/spec/unit/parsing/file_spec.rb +9 -9
  64. data/spec/unit/parsing/klass_inference_spec.rb +5 -7
  65. data/to_factory.gemspec +17 -15
  66. metadata +109 -44
  67. data/.travis.yml +0 -14
  68. data/lib/to_factory/parsing/syntax.rb +0 -83
@@ -0,0 +1,1194 @@
1
+ # These are all the cops that are enabled in the default configuration.
2
+
3
+ Style/AccessModifierIndentation:
4
+ Description: Check indentation of private/protected visibility modifiers.
5
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#indent-public-private-protected'
6
+ Enabled: true
7
+
8
+ Style/AccessorMethodName:
9
+ Description: Check the naming of accessor methods for get_/set_.
10
+ Enabled: true
11
+
12
+ Style/Alias:
13
+ Description: 'Use alias_method instead of alias.'
14
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#alias-method'
15
+ Enabled: true
16
+
17
+ Style/AlignArray:
18
+ Description: >-
19
+ Align the elements of an array literal if they span more than
20
+ one line.
21
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#align-multiline-arrays'
22
+ Enabled: true
23
+
24
+ Style/AlignHash:
25
+ Description: >-
26
+ Align the elements of a hash literal if they span more than
27
+ one line.
28
+ Enabled: true
29
+
30
+ Style/AlignParameters:
31
+ Description: >-
32
+ Align the parameters of a method call if they span more
33
+ than one line.
34
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-double-indent'
35
+ Enabled: true
36
+
37
+ Style/AndOr:
38
+ Description: 'Use &&/|| instead of and/or.'
39
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-and-or-or'
40
+ Enabled: true
41
+
42
+ Style/ArrayJoin:
43
+ Description: 'Use Array#join instead of Array#*.'
44
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#array-join'
45
+ Enabled: true
46
+
47
+ Style/AsciiComments:
48
+ Description: 'Use only ascii symbols in comments.'
49
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#english-comments'
50
+ Enabled: true
51
+
52
+ Style/AsciiIdentifiers:
53
+ Description: 'Use only ascii symbols in identifiers.'
54
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#english-identifiers'
55
+ Enabled: true
56
+
57
+ Style/Attr:
58
+ Description: 'Checks for uses of Module#attr.'
59
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#attr'
60
+ Enabled: true
61
+
62
+ Style/BeginBlock:
63
+ Description: 'Avoid the use of BEGIN blocks.'
64
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-BEGIN-blocks'
65
+ Enabled: true
66
+
67
+ Style/BarePercentLiterals:
68
+ Description: 'Checks if usage of %() or %Q() matches configuration.'
69
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#percent-q-shorthand'
70
+ Enabled: true
71
+
72
+ Style/BlockComments:
73
+ Description: 'Do not use block comments.'
74
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-block-comments'
75
+ Enabled: true
76
+
77
+ Style/BlockEndNewline:
78
+ Description: 'Put end statement of multiline block on its own line.'
79
+ Enabled: true
80
+
81
+ Style/BlockDelimiters:
82
+ Description: >-
83
+ Avoid using {...} for multi-line blocks (multiline chaining is
84
+ always ugly).
85
+ Prefer {...} over do...end for single-line blocks.
86
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#single-line-blocks'
87
+ Enabled: true
88
+
89
+ Style/BracesAroundHashParameters:
90
+ Description: 'Enforce braces style around hash parameters.'
91
+ Enabled: true
92
+
93
+ Style/CaseEquality:
94
+ Description: 'Avoid explicit use of the case equality operator(===).'
95
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-case-equality'
96
+ Enabled: true
97
+
98
+ Style/CaseIndentation:
99
+ Description: 'Indentation of when in a case/when/[else/]end.'
100
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#indent-when-to-case'
101
+ Enabled: true
102
+
103
+ Style/CharacterLiteral:
104
+ Description: 'Checks for uses of character literals.'
105
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-character-literals'
106
+ Enabled: true
107
+
108
+ Style/ClassAndModuleCamelCase:
109
+ Description: 'Use CamelCase for classes and modules.'
110
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#camelcase-classes'
111
+ Enabled: true
112
+
113
+ Style/ClassAndModuleChildren:
114
+ Description: 'Checks style of children classes and modules.'
115
+ Enabled: true
116
+
117
+ Style/ClassCheck:
118
+ Description: 'Enforces consistent use of `Object#is_a?` or `Object#kind_of?`.'
119
+ Enabled: true
120
+
121
+ Style/ClassMethods:
122
+ Description: 'Use self when defining module/class methods.'
123
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#def-self-class-methods'
124
+ Enabled: true
125
+
126
+ Style/ClassVars:
127
+ Description: 'Avoid the use of class variables.'
128
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-class-vars'
129
+ Enabled: true
130
+
131
+ Style/ClosingParenthesisIndentation:
132
+ Description: 'Checks the indentation of hanging closing parentheses.'
133
+ Enabled: true
134
+
135
+ Style/ColonMethodCall:
136
+ Description: 'Do not use :: for method call.'
137
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#double-colons'
138
+ Enabled: true
139
+
140
+ Style/CommandLiteral:
141
+ Description: 'Use `` or %x around command literals.'
142
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#percent-x'
143
+ Enabled: true
144
+
145
+ Style/CommentAnnotation:
146
+ Description: >-
147
+ Checks formatting of special comments
148
+ (TODO, FIXME, OPTIMIZE, HACK, REVIEW).
149
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#annotate-keywords'
150
+ Enabled: true
151
+
152
+ Style/CommentIndentation:
153
+ Description: 'Indentation of comments.'
154
+ Enabled: true
155
+
156
+ Style/ConstantName:
157
+ Description: 'Constants should use SCREAMING_SNAKE_CASE.'
158
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#screaming-snake-case'
159
+ Enabled: true
160
+
161
+ Style/DefWithParentheses:
162
+ Description: 'Use def with parentheses when there are arguments.'
163
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#method-parens'
164
+ Enabled: true
165
+
166
+ Style/DeprecatedHashMethods:
167
+ Description: 'Checks for use of deprecated Hash methods.'
168
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#hash-key'
169
+ Enabled: true
170
+
171
+ Style/Documentation:
172
+ Description: 'Document classes and non-namespace modules.'
173
+ Enabled: false
174
+ Exclude:
175
+ - 'spec/**/*'
176
+ - 'test/**/*'
177
+
178
+ Style/DotPosition:
179
+ Description: 'Checks the position of the dot in multi-line method calls.'
180
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#consistent-multi-line-chains'
181
+ Enabled: true
182
+
183
+ Style/DoubleNegation:
184
+ Description: 'Checks for uses of double negation (!!).'
185
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-bang-bang'
186
+ Enabled: true
187
+
188
+ Style/EachWithObject:
189
+ Description: 'Prefer `each_with_object` over `inject` or `reduce`.'
190
+ Enabled: true
191
+
192
+ Style/ElseAlignment:
193
+ Description: 'Align elses and elsifs correctly.'
194
+ Enabled: true
195
+
196
+ Style/EmptyElse:
197
+ Description: 'Avoid empty else-clauses.'
198
+ Enabled: true
199
+
200
+ Style/EmptyLineBetweenDefs:
201
+ Description: 'Use empty lines between defs.'
202
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#empty-lines-between-methods'
203
+ Enabled: true
204
+
205
+ Style/EmptyLines:
206
+ Description: "Don't use several empty lines in a row."
207
+ Enabled: true
208
+
209
+ Style/EmptyLinesAroundAccessModifier:
210
+ Description: "Keep blank lines around access modifiers."
211
+ Enabled: true
212
+
213
+ Style/EmptyLinesAroundBlockBody:
214
+ Description: "Keeps track of empty lines around block bodies."
215
+ Enabled: true
216
+
217
+ Style/EmptyLinesAroundClassBody:
218
+ Description: "Keeps track of empty lines around class bodies."
219
+ Enabled: true
220
+
221
+ Style/EmptyLinesAroundModuleBody:
222
+ Description: "Keeps track of empty lines around module bodies."
223
+ Enabled: true
224
+
225
+ Style/EmptyLinesAroundMethodBody:
226
+ Description: "Keeps track of empty lines around method bodies."
227
+ Enabled: true
228
+
229
+ Style/EmptyLiteral:
230
+ Description: 'Prefer literals to Array.new/Hash.new/String.new.'
231
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#literal-array-hash'
232
+ Enabled: true
233
+
234
+ Style/EndBlock:
235
+ Description: 'Avoid the use of END blocks.'
236
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-END-blocks'
237
+ Enabled: true
238
+
239
+ Style/EndOfLine:
240
+ Description: 'Use Unix-style line endings.'
241
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#crlf'
242
+ Enabled: true
243
+
244
+ Style/EvenOdd:
245
+ Description: 'Favor the use of Fixnum#even? && Fixnum#odd?'
246
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#predicate-methods'
247
+ Enabled: true
248
+
249
+ Style/ExtraSpacing:
250
+ Description: 'Do not use unnecessary spacing.'
251
+ Enabled: true
252
+
253
+ Style/FileName:
254
+ Description: 'Use snake_case for source file names.'
255
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#snake-case-files'
256
+ Enabled: true
257
+
258
+ Style/InitialIndentation:
259
+ Description: >-
260
+ Checks the indentation of the first non-blank non-comment line in a file.
261
+ Enabled: true
262
+
263
+ Style/FirstParameterIndentation:
264
+ Description: 'Checks the indentation of the first parameter in a method call.'
265
+ Enabled: true
266
+
267
+ Style/FlipFlop:
268
+ Description: 'Checks for flip flops'
269
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-flip-flops'
270
+ Enabled: true
271
+
272
+ Style/For:
273
+ Description: 'Checks use of for or each in multiline loops.'
274
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-for-loops'
275
+ Enabled: true
276
+
277
+ Style/FormatString:
278
+ Description: 'Enforce the use of Kernel#sprintf, Kernel#format or String#%.'
279
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#sprintf'
280
+ Enabled: true
281
+
282
+ Style/GlobalVars:
283
+ Description: 'Do not introduce global variables.'
284
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#instance-vars'
285
+ Reference: 'http://www.zenspider.com/Languages/Ruby/QuickRef.html'
286
+ Enabled: true
287
+
288
+ Style/GuardClause:
289
+ Description: 'Check for conditionals that can be replaced with guard clauses'
290
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-nested-conditionals'
291
+ Enabled: true
292
+
293
+ Style/HashSyntax:
294
+ Description: >-
295
+ Prefer Ruby 1.9 hash syntax { a: 1, b: 2 } over 1.8 syntax
296
+ { :a => 1, :b => 2 }.
297
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#hash-literals'
298
+ Enabled: true
299
+
300
+ Style/IfUnlessModifier:
301
+ Description: >-
302
+ Favor modifier if/unless usage when you have a
303
+ single-line body.
304
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#if-as-a-modifier'
305
+ Enabled: true
306
+
307
+ Style/IfWithSemicolon:
308
+ Description: 'Do not use if x; .... Use the ternary operator instead.'
309
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-semicolon-ifs'
310
+ Enabled: true
311
+
312
+ Style/IndentationConsistency:
313
+ Description: 'Keep indentation straight.'
314
+ Enabled: true
315
+
316
+ Style/IndentationWidth:
317
+ Description: 'Use 2 spaces for indentation.'
318
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#spaces-indentation'
319
+ Enabled: true
320
+
321
+ Style/IndentArray:
322
+ Description: >-
323
+ Checks the indentation of the first element in an array
324
+ literal.
325
+ Enabled: true
326
+
327
+ Style/IndentHash:
328
+ Description: 'Checks the indentation of the first key in a hash literal.'
329
+ Enabled: true
330
+
331
+ Style/InfiniteLoop:
332
+ Description: 'Use Kernel#loop for infinite loops.'
333
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#infinite-loop'
334
+ Enabled: true
335
+
336
+ Style/Lambda:
337
+ Description: 'Use the new lambda literal syntax for single-line blocks.'
338
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#lambda-multi-line'
339
+ Enabled: true
340
+
341
+ Style/LambdaCall:
342
+ Description: 'Use lambda.call(...) instead of lambda.(...).'
343
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#proc-call'
344
+ Enabled: true
345
+
346
+ Style/LeadingCommentSpace:
347
+ Description: 'Comments should start with a space.'
348
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#hash-space'
349
+ Enabled: true
350
+
351
+ Style/LineEndConcatenation:
352
+ Description: >-
353
+ Use \ instead of + or << to concatenate two string literals at
354
+ line end.
355
+ Enabled: true
356
+
357
+ Style/MethodCallParentheses:
358
+ Description: 'Do not use parentheses for method calls with no arguments.'
359
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-args-no-parens'
360
+ Enabled: true
361
+
362
+ Style/MethodDefParentheses:
363
+ Description: >-
364
+ Checks if the method definitions have or don't have
365
+ parentheses.
366
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#method-parens'
367
+ Enabled: true
368
+
369
+ Style/MethodName:
370
+ Description: 'Use the configured style when naming methods.'
371
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#snake-case-symbols-methods-vars'
372
+ Enabled: true
373
+
374
+ Style/ModuleFunction:
375
+ Description: 'Checks for usage of `extend self` in modules.'
376
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#module-function'
377
+ Enabled: true
378
+
379
+ Style/MultilineBlockChain:
380
+ Description: 'Avoid multi-line chains of blocks.'
381
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#single-line-blocks'
382
+ Enabled: true
383
+
384
+ Style/MultilineBlockLayout:
385
+ Description: 'Ensures newlines after multiline block do statements.'
386
+ Enabled: true
387
+
388
+ Style/MultilineIfThen:
389
+ Description: 'Do not use then for multi-line if/unless.'
390
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-then'
391
+ Enabled: true
392
+
393
+ Style/MultilineOperationIndentation:
394
+ Description: >-
395
+ Checks indentation of binary operations that span more than
396
+ one line.
397
+ Enabled: true
398
+
399
+ Style/MultilineTernaryOperator:
400
+ Description: >-
401
+ Avoid multi-line ?: (the ternary operator);
402
+ use if/unless instead.
403
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-multiline-ternary'
404
+ Enabled: true
405
+
406
+ Style/NegatedIf:
407
+ Description: >-
408
+ Favor unless over if for negative conditions
409
+ (or control flow or).
410
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#unless-for-negatives'
411
+ Enabled: true
412
+
413
+ Style/NegatedWhile:
414
+ Description: 'Favor until over while for negative conditions.'
415
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#until-for-negatives'
416
+ Enabled: true
417
+
418
+ Style/NestedModifier:
419
+ Description: 'Avoid using nested modifiers.'
420
+ Enabled: true
421
+
422
+ Style/NestedTernaryOperator:
423
+ Description: 'Use one expression per branch in a ternary operator.'
424
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-nested-ternary'
425
+ Enabled: true
426
+
427
+ Style/Next:
428
+ Description: 'Use `next` to skip iteration instead of a condition at the end.'
429
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-nested-conditionals'
430
+ Enabled: true
431
+
432
+ Style/NilComparison:
433
+ Description: 'Prefer x.nil? to x == nil.'
434
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#predicate-methods'
435
+ Enabled: true
436
+
437
+ Style/NonNilCheck:
438
+ Description: 'Checks for redundant nil checks.'
439
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-non-nil-checks'
440
+ Enabled: true
441
+
442
+ Style/Not:
443
+ Description: 'Use ! instead of not.'
444
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#bang-not-not'
445
+ Enabled: true
446
+
447
+ Style/NumericLiterals:
448
+ Description: >-
449
+ Add underscores to large numeric literals to improve their
450
+ readability.
451
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#underscores-in-numerics'
452
+ Enabled: true
453
+
454
+ Style/OneLineConditional:
455
+ Description: >-
456
+ Favor the ternary operator(?:) over
457
+ if/then/else/end constructs.
458
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#ternary-operator'
459
+ Enabled: true
460
+
461
+ Style/OpMethod:
462
+ Description: 'When defining binary operators, name the argument other.'
463
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#other-arg'
464
+ Enabled: true
465
+
466
+ Style/OptionalArguments:
467
+ Description: >-
468
+ Checks for optional arguments that do not appear at the end
469
+ of the argument list
470
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#optional-arguments'
471
+ Enabled: true
472
+
473
+ Style/ParallelAssignment:
474
+ Description: >-
475
+ Check for simple usages of parallel assignment.
476
+ It will only warn when the number of variables
477
+ matches on both sides of the assignment.
478
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#parallel-assignment'
479
+ Enabled: true
480
+
481
+ Style/ParenthesesAroundCondition:
482
+ Description: >-
483
+ Don't use parentheses around the condition of an
484
+ if/unless/while.
485
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-parens-if'
486
+ Enabled: true
487
+
488
+ Style/PercentLiteralDelimiters:
489
+ Description: 'Use `%`-literal delimiters consistently'
490
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#percent-literal-braces'
491
+ Enabled: true
492
+
493
+ Style/PercentQLiterals:
494
+ Description: 'Checks if uses of %Q/%q match the configured preference.'
495
+ Enabled: true
496
+
497
+ Style/PerlBackrefs:
498
+ Description: 'Avoid Perl-style regex back references.'
499
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-perl-regexp-last-matchers'
500
+ Enabled: true
501
+
502
+ Style/PredicateName:
503
+ Description: 'Check the names of predicate methods.'
504
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#bool-methods-qmark'
505
+ Enabled: true
506
+
507
+ Style/Proc:
508
+ Description: 'Use proc instead of Proc.new.'
509
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#proc'
510
+ Enabled: true
511
+
512
+ Style/RaiseArgs:
513
+ Description: 'Checks the arguments passed to raise/fail.'
514
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#exception-class-messages'
515
+ Enabled: true
516
+
517
+ Style/RedundantBegin:
518
+ Description: "Don't use begin blocks when they are not needed."
519
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#begin-implicit'
520
+ Enabled: true
521
+
522
+ Style/RedundantException:
523
+ Description: "Checks for an obsolete RuntimeException argument in raise/fail."
524
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-explicit-runtimeerror'
525
+ Enabled: true
526
+
527
+ Style/RedundantFreeze:
528
+ Description: "Checks usages of Object#freeze on immutable objects."
529
+ Enabled: true
530
+
531
+ Style/RedundantReturn:
532
+ Description: "Don't use return where it's not required."
533
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-explicit-return'
534
+ Enabled: true
535
+
536
+ Style/RedundantSelf:
537
+ Description: "Don't use self where it's not needed."
538
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-self-unless-required'
539
+ Enabled: true
540
+
541
+ Style/RegexpLiteral:
542
+ Description: 'Use / or %r around regular expressions.'
543
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#percent-r'
544
+ Enabled: true
545
+
546
+ Style/RescueEnsureAlignment:
547
+ Description: 'Align rescues and ensures correctly.'
548
+ Enabled: true
549
+
550
+ Style/RescueModifier:
551
+ Description: 'Avoid using rescue in its modifier form.'
552
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-rescue-modifiers'
553
+ Enabled: true
554
+
555
+ Style/SelfAssignment:
556
+ Description: >-
557
+ Checks for places where self-assignment shorthand should have
558
+ been used.
559
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#self-assignment'
560
+ Enabled: true
561
+
562
+ Style/Semicolon:
563
+ Description: "Don't use semicolons to terminate expressions."
564
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-semicolon'
565
+ Enabled: true
566
+
567
+ Style/SignalException:
568
+ Description: 'Checks for proper usage of fail and raise.'
569
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#fail-method'
570
+ Enabled: true
571
+
572
+ Style/SingleLineBlockParams:
573
+ Description: 'Enforces the names of some block params.'
574
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#reduce-blocks'
575
+ Enabled: true
576
+
577
+ Style/SingleLineMethods:
578
+ Description: 'Avoid single-line methods.'
579
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-single-line-methods'
580
+ Enabled: true
581
+
582
+ Style/SingleSpaceBeforeFirstArg:
583
+ Description: >-
584
+ Checks that exactly one space is used between a method name
585
+ and the first argument for method calls without parentheses.
586
+ Enabled: true
587
+
588
+ Style/SpaceAfterColon:
589
+ Description: 'Use spaces after colons.'
590
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#spaces-operators'
591
+ Enabled: true
592
+
593
+ Style/SpaceAfterComma:
594
+ Description: 'Use spaces after commas.'
595
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#spaces-operators'
596
+ Enabled: true
597
+
598
+ Style/SpaceAfterControlKeyword:
599
+ Description: 'Use spaces after if/elsif/unless/while/until/case/when.'
600
+ Enabled: true
601
+
602
+ Style/SpaceAfterMethodName:
603
+ Description: >-
604
+ Do not put a space between a method name and the opening
605
+ parenthesis in a method definition.
606
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#parens-no-spaces'
607
+ Enabled: true
608
+
609
+ Style/SpaceAfterNot:
610
+ Description: Tracks redundant space after the ! operator.
611
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-space-bang'
612
+ Enabled: true
613
+
614
+ Style/SpaceAfterSemicolon:
615
+ Description: 'Use spaces after semicolons.'
616
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#spaces-operators'
617
+ Enabled: true
618
+
619
+ Style/SpaceBeforeBlockBraces:
620
+ Description: >-
621
+ Checks that the left block brace has or doesn't have space
622
+ before it.
623
+ Enabled: true
624
+
625
+ Style/SpaceBeforeComma:
626
+ Description: 'No spaces before commas.'
627
+ Enabled: true
628
+
629
+ Style/SpaceBeforeComment:
630
+ Description: >-
631
+ Checks for missing space between code and a comment on the
632
+ same line.
633
+ Enabled: true
634
+
635
+ Style/SpaceBeforeSemicolon:
636
+ Description: 'No spaces before semicolons.'
637
+ Enabled: true
638
+
639
+ Style/SpaceInsideBlockBraces:
640
+ Description: >-
641
+ Checks that block braces have or don't have surrounding space.
642
+ For blocks taking parameters, checks that the left brace has
643
+ or doesn't have trailing space.
644
+ Enabled: true
645
+
646
+ Style/SpaceAroundBlockParameters:
647
+ Description: 'Checks the spacing inside and after block parameters pipes.'
648
+ Enabled: true
649
+
650
+ Style/SpaceAroundEqualsInParameterDefault:
651
+ Description: >-
652
+ Checks that the equals signs in parameter default assignments
653
+ have or don't have surrounding space depending on
654
+ configuration.
655
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#spaces-around-equals'
656
+ Enabled: true
657
+
658
+ Style/SpaceAroundOperators:
659
+ Description: 'Use a single space around operators.'
660
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#spaces-operators'
661
+ Enabled: true
662
+
663
+ Style/SpaceBeforeModifierKeyword:
664
+ Description: 'Put a space before the modifier keyword.'
665
+ Enabled: true
666
+
667
+ Style/SpaceInsideBrackets:
668
+ Description: 'No spaces after [ or before ].'
669
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-spaces-braces'
670
+ Enabled: true
671
+
672
+ Style/SpaceInsideHashLiteralBraces:
673
+ Description: "Use spaces inside hash literal braces - or don't."
674
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#spaces-operators'
675
+ Enabled: true
676
+
677
+ Style/SpaceInsideParens:
678
+ Description: 'No spaces after ( or before ).'
679
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-spaces-braces'
680
+ Enabled: true
681
+
682
+ Style/SpaceInsideRangeLiteral:
683
+ Description: 'No spaces inside range literals.'
684
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-space-inside-range-literals'
685
+ Enabled: true
686
+
687
+ Style/SpaceInsideStringInterpolation:
688
+ Description: 'Checks for padding/surrounding spaces inside string interpolation.'
689
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#string-interpolation'
690
+ Enabled: true
691
+
692
+ Style/SpecialGlobalVars:
693
+ Description: 'Avoid Perl-style global variables.'
694
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-cryptic-perlisms'
695
+ Enabled: true
696
+
697
+ Style/StabbyLambdaParentheses:
698
+ Description: 'Check for the usage of parentheses around stabby lambda arguments.'
699
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#stabby-lambda-with-args'
700
+ Enabled: true
701
+
702
+ Style/StringLiterals:
703
+ Description: 'Checks if uses of quotes match the configured preference.'
704
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#consistent-string-literals'
705
+ Enabled: true
706
+
707
+ Style/StringLiteralsInInterpolation:
708
+ Description: >-
709
+ Checks if uses of quotes inside expressions in interpolated
710
+ strings match the configured preference.
711
+ Enabled: true
712
+
713
+ Style/StructInheritance:
714
+ Description: 'Checks for inheritance from Struct.new.'
715
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-extend-struct-new'
716
+ Enabled: true
717
+
718
+ Style/SymbolLiteral:
719
+ Description: 'Use plain symbols instead of string symbols when possible.'
720
+ Enabled: true
721
+
722
+ Style/SymbolProc:
723
+ Description: 'Use symbols as procs instead of blocks when possible.'
724
+ Enabled: true
725
+
726
+ Style/Tab:
727
+ Description: 'No hard tabs.'
728
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#spaces-indentation'
729
+ Enabled: true
730
+
731
+ Style/TrailingBlankLines:
732
+ Description: 'Checks trailing blank lines and final newline.'
733
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#newline-eof'
734
+ Enabled: true
735
+
736
+ Style/TrailingComma:
737
+ Description: 'Checks for trailing comma in parameter lists and literals.'
738
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas'
739
+ Enabled: true
740
+
741
+ Style/TrailingWhitespace:
742
+ Description: 'Avoid trailing whitespace.'
743
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-whitespace'
744
+ Enabled: true
745
+
746
+ Style/TrivialAccessors:
747
+ Description: 'Prefer attr_* methods to trivial readers/writers.'
748
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#attr_family'
749
+ Enabled: true
750
+
751
+ Style/UnlessElse:
752
+ Description: >-
753
+ Do not use unless with else. Rewrite these with the positive
754
+ case first.
755
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-else-with-unless'
756
+ Enabled: true
757
+
758
+ Style/UnneededCapitalW:
759
+ Description: 'Checks for %W when interpolation is not needed.'
760
+ Enabled: true
761
+
762
+ Style/UnneededPercentQ:
763
+ Description: 'Checks for %q/%Q when single quotes or double quotes would do.'
764
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#percent-q'
765
+ Enabled: true
766
+
767
+ Style/TrailingUnderscoreVariable:
768
+ Description: >-
769
+ Checks for the usage of unneeded trailing underscores at the
770
+ end of parallel variable assignment.
771
+ AllowNamedUnderscoreVariables: true
772
+ Enabled: true
773
+
774
+ Style/VariableInterpolation:
775
+ Description: >-
776
+ Don't interpolate global, instance and class variables
777
+ directly in strings.
778
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#curlies-interpolate'
779
+ Enabled: true
780
+
781
+ Style/VariableName:
782
+ Description: 'Use the configured style when naming variables.'
783
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#snake-case-symbols-methods-vars'
784
+ Enabled: true
785
+
786
+ Style/WhenThen:
787
+ Description: 'Use when x then ... for one-line cases.'
788
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#one-line-cases'
789
+ Enabled: true
790
+
791
+ Style/WhileUntilDo:
792
+ Description: 'Checks for redundant do after while or until.'
793
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-multiline-while-do'
794
+ Enabled: true
795
+
796
+ Style/WhileUntilModifier:
797
+ Description: >-
798
+ Favor modifier while/until usage when you have a
799
+ single-line body.
800
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#while-as-a-modifier'
801
+ Enabled: true
802
+
803
+ Style/WordArray:
804
+ Description: 'Use %w or %W for arrays of words.'
805
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#percent-w'
806
+ Enabled: true
807
+
808
+ #################### Metrics ################################
809
+
810
+ Metrics/AbcSize:
811
+ Description: >-
812
+ A calculated magnitude based on number of assignments,
813
+ branches, and conditions.
814
+ Reference: 'http://c2.com/cgi/wiki?AbcMetric'
815
+ Enabled: true
816
+
817
+ Metrics/BlockNesting:
818
+ Description: 'Avoid excessive block nesting'
819
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#three-is-the-number-thou-shalt-count'
820
+ Enabled: true
821
+
822
+ Metrics/ClassLength:
823
+ Description: 'Avoid classes longer than 100 lines of code.'
824
+ Enabled: true
825
+
826
+ Metrics/ModuleLength:
827
+ Description: 'Avoid modules longer than 100 lines of code.'
828
+ Enabled: true
829
+
830
+ Metrics/CyclomaticComplexity:
831
+ Description: >-
832
+ A complexity metric that is strongly correlated to the number
833
+ of test cases needed to validate a method.
834
+ Enabled: true
835
+
836
+ Metrics/LineLength:
837
+ Description: 'Limit lines to 80 characters.'
838
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#80-character-limits'
839
+ Enabled: true
840
+
841
+ Metrics/MethodLength:
842
+ Description: 'Avoid methods longer than 10 lines of code.'
843
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#short-methods'
844
+ Enabled: true
845
+
846
+ Metrics/ParameterLists:
847
+ Description: 'Avoid parameter lists longer than three or four parameters.'
848
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#too-many-params'
849
+ Enabled: true
850
+
851
+ Metrics/PerceivedComplexity:
852
+ Description: >-
853
+ A complexity metric geared towards measuring complexity for a
854
+ human reader.
855
+ Enabled: true
856
+
857
+ #################### Lint ################################
858
+ ### Warnings
859
+
860
+ Lint/AmbiguousOperator:
861
+ Description: >-
862
+ Checks for ambiguous operators in the first argument of a
863
+ method invocation without parentheses.
864
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#parens-as-args'
865
+ Enabled: true
866
+
867
+ Lint/AmbiguousRegexpLiteral:
868
+ Description: >-
869
+ Checks for ambiguous regexp literals in the first argument of
870
+ a method invocation without parentheses.
871
+ Enabled: true
872
+
873
+ Lint/AssignmentInCondition:
874
+ Description: "Don't use assignment in conditions."
875
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#safe-assignment-in-condition'
876
+ Enabled: true
877
+
878
+ Lint/BlockAlignment:
879
+ Description: 'Align block ends correctly.'
880
+ Enabled: true
881
+
882
+ Lint/CircularArgumentReference:
883
+ Description: "Default values in optional keyword arguments and optional ordinal arguments should not refer back to the name of the argument."
884
+ Enabled: true
885
+
886
+ Lint/ConditionPosition:
887
+ Description: >-
888
+ Checks for condition placed in a confusing position relative to
889
+ the keyword.
890
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#same-line-condition'
891
+ Enabled: true
892
+
893
+ Lint/Debugger:
894
+ Description: 'Check for debugger calls.'
895
+ Enabled: true
896
+
897
+ Lint/DefEndAlignment:
898
+ Description: 'Align ends corresponding to defs correctly.'
899
+ Enabled: true
900
+
901
+ Lint/DeprecatedClassMethods:
902
+ Description: 'Check for deprecated class method calls.'
903
+ Enabled: true
904
+
905
+ Lint/DuplicateMethods:
906
+ Description: 'Check for duplicate methods calls.'
907
+ Enabled: true
908
+
909
+ Lint/DuplicatedKey:
910
+ Description: 'Check for duplicate keys in hash literals.'
911
+ Enabled: true
912
+
913
+ Lint/EachWithObjectArgument:
914
+ Description: 'Check for immutable argument given to each_with_object.'
915
+ Enabled: true
916
+
917
+ Lint/ElseLayout:
918
+ Description: 'Check for odd code arrangement in an else block.'
919
+ Enabled: true
920
+
921
+ Lint/EmptyEnsure:
922
+ Description: 'Checks for empty ensure block.'
923
+ Enabled: true
924
+
925
+ Lint/EmptyInterpolation:
926
+ Description: 'Checks for empty string interpolation.'
927
+ Enabled: true
928
+
929
+ Lint/EndAlignment:
930
+ Description: 'Align ends correctly.'
931
+ Enabled: true
932
+
933
+ Lint/EndInMethod:
934
+ Description: 'END blocks should not be placed inside method definitions.'
935
+ Enabled: true
936
+
937
+ Lint/EnsureReturn:
938
+ Description: 'Do not use return in an ensure block.'
939
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-return-ensure'
940
+ Enabled: true
941
+
942
+ Lint/Eval:
943
+ Description: 'The use of eval represents a serious security risk.'
944
+ Enabled: true
945
+
946
+ Lint/FormatParameterMismatch:
947
+ Description: 'The number of parameters to format/sprint must match the fields.'
948
+ Enabled: true
949
+
950
+ Lint/HandleExceptions:
951
+ Description: "Don't suppress exception."
952
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#dont-hide-exceptions'
953
+ Enabled: true
954
+
955
+ Lint/InvalidCharacterLiteral:
956
+ Description: >-
957
+ Checks for invalid character literals with a non-escaped
958
+ whitespace character.
959
+ Enabled: true
960
+
961
+ Lint/LiteralInCondition:
962
+ Description: 'Checks of literals used in conditions.'
963
+ Enabled: true
964
+
965
+ Lint/LiteralInInterpolation:
966
+ Description: 'Checks for literals used in interpolation.'
967
+ Enabled: true
968
+
969
+ Lint/Loop:
970
+ Description: >-
971
+ Use Kernel#loop with break rather than begin/end/until or
972
+ begin/end/while for post-loop tests.
973
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#loop-with-break'
974
+ Enabled: true
975
+
976
+ Lint/NestedMethodDefinition:
977
+ Description: 'Do not use nested method definitions.'
978
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-nested-methods'
979
+ Enabled: true
980
+
981
+ Lint/NonLocalExitFromIterator:
982
+ Description: 'Do not use return in iterator to cause non-local exit.'
983
+ Enabled: true
984
+
985
+ Lint/ParenthesesAsGroupedExpression:
986
+ Description: >-
987
+ Checks for method calls with a space before the opening
988
+ parenthesis.
989
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#parens-no-spaces'
990
+ Enabled: true
991
+
992
+ Lint/RequireParentheses:
993
+ Description: >-
994
+ Use parentheses in the method call to avoid confusion
995
+ about precedence.
996
+ Enabled: true
997
+
998
+ Lint/RescueException:
999
+ Description: 'Avoid rescuing the Exception class.'
1000
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-blind-rescues'
1001
+ Enabled: true
1002
+
1003
+ Lint/ShadowingOuterLocalVariable:
1004
+ Description: >-
1005
+ Do not use the same name as outer local variable
1006
+ for block arguments or block local variables.
1007
+ Enabled: true
1008
+
1009
+ Lint/SpaceBeforeFirstArg:
1010
+ Description: >-
1011
+ Put a space between a method name and the first argument
1012
+ in a method call without parentheses.
1013
+ Enabled: true
1014
+
1015
+ Lint/StringConversionInInterpolation:
1016
+ Description: 'Checks for Object#to_s usage in string interpolation.'
1017
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-to-s'
1018
+ Enabled: true
1019
+
1020
+ Lint/UnderscorePrefixedVariableName:
1021
+ Description: 'Do not use prefix `_` for a variable that is used.'
1022
+ Enabled: true
1023
+
1024
+ Lint/UnneededDisable:
1025
+ Description: >-
1026
+ Checks for rubocop:disable comments that can be removed.
1027
+ Note: this cop is not disabled when disabling all cops.
1028
+ It must be explicitly disabled.
1029
+ Enabled: true
1030
+
1031
+ Lint/UnusedBlockArgument:
1032
+ Description: 'Checks for unused block arguments.'
1033
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#underscore-unused-vars'
1034
+ Enabled: true
1035
+
1036
+ Lint/UnusedMethodArgument:
1037
+ Description: 'Checks for unused method arguments.'
1038
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#underscore-unused-vars'
1039
+ Enabled: true
1040
+
1041
+ Lint/UnreachableCode:
1042
+ Description: 'Unreachable code.'
1043
+ Enabled: true
1044
+
1045
+ Lint/UselessAccessModifier:
1046
+ Description: 'Checks for useless access modifiers.'
1047
+ Enabled: true
1048
+
1049
+ Lint/UselessAssignment:
1050
+ Description: 'Checks for useless assignment to a local variable.'
1051
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#underscore-unused-vars'
1052
+ Enabled: true
1053
+
1054
+ Lint/UselessComparison:
1055
+ Description: 'Checks for comparison of something with itself.'
1056
+ Enabled: true
1057
+
1058
+ Lint/UselessElseWithoutRescue:
1059
+ Description: 'Checks for useless `else` in `begin..end` without `rescue`.'
1060
+ Enabled: true
1061
+
1062
+ Lint/UselessSetterCall:
1063
+ Description: 'Checks for useless setter call to a local variable.'
1064
+ Enabled: true
1065
+
1066
+ Lint/Void:
1067
+ Description: 'Possible use of operator/literal/variable in void context.'
1068
+ Enabled: true
1069
+
1070
+ ##################### Performance #############################
1071
+
1072
+ Performance/CaseWhenSplat:
1073
+ Description: >-
1074
+ Place `when` conditions that use splat at the end
1075
+ of the list of `when` branches.
1076
+ Enabled: true
1077
+
1078
+ Performance/Count:
1079
+ Description: >-
1080
+ Use `count` instead of `select...size`, `reject...size`,
1081
+ `select...count`, `reject...count`, `select...length`,
1082
+ and `reject...length`.
1083
+ Enabled: true
1084
+
1085
+ Performance/Detect:
1086
+ Description: >-
1087
+ Use `detect` instead of `select.first`, `find_all.first`,
1088
+ `select.last`, and `find_all.last`.
1089
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerabledetect-vs-enumerableselectfirst-code'
1090
+ Enabled: true
1091
+
1092
+ Performance/FixedSize:
1093
+ Description: 'Do not compute the size of statically sized objects except in constants'
1094
+ Enabled: true
1095
+
1096
+ Performance/FlatMap:
1097
+ Description: >-
1098
+ Use `Enumerable#flat_map`
1099
+ instead of `Enumerable#map...Array#flatten(1)`
1100
+ or `Enumberable#collect..Array#flatten(1)`
1101
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerablemaparrayflatten-vs-enumerableflat_map-code'
1102
+ Enabled: true
1103
+ EnabledForFlattenWithoutParams: false
1104
+ # If enabled, this cop will warn about usages of
1105
+ # `flatten` being called without any parameters.
1106
+ # This can be dangerous since `flat_map` will only flatten 1 level, and
1107
+ # `flatten` without any parameters can flatten multiple levels.
1108
+
1109
+ Performance/ReverseEach:
1110
+ Description: 'Use `reverse_each` instead of `reverse.each`.'
1111
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerablereverseeach-vs-enumerablereverse_each-code'
1112
+ Enabled: true
1113
+
1114
+ Performance/Sample:
1115
+ Description: >-
1116
+ Use `sample` instead of `shuffle.first`,
1117
+ `shuffle.last`, and `shuffle[Fixnum]`.
1118
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#arrayshufflefirst-vs-arraysample-code'
1119
+ Enabled: true
1120
+
1121
+ Performance/Size:
1122
+ Description: >-
1123
+ Use `size` instead of `count` for counting
1124
+ the number of elements in `Array` and `Hash`.
1125
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#arraycount-vs-arraysize-code'
1126
+ Enabled: true
1127
+
1128
+ Performance/StringReplacement:
1129
+ Description: >-
1130
+ Use `tr` instead of `gsub` when you are replacing the same
1131
+ number of characters. Use `delete` instead of `gsub` when
1132
+ you are deleting characters.
1133
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringgsub-vs-stringtr-code'
1134
+ Enabled: true
1135
+
1136
+ ##################### Rails ##################################
1137
+
1138
+ Rails/ActionFilter:
1139
+ Description: 'Enforces consistent use of action filter methods.'
1140
+ Enabled: true
1141
+
1142
+ Rails/Date:
1143
+ Description: >-
1144
+ Checks the correct usage of date aware methods,
1145
+ such as Date.today, Date.current etc.
1146
+ Enabled: true
1147
+
1148
+ Rails/DefaultScope:
1149
+ Description: 'Checks if the argument passed to default_scope is a block.'
1150
+ Enabled: true
1151
+
1152
+ Rails/Delegate:
1153
+ Description: 'Prefer delegate method for delegations.'
1154
+ Enabled: true
1155
+
1156
+ Rails/FindBy:
1157
+ Description: 'Prefer find_by over where.first.'
1158
+ Enabled: true
1159
+
1160
+ Rails/FindEach:
1161
+ Description: 'Prefer all.find_each over all.find.'
1162
+ Enabled: true
1163
+
1164
+ Rails/HasAndBelongsToMany:
1165
+ Description: 'Prefer has_many :through to has_and_belongs_to_many.'
1166
+ Enabled: true
1167
+
1168
+ Rails/Output:
1169
+ Description: 'Checks for calls to puts, print, etc.'
1170
+ Enabled: true
1171
+
1172
+ Rails/PluralizationGrammar:
1173
+ Description: 'Checks for incorrect grammar when using methods like `3.day.ago`.'
1174
+ Enabled: true
1175
+
1176
+ Rails/ReadWriteAttribute:
1177
+ Description: >-
1178
+ Checks for read_attribute(:attr) and
1179
+ write_attribute(:attr, val).
1180
+ Enabled: true
1181
+
1182
+ Rails/ScopeArgs:
1183
+ Description: 'Checks the arguments of ActiveRecord scopes.'
1184
+ Enabled: true
1185
+
1186
+ Rails/TimeZone:
1187
+ Description: 'Checks the correct usage of time zone aware methods.'
1188
+ StyleGuide: 'https://github.com/bbatsov/rails-style-guide#time'
1189
+ Reference: 'http://danilenko.org/2012/7/6/rails_timezones'
1190
+ Enabled: true
1191
+
1192
+ Rails/Validation:
1193
+ Description: 'Use validates :attribute, hash of validations.'
1194
+ Enabled: true