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