gatemedia_rubocop 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,1548 @@
1
+ # This is the default configuration file. Enabling and disabling is configured
2
+ # in separate files. This file adds all other parameters apart from Enabled.
3
+
4
+ inherit_from:
5
+ - enabled.yml
6
+ - disabled.yml
7
+
8
+ # Common configuration.
9
+ AllCops:
10
+ # Include common Ruby source files.
11
+ Include:
12
+ - '**/*.builder'
13
+ - '**/*.fcgi'
14
+ - '**/*.gemspec'
15
+ - '**/*.god'
16
+ - '**/*.jb'
17
+ - '**/*.jbuilder'
18
+ - '**/*.mspec'
19
+ - '**/*.opal'
20
+ - '**/*.pluginspec'
21
+ - '**/*.podspec'
22
+ - '**/*.rabl'
23
+ - '**/*.rake'
24
+ - '**/*.rbuild'
25
+ - '**/*.rbw'
26
+ - '**/*.rbx'
27
+ - '**/*.ru'
28
+ - '**/*.ruby'
29
+ - '**/*.spec'
30
+ - '**/*.thor'
31
+ - '**/*.watchr'
32
+ - '**/.irbrc'
33
+ - '**/.pryrc'
34
+ - '**/buildfile'
35
+ - '**/config.ru'
36
+ - '**/Appraisals'
37
+ - '**/Berksfile'
38
+ - '**/Brewfile'
39
+ - '**/Buildfile'
40
+ - '**/Capfile'
41
+ - '**/Cheffile'
42
+ - '**/Dangerfile'
43
+ - '**/Deliverfile'
44
+ - '**/Fastfile'
45
+ - '**/*Fastfile'
46
+ - '**/Gemfile'
47
+ - '**/Guardfile'
48
+ - '**/Jarfile'
49
+ - '**/Mavenfile'
50
+ - '**/Podfile'
51
+ - '**/Puppetfile'
52
+ - '**/Rakefile'
53
+ - '**/Snapfile'
54
+ - '**/Thorfile'
55
+ - '**/Vagabondfile'
56
+ - '**/Vagrantfile'
57
+ Exclude:
58
+ - 'vendor/**/*'
59
+ # Default formatter will be used if no `-f/--format` option is given.
60
+ DefaultFormatter: progress
61
+ # Cop names are not displayed in offense messages by default. Change behavior
62
+ # by overriding DisplayCopNames, or by giving the `-D/--display-cop-names`
63
+ # option.
64
+ DisplayCopNames: false
65
+ # Style guide URLs are not displayed in offense messages by default. Change
66
+ # behavior by overriding `DisplayStyleGuide`, or by giving the
67
+ # `-S/--display-style-guide` option.
68
+ DisplayStyleGuide: false
69
+ # When specifying style guide URLs, any paths and/or fragments will be
70
+ # evaluated relative to the base URL.
71
+ StyleGuideBaseURL: https://github.com/bbatsov/ruby-style-guide
72
+ # Extra details are not displayed in offense messages by default. Change
73
+ # behavior by overriding ExtraDetails, or by giving the
74
+ # `-E/--extra-details` option.
75
+ ExtraDetails: false
76
+ # Additional cops that do not reference a style guide rule may be enabled by
77
+ # default. Change behavior by overriding `StyleGuideCopsOnly`, or by giving
78
+ # the `--only-guide-cops` option.
79
+ StyleGuideCopsOnly: false
80
+ # All cops except the ones in disabled.yml are enabled by default. Change
81
+ # this behavior by overriding either `DisabledByDefault` or `EnabledByDefault`.
82
+ # When `DisabledByDefault` is `true`, all cops in the default configuration
83
+ # are disabled, and only cops in user configuration are enabled. This makes
84
+ # cops opt-in instead of opt-out. Note that when `DisabledByDefault` is `true`,
85
+ # cops in user configuration will be enabled even if they don't set the
86
+ # Enabled parameter.
87
+ # When `EnabledByDefault` is `true`, all cops, even those in disabled.yml,
88
+ # are enabled by default. Cops can still be disabled in user configuration.
89
+ # Note that it is invalid to set both EnabledByDefault and DisabledByDefault
90
+ # to true in the same configuration.
91
+ EnabledByDefault: false
92
+ DisabledByDefault: false
93
+ # Enables the result cache if `true`. Can be overridden by the `--cache` command
94
+ # line option.
95
+ UseCache: true
96
+ # Threshold for how many files can be stored in the result cache before some
97
+ # of the files are automatically removed.
98
+ MaxFilesInCache: 20000
99
+ # The cache will be stored in "rubocop_cache" under this directory. If
100
+ # CacheRootDirectory is ~ (nil), which it is by default, the root will be
101
+ # taken from the environment variable `$XDG_CACHE_HOME` if it is set, or if
102
+ # `$XDG_CACHE_HOME` is not set, it will be `$HOME/.cache/`.
103
+ CacheRootDirectory: ~
104
+ # It is possible for a malicious user to know the location of RuboCop's cache
105
+ # directory by looking at CacheRootDirectory, and create a symlink in its
106
+ # place that could cause RuboCop to overwrite unintended files, or read
107
+ # malicious input. If you are certain that your cache location is secure from
108
+ # this kind of attack, and wish to use a symlinked cache location, set this
109
+ # value to "true".
110
+ AllowSymlinksInCacheRootDirectory: false
111
+ # What MRI version of the Ruby interpreter is the inspected code intended to
112
+ # run on? (If there is more than one, set this to the lowest version.)
113
+ # If a value is specified for TargetRubyVersion then it is used.
114
+ # Else if .ruby-version exists and it contains an MRI version it is used.
115
+ # Otherwise we fallback to the oldest officially supported Ruby version (2.1).
116
+ TargetRubyVersion: ~
117
+ TargetRailsVersion: 5.0
118
+
119
+ #################### Layout ###########################
120
+
121
+ # Indent private/protected/public as deep as method definitions
122
+ Layout/AccessModifierIndentation:
123
+ EnforcedStyle: indent
124
+ SupportedStyles:
125
+ - outdent
126
+ - indent
127
+ # By default, the indentation width from Layout/IndentationWidth is used
128
+ # But it can be overridden by setting this parameter
129
+ IndentationWidth: ~
130
+
131
+ # Align the elements of a hash literal if they span more than one line.
132
+ Layout/AlignHash:
133
+ # Alignment of entries using hash rocket as separator. Valid values are:
134
+ #
135
+ # key - left alignment of keys
136
+ # 'a' => 2
137
+ # 'bb' => 3
138
+ # separator - alignment of hash rockets, keys are right aligned
139
+ # 'a' => 2
140
+ # 'bb' => 3
141
+ # table - left alignment of keys, hash rockets, and values
142
+ # 'a' => 2
143
+ # 'bb' => 3
144
+ EnforcedHashRocketStyle: key
145
+ SupportedHashRocketStyles:
146
+ - key
147
+ - separator
148
+ - table
149
+ # Alignment of entries using colon as separator. Valid values are:
150
+ #
151
+ # key - left alignment of keys
152
+ # a: 0
153
+ # bb: 1
154
+ # separator - alignment of colons, keys are right aligned
155
+ # a: 0
156
+ # bb: 1
157
+ # table - left alignment of keys and values
158
+ # a: 0
159
+ # bb: 1
160
+ EnforcedColonStyle: key
161
+ SupportedColonStyles:
162
+ - key
163
+ - separator
164
+ - table
165
+ # Select whether hashes that are the last argument in a method call should be
166
+ # inspected? Valid values are:
167
+ #
168
+ # always_inspect - Inspect both implicit and explicit hashes.
169
+ # Registers an offense for:
170
+ # function(a: 1,
171
+ # b: 2)
172
+ # Registers an offense for:
173
+ # function({a: 1,
174
+ # b: 2})
175
+ # always_ignore - Ignore both implicit and explicit hashes.
176
+ # Accepts:
177
+ # function(a: 1,
178
+ # b: 2)
179
+ # Accepts:
180
+ # function({a: 1,
181
+ # b: 2})
182
+ # ignore_implicit - Ignore only implicit hashes.
183
+ # Accepts:
184
+ # function(a: 1,
185
+ # b: 2)
186
+ # Registers an offense for:
187
+ # function({a: 1,
188
+ # b: 2})
189
+ # ignore_explicit - Ignore only explicit hashes.
190
+ # Accepts:
191
+ # function({a: 1,
192
+ # b: 2})
193
+ # Registers an offense for:
194
+ # function(a: 1,
195
+ # b: 2)
196
+ EnforcedLastArgumentHashStyle: always_inspect
197
+ SupportedLastArgumentHashStyles:
198
+ - always_inspect
199
+ - always_ignore
200
+ - ignore_implicit
201
+ - ignore_explicit
202
+
203
+ Layout/AlignParameters:
204
+ # Alignment of parameters in multi-line method calls.
205
+ #
206
+ # The `with_first_parameter` style aligns the following lines along the same
207
+ # column as the first parameter.
208
+ #
209
+ # method_call(a,
210
+ # b)
211
+ #
212
+ # The `with_fixed_indentation` style aligns the following lines with one
213
+ # level of indentation relative to the start of the line with the method call.
214
+ #
215
+ # method_call(a,
216
+ # b)
217
+ EnforcedStyle: with_first_parameter
218
+ SupportedStyles:
219
+ - with_first_parameter
220
+ - with_fixed_indentation
221
+ # By default, the indentation width from Layout/IndentationWidth is used
222
+ # But it can be overridden by setting this parameter
223
+ IndentationWidth: ~
224
+
225
+ # Indentation of `when`.
226
+ Layout/CaseIndentation:
227
+ EnforcedStyle: case
228
+ SupportedStyles:
229
+ - case
230
+ - end
231
+ IndentOneStep: false
232
+ # By default, the indentation width from `Layout/IndentationWidth` is used.
233
+ # But it can be overridden by setting this parameter.
234
+ # This only matters if `IndentOneStep` is `true`
235
+ IndentationWidth: ~
236
+
237
+ # Multi-line method chaining should be done with leading dots.
238
+ Layout/DotPosition:
239
+ EnforcedStyle: leading
240
+ SupportedStyles:
241
+ - leading
242
+ - trailing
243
+
244
+ # Use empty lines between defs.
245
+ Layout/EmptyLineBetweenDefs:
246
+ # If `true`, this parameter means that single line method definitions don't
247
+ # need an empty line between them.
248
+ AllowAdjacentOneLineDefs: false
249
+ # Can be array to specify minimum and maximum number of empty lines, e.g. [1, 2]
250
+ NumberOfEmptyLines: 1
251
+
252
+ Layout/EmptyLinesAroundBlockBody:
253
+ EnforcedStyle: no_empty_lines
254
+ SupportedStyles:
255
+ - empty_lines
256
+ - no_empty_lines
257
+
258
+ Layout/EmptyLinesAroundClassBody:
259
+ EnforcedStyle: no_empty_lines
260
+ SupportedStyles:
261
+ - empty_lines
262
+ - empty_lines_except_namespace
263
+ - empty_lines_special
264
+ - no_empty_lines
265
+
266
+ Layout/EmptyLinesAroundModuleBody:
267
+ EnforcedStyle: no_empty_lines
268
+ SupportedStyles:
269
+ - empty_lines
270
+ - empty_lines_except_namespace
271
+ - empty_lines_special
272
+ - no_empty_lines
273
+
274
+ Layout/EndOfLine:
275
+ # The `native` style means that CR+LF (Carriage Return + Line Feed) is
276
+ # enforced on Windows, and LF is enforced on other platforms. The other styles
277
+ # mean LF and CR+LF, respectively.
278
+ EnforcedStyle: native
279
+ SupportedStyles:
280
+ - native
281
+ - lf
282
+ - crlf
283
+
284
+ Layout/ExtraSpacing:
285
+ # When true, allows most uses of extra spacing if the intent is to align
286
+ # things with the previous or next line, not counting empty lines or comment
287
+ # lines.
288
+ AllowForAlignment: true
289
+ # When true, forces the alignment of `=` in assignments on consecutive lines.
290
+ ForceEqualSignAlignment: false
291
+
292
+ Layout/FirstParameterIndentation:
293
+ EnforcedStyle: special_for_inner_method_call_in_parentheses
294
+ SupportedStyles:
295
+ # The first parameter should always be indented one step more than the
296
+ # preceding line.
297
+ - consistent
298
+ # The first parameter should normally be indented one step more than the
299
+ # preceding line, but if it's a parameter for a method call that is itself
300
+ # a parameter in a method call, then the inner parameter should be indented
301
+ # relative to the inner method.
302
+ - special_for_inner_method_call
303
+ # Same as `special_for_inner_method_call` except that the special rule only
304
+ # applies if the outer method call encloses its arguments in parentheses.
305
+ - special_for_inner_method_call_in_parentheses
306
+ # By default, the indentation width from `Layout/IndentationWidth` is used
307
+ # But it can be overridden by setting this parameter
308
+ IndentationWidth: ~
309
+
310
+ Layout/IndentationConsistency:
311
+ # The difference between `rails` and `normal` is that the `rails` style
312
+ # prescribes that in classes and modules the `protected` and `private`
313
+ # modifier keywords shall be indented the same as public methods and that
314
+ # protected and private members shall be indented one step more than the
315
+ # modifiers. Other than that, both styles mean that entities on the same
316
+ # logical depth shall have the same indentation.
317
+ EnforcedStyle: normal
318
+ SupportedStyles:
319
+ - normal
320
+ - rails
321
+
322
+ Layout/IndentationWidth:
323
+ # Number of spaces for each indentation level.
324
+ Width: 2
325
+ IgnoredPatterns: []
326
+
327
+ # Checks the indentation of the first element in an array literal.
328
+ Layout/IndentArray:
329
+ # The value `special_inside_parentheses` means that array literals with
330
+ # brackets that have their opening bracket on the same line as a surrounding
331
+ # opening round parenthesis, shall have their first element indented relative
332
+ # to the first position inside the parenthesis.
333
+ #
334
+ # The value `consistent` means that the indentation of the first element shall
335
+ # always be relative to the first position of the line where the opening
336
+ # bracket is.
337
+ #
338
+ # The value `align_brackets` means that the indentation of the first element
339
+ # shall always be relative to the position of the opening bracket.
340
+ EnforcedStyle: special_inside_parentheses
341
+ SupportedStyles:
342
+ - special_inside_parentheses
343
+ - consistent
344
+ - align_brackets
345
+ # By default, the indentation width from `Layout/IndentationWidth` is used
346
+ # But it can be overridden by setting this parameter
347
+ IndentationWidth: ~
348
+
349
+ # Checks the indentation of assignment RHS, when on a different line from LHS
350
+ Layout/IndentAssignment:
351
+ # By default, the indentation width from `Layout/IndentationWidth` is used
352
+ # But it can be overridden by setting this parameter
353
+ IndentationWidth: ~
354
+
355
+ # Checks the indentation of the first key in a hash literal.
356
+ Layout/IndentHash:
357
+ # The value `special_inside_parentheses` means that hash literals with braces
358
+ # that have their opening brace on the same line as a surrounding opening
359
+ # round parenthesis, shall have their first key indented relative to the
360
+ # first position inside the parenthesis.
361
+ #
362
+ # The value `consistent` means that the indentation of the first key shall
363
+ # always be relative to the first position of the line where the opening
364
+ # brace is.
365
+ #
366
+ # The value `align_braces` means that the indentation of the first key shall
367
+ # always be relative to the position of the opening brace.
368
+ EnforcedStyle: special_inside_parentheses
369
+ SupportedStyles:
370
+ - special_inside_parentheses
371
+ - consistent
372
+ - align_braces
373
+ # By default, the indentation width from `Layout/IndentationWidth` is used
374
+ # But it can be overridden by setting this parameter
375
+ IndentationWidth: ~
376
+
377
+ Layout/IndentHeredoc:
378
+ EnforcedStyle: auto_detection
379
+ SupportedStyles:
380
+ - auto_detection
381
+ - squiggly
382
+ - active_support
383
+ - powerpack
384
+ - unindent
385
+
386
+ Layout/SpaceInLambdaLiteral:
387
+ EnforcedStyle: require_no_space
388
+ SupportedStyles:
389
+ - require_no_space
390
+ - require_space
391
+
392
+ Layout/MultilineArrayBraceLayout:
393
+ EnforcedStyle: symmetrical
394
+ SupportedStyles:
395
+ # symmetrical: closing brace is positioned in same way as opening brace
396
+ # new_line: closing brace is always on a new line
397
+ # same_line: closing brace is always on the same line as last element
398
+ - symmetrical
399
+ - new_line
400
+ - same_line
401
+
402
+ Layout/MultilineAssignmentLayout:
403
+ # The types of assignments which are subject to this rule.
404
+ SupportedTypes:
405
+ - block
406
+ - case
407
+ - class
408
+ - if
409
+ - kwbegin
410
+ - module
411
+ EnforcedStyle: new_line
412
+ SupportedStyles:
413
+ # Ensures that the assignment operator and the rhs are on the same line for
414
+ # the set of supported types.
415
+ - same_line
416
+ # Ensures that the assignment operator and the rhs are on separate lines
417
+ # for the set of supported types.
418
+ - new_line
419
+
420
+ Layout/MultilineHashBraceLayout:
421
+ EnforcedStyle: symmetrical
422
+ SupportedStyles:
423
+ # symmetrical: closing brace is positioned in same way as opening brace
424
+ # new_line: closing brace is always on a new line
425
+ # same_line: closing brace is always on same line as last element
426
+ - symmetrical
427
+ - new_line
428
+ - same_line
429
+
430
+ Layout/MultilineMethodCallBraceLayout:
431
+ EnforcedStyle: symmetrical
432
+ SupportedStyles:
433
+ # symmetrical: closing brace is positioned in same way as opening brace
434
+ # new_line: closing brace is always on a new line
435
+ # same_line: closing brace is always on the same line as last argument
436
+ - symmetrical
437
+ - new_line
438
+ - same_line
439
+
440
+ Layout/MultilineMethodCallIndentation:
441
+ EnforcedStyle: aligned
442
+ SupportedStyles:
443
+ - aligned
444
+ - indented
445
+ - indented_relative_to_receiver
446
+ # By default, the indentation width from Layout/IndentationWidth is used
447
+ # But it can be overridden by setting this parameter
448
+ IndentationWidth: ~
449
+
450
+ Layout/MultilineMethodDefinitionBraceLayout:
451
+ EnforcedStyle: symmetrical
452
+ SupportedStyles:
453
+ # symmetrical: closing brace is positioned in same way as opening brace
454
+ # new_line: closing brace is always on a new line
455
+ # same_line: closing brace is always on the same line as last parameter
456
+ - symmetrical
457
+ - new_line
458
+ - same_line
459
+
460
+ Layout/MultilineOperationIndentation:
461
+ EnforcedStyle: aligned
462
+ SupportedStyles:
463
+ - aligned
464
+ - indented
465
+ # By default, the indentation width from `Layout/IndentationWidth` is used
466
+ # But it can be overridden by setting this parameter
467
+ IndentationWidth: ~
468
+
469
+ Layout/SpaceAroundBlockParameters:
470
+ EnforcedStyleInsidePipes: no_space
471
+ SupportedStylesInsidePipes:
472
+ - space
473
+ - no_space
474
+
475
+ Layout/SpaceAroundEqualsInParameterDefault:
476
+ EnforcedStyle: space
477
+ SupportedStyles:
478
+ - space
479
+ - no_space
480
+
481
+ Layout/SpaceAroundOperators:
482
+ # When `true`, allows most uses of extra spacing if the intent is to align
483
+ # with an operator on the previous or next line, not counting empty lines
484
+ # or comment lines.
485
+ AllowForAlignment: true
486
+
487
+ Layout/SpaceBeforeBlockBraces:
488
+ EnforcedStyle: space
489
+ SupportedStyles:
490
+ - space
491
+ - no_space
492
+
493
+ Layout/SpaceBeforeFirstArg:
494
+ # When `true`, allows most uses of extra spacing if the intent is to align
495
+ # things with the previous or next line, not counting empty lines or comment
496
+ # lines.
497
+ AllowForAlignment: true
498
+
499
+ Layout/SpaceInsideBlockBraces:
500
+ EnforcedStyle: space
501
+ SupportedStyles:
502
+ - space
503
+ - no_space
504
+ EnforcedStyleForEmptyBraces: no_space
505
+ SupportedStylesForEmptyBraces:
506
+ - space
507
+ - no_space
508
+ # Space between `{` and `|`. Overrides `EnforcedStyle` if there is a conflict.
509
+ SpaceBeforeBlockParameters: true
510
+
511
+ Layout/SpaceInsideHashLiteralBraces:
512
+ EnforcedStyle: space
513
+ SupportedStyles:
514
+ - space
515
+ - no_space
516
+ # 'compact' normally requires a space inside hash braces, with the exception
517
+ # that successive left braces or right braces are collapsed together
518
+ - compact
519
+ EnforcedStyleForEmptyBraces: no_space
520
+ SupportedStylesForEmptyBraces:
521
+ - space
522
+ - no_space
523
+
524
+ Layout/SpaceInsideStringInterpolation:
525
+ EnforcedStyle: no_space
526
+ SupportedStyles:
527
+ - space
528
+ - no_space
529
+
530
+ Layout/TrailingBlankLines:
531
+ EnforcedStyle: final_newline
532
+ SupportedStyles:
533
+ - final_newline
534
+ - final_blank_line
535
+
536
+ #################### Style ###########################
537
+
538
+ Style/Alias:
539
+ EnforcedStyle: prefer_alias
540
+ SupportedStyles:
541
+ - prefer_alias
542
+ - prefer_alias_method
543
+
544
+ Style/AndOr:
545
+ # Whether `and` and `or` are banned only in conditionals (conditionals)
546
+ # or completely (always).
547
+ EnforcedStyle: always
548
+ SupportedStyles:
549
+ - always
550
+ - conditionals
551
+
552
+ # Checks if usage of `%()` or `%Q()` matches configuration.
553
+ Style/BarePercentLiterals:
554
+ EnforcedStyle: bare_percent
555
+ SupportedStyles:
556
+ - percent_q
557
+ - bare_percent
558
+
559
+ Style/BlockDelimiters:
560
+ EnforcedStyle: line_count_based
561
+ SupportedStyles:
562
+ # The `line_count_based` style enforces braces around single line blocks and
563
+ # do..end around multi-line blocks.
564
+ - line_count_based
565
+ # The `semantic` style enforces braces around functional blocks, where the
566
+ # primary purpose of the block is to return a value and do..end for
567
+ # procedural blocks, where the primary purpose of the block is its
568
+ # side-effects.
569
+ #
570
+ # This looks at the usage of a block's method to determine its type (e.g. is
571
+ # the result of a `map` assigned to a variable or passed to another
572
+ # method) but exceptions are permitted in the `ProceduralMethods`,
573
+ # `FunctionalMethods` and `IgnoredMethods` sections below.
574
+ - semantic
575
+ # The `braces_for_chaining` style enforces braces around single line blocks
576
+ # and do..end around multi-line blocks, except for multi-line blocks whose
577
+ # return value is being chained with another method (in which case braces
578
+ # are enforced).
579
+ - braces_for_chaining
580
+ ProceduralMethods:
581
+ # Methods that are known to be procedural in nature but look functional from
582
+ # their usage, e.g.
583
+ #
584
+ # time = Benchmark.realtime do
585
+ # foo.bar
586
+ # end
587
+ #
588
+ # Here, the return value of the block is discarded but the return value of
589
+ # `Benchmark.realtime` is used.
590
+ - benchmark
591
+ - bm
592
+ - bmbm
593
+ - create
594
+ - each_with_object
595
+ - measure
596
+ - new
597
+ - realtime
598
+ - tap
599
+ - with_object
600
+ FunctionalMethods:
601
+ # Methods that are known to be functional in nature but look procedural from
602
+ # their usage, e.g.
603
+ #
604
+ # let(:foo) { Foo.new }
605
+ #
606
+ # Here, the return value of `Foo.new` is used to define a `foo` helper but
607
+ # doesn't appear to be used from the return value of `let`.
608
+ - let
609
+ - let!
610
+ - subject
611
+ - watch
612
+ IgnoredMethods:
613
+ # Methods that can be either procedural or functional and cannot be
614
+ # categorised from their usage alone, e.g.
615
+ #
616
+ # foo = lambda do |x|
617
+ # puts "Hello, #{x}"
618
+ # end
619
+ #
620
+ # foo = lambda do |x|
621
+ # x * 100
622
+ # end
623
+ #
624
+ # Here, it is impossible to tell from the return value of `lambda` whether
625
+ # the inner block's return value is significant.
626
+ - lambda
627
+ - proc
628
+ - it
629
+
630
+ Style/BracesAroundHashParameters:
631
+ EnforcedStyle: no_braces
632
+ SupportedStyles:
633
+ # The `braces` style enforces braces around all method parameters that are
634
+ # hashes.
635
+ - braces
636
+ # The `no_braces` style checks that the last parameter doesn't have braces
637
+ # around it.
638
+ - no_braces
639
+ # The `context_dependent` style checks that the last parameter doesn't have
640
+ # braces around it, but requires braces if the second to last parameter is
641
+ # also a hash literal.
642
+ - context_dependent
643
+
644
+ Style/ClassAndModuleChildren:
645
+ # Checks the style of children definitions at classes and modules.
646
+ #
647
+ # Basically there are two different styles:
648
+ #
649
+ # `nested` - have each child on a separate line
650
+ # class Foo
651
+ # class Bar
652
+ # end
653
+ # end
654
+ #
655
+ # `compact` - combine definitions as much as possible
656
+ # class Foo::Bar
657
+ # end
658
+ #
659
+ # The compact style is only forced, for classes or modules with one child.
660
+ EnforcedStyle: nested
661
+ SupportedStyles:
662
+ - nested
663
+ - compact
664
+
665
+ Style/ClassCheck:
666
+ EnforcedStyle: is_a?
667
+ SupportedStyles:
668
+ - is_a?
669
+ - kind_of?
670
+
671
+ # Align with the style guide.
672
+ Style/CollectionMethods:
673
+ # Mapping from undesired method to desired_method
674
+ # e.g. to use `detect` over `find`:
675
+ #
676
+ # CollectionMethods:
677
+ # PreferredMethods:
678
+ # find: detect
679
+ PreferredMethods:
680
+ collect: 'map'
681
+ collect!: 'map!'
682
+ inject: 'reduce'
683
+ detect: 'find'
684
+ find_all: 'select'
685
+
686
+ # Use '`' or '%x' around command literals.
687
+ Style/CommandLiteral:
688
+ EnforcedStyle: backticks
689
+ # backticks: Always use backticks.
690
+ # percent_x: Always use `%x`.
691
+ # mixed: Use backticks on single-line commands, and `%x` on multi-line commands.
692
+ SupportedStyles:
693
+ - backticks
694
+ - percent_x
695
+ - mixed
696
+ # If `false`, the cop will always recommend using `%x` if one or more backticks
697
+ # are found in the command string.
698
+ AllowInnerBackticks: false
699
+
700
+ # Checks formatting of special comments
701
+ Style/CommentAnnotation:
702
+ Keywords:
703
+ - TODO
704
+ - FIXME
705
+ - OPTIMIZE
706
+ - HACK
707
+ - REVIEW
708
+
709
+ Style/ConditionalAssignment:
710
+ EnforcedStyle: assign_to_condition
711
+ SupportedStyles:
712
+ - assign_to_condition
713
+ - assign_inside_condition
714
+ # When configured to `assign_to_condition`, `SingleLineConditionsOnly`
715
+ # will only register an offense when all branches of a condition are
716
+ # a single line.
717
+ # When configured to `assign_inside_condition`, `SingleLineConditionsOnly`
718
+ # will only register an offense for assignment to a condition that has
719
+ # at least one multiline branch.
720
+ SingleLineConditionsOnly: true
721
+ IncludeTernaryExpressions: true
722
+
723
+ # Checks that you have put a copyright in a comment before any code.
724
+ #
725
+ # You can override the default Notice in your .rubocop.yml file.
726
+ #
727
+ # In order to use autocorrect, you must supply a value for the
728
+ # `AutocorrectNotice` key that matches the regexp Notice. A blank
729
+ # `AutocorrectNotice` will cause an error during autocorrect.
730
+ #
731
+ # Autocorrect will add a copyright notice in a comment at the top
732
+ # of the file immediately after any shebang or encoding comments.
733
+ #
734
+ # Example rubocop.yml:
735
+ #
736
+ # Style/Copyright:
737
+ # Enabled: true
738
+ # Notice: 'Copyright (\(c\) )?2015 Yahoo! Inc'
739
+ # AutocorrectNotice: '# Copyright (c) 2015 Yahoo! Inc.'
740
+ #
741
+ Style/Copyright:
742
+ Notice: '^Copyright (\(c\) )?2[0-9]{3} .+'
743
+ AutocorrectNotice: ''
744
+
745
+ Style/DocumentationMethod:
746
+ RequireForNonPublicMethods: false
747
+
748
+ # Warn on empty else statements
749
+ # empty - warn only on empty `else`
750
+ # nil - warn on `else` with nil in it
751
+ # both - warn on empty `else` and `else` with `nil` in it
752
+ Style/EmptyElse:
753
+ EnforcedStyle: both
754
+ SupportedStyles:
755
+ - empty
756
+ - nil
757
+ - both
758
+
759
+ Style/EmptyMethod:
760
+ EnforcedStyle: compact
761
+ SupportedStyles:
762
+ - compact
763
+ - expanded
764
+
765
+ # Checks whether the source file has a utf-8 encoding comment or not
766
+ # AutoCorrectEncodingComment must match the regex
767
+ # /#.*coding\s?[:=]\s?(?:UTF|utf)-8/
768
+ Style/Encoding:
769
+ EnforcedStyle: never
770
+ SupportedStyles:
771
+ - when_needed
772
+ - always
773
+ - never
774
+ AutoCorrectEncodingComment: '# encoding: utf-8'
775
+
776
+ Style/FileName:
777
+ # File names listed in `AllCops:Include` are excluded by default. Add extra
778
+ # excludes here.
779
+ Exclude: []
780
+ # When `true`, requires that each source file should define a class or module
781
+ # with a name which matches the file name (converted to ... case).
782
+ # It further expects it to be nested inside modules which match the names
783
+ # of subdirectories in its path.
784
+ ExpectMatchingDefinition: false
785
+ # If non-`nil`, expect all source file names to match the following regex.
786
+ # Only the file name itself is matched, not the entire file path.
787
+ # Use anchors as necessary if you want to match the entire name rather than
788
+ # just a part of it.
789
+ Regex: ~
790
+ # With `IgnoreExecutableScripts` set to `true`, this cop does not
791
+ # report offending filenames for executable scripts (i.e. source
792
+ # files with a shebang in the first line).
793
+ IgnoreExecutableScripts: true
794
+ AllowedAcronyms:
795
+ - CLI
796
+ - DSL
797
+ - ACL
798
+ - API
799
+ - ASCII
800
+ - CPU
801
+ - CSS
802
+ - DNS
803
+ - EOF
804
+ - GUID
805
+ - HTML
806
+ - HTTP
807
+ - HTTPS
808
+ - ID
809
+ - IP
810
+ - JSON
811
+ - LHS
812
+ - QPS
813
+ - RAM
814
+ - RHS
815
+ - RPC
816
+ - SLA
817
+ - SMTP
818
+ - SQL
819
+ - SSH
820
+ - TCP
821
+ - TLS
822
+ - TTL
823
+ - UDP
824
+ - UI
825
+ - UID
826
+ - UUID
827
+ - URI
828
+ - URL
829
+ - UTF8
830
+ - VM
831
+ - XML
832
+ - XMPP
833
+ - XSRF
834
+ - XSS
835
+
836
+ # Checks use of for or each in multiline loops.
837
+ Style/For:
838
+ EnforcedStyle: each
839
+ SupportedStyles:
840
+ - for
841
+ - each
842
+
843
+ # Enforce the method used for string formatting.
844
+ Style/FormatString:
845
+ EnforcedStyle: format
846
+ SupportedStyles:
847
+ - format
848
+ - sprintf
849
+ - percent
850
+
851
+ # Enforce using either `%<token>s` or `%{token}`
852
+ Style/FormatStringToken:
853
+ EnforcedStyle: annotated
854
+ SupportedStyles:
855
+ # Prefer tokens which contain a sprintf like type annotation like
856
+ # `%<name>s`, `%<age>d`, `%<score>f`
857
+ - annotated
858
+ # Prefer simple looking "template" style tokens like `%{name}`, `%{age}`
859
+ - template
860
+
861
+ Style/FrozenStringLiteralComment:
862
+ EnforcedStyle: never
863
+ SupportedStyles:
864
+ # `when_needed` will add the frozen string literal comment to files
865
+ # only when the `TargetRubyVersion` is set to 2.3+.
866
+ - when_needed
867
+ # `always` will always add the frozen string literal comment to a file
868
+ # regardless of the Ruby version or if `freeze` or `<<` are called on a
869
+ # string literal. If you run code against multiple versions of Ruby, it is
870
+ # possible that this will create errors in Ruby 2.3.0+.
871
+ - always
872
+ # `never` will enforce that the frozen string literal comment does not
873
+ # exist in a file.
874
+ - never
875
+
876
+ # Built-in global variables are allowed by default.
877
+ Style/GlobalVars:
878
+ AllowedVariables: []
879
+
880
+ # `MinBodyLength` defines the number of lines of the a body of an `if` or `unless`
881
+ # needs to have to trigger this cop
882
+ Style/GuardClause:
883
+ MinBodyLength: 1
884
+
885
+ Style/HashSyntax:
886
+ EnforcedStyle: ruby19
887
+ SupportedStyles:
888
+ # checks for 1.9 syntax (e.g. {a: 1}) for all symbol keys
889
+ - ruby19
890
+ # checks for hash rocket syntax for all hashes
891
+ - hash_rockets
892
+ # forbids mixed key syntaxes (e.g. {a: 1, :b => 2})
893
+ - no_mixed_keys
894
+ # enforces both ruby19 and no_mixed_keys styles
895
+ - ruby19_no_mixed_keys
896
+ # Force hashes that have a symbol value to use hash rockets
897
+ UseHashRocketsWithSymbolValues: false
898
+ # Do not suggest { a?: 1 } over { :a? => 1 } in ruby19 style
899
+ PreferHashRocketsForNonAlnumEndingSymbols: false
900
+
901
+ Style/IfUnlessModifier:
902
+ MaxLineLength: 80
903
+
904
+ Style/InverseMethods:
905
+ Enabled: true
906
+ # `InverseMethods` are methods that can be inverted by a not (`not` or `!`)
907
+ # The relationship of inverse methods only needs to be defined in one direction.
908
+ # Keys and values both need to be defined as symbols.
909
+ InverseMethods:
910
+ :any?: :none?
911
+ :even?: :odd?
912
+ :==: :!=
913
+ :=~: :!~
914
+ :<: :>=
915
+ :>: :<=
916
+ # `ActiveSupport` defines some common inverse methods. They are listed below,
917
+ # and not enabled by default.
918
+ #:present?: :blank?,
919
+ #:include?: :exclude?
920
+ # `InverseBlocks` are methods that are inverted by inverting the return
921
+ # of the block that is passed to the method
922
+ InverseBlocks:
923
+ :select: :reject
924
+ :select!: :reject!
925
+
926
+ Style/Lambda:
927
+ EnforcedStyle: line_count_dependent
928
+ SupportedStyles:
929
+ - line_count_dependent
930
+ - lambda
931
+ - literal
932
+
933
+ Style/LambdaCall:
934
+ EnforcedStyle: call
935
+ SupportedStyles:
936
+ - call
937
+ - braces
938
+
939
+ Style/MethodCallWithArgsParentheses:
940
+ IgnoreMacros: true
941
+ IgnoredMethods: []
942
+
943
+ Style/MethodDefParentheses:
944
+ EnforcedStyle: require_parentheses
945
+ SupportedStyles:
946
+ - require_parentheses
947
+ - require_no_parentheses
948
+ - require_no_parentheses_except_multiline
949
+
950
+ Style/MethodName:
951
+ EnforcedStyle: snake_case
952
+ SupportedStyles:
953
+ - snake_case
954
+ - camelCase
955
+
956
+ # Checks the grouping of mixins (`include`, `extend`, `prepend`) in `class` and
957
+ # `module` bodies.
958
+ Style/MixinGrouping:
959
+ EnforcedStyle: separated
960
+ SupportedStyles:
961
+ # separated: each mixed in module goes in a separate statement.
962
+ # grouped: mixed in modules are grouped into a single statement.
963
+ - separated
964
+ - grouped
965
+
966
+ Style/ModuleFunction:
967
+ EnforcedStyle: module_function
968
+ SupportedStyles:
969
+ - module_function
970
+ - extend_self
971
+
972
+ Style/MultilineMemoization:
973
+ EnforcedStyle: keyword
974
+ SupportedStyles:
975
+ - keyword
976
+ - braces
977
+
978
+ Style/NegatedIf:
979
+ EnforcedStyle: both
980
+ SupportedStyles:
981
+ # both: prefix and postfix negated `if` should both use `unless`
982
+ # prefix: only use `unless` for negated `if` statements positioned before the body of the statement
983
+ # postfix: only use `unless` for negated `if` statements positioned after the body of the statement
984
+ - both
985
+ - prefix
986
+ - postfix
987
+
988
+ Style/Next:
989
+ # With `always` all conditions at the end of an iteration needs to be
990
+ # replaced by next - with `skip_modifier_ifs` the modifier if like this one
991
+ # are ignored: [1, 2].each { |a| return 'yes' if a == 1 }
992
+ EnforcedStyle: skip_modifier_ifs
993
+ # `MinBodyLength` defines the number of lines of the a body of an `if` or `unless`
994
+ # needs to have to trigger this cop
995
+ MinBodyLength: 3
996
+ SupportedStyles:
997
+ - skip_modifier_ifs
998
+ - always
999
+
1000
+ Style/NonNilCheck:
1001
+ # With `IncludeSemanticChanges` set to `true`, this cop reports offenses for
1002
+ # `!x.nil?` and autocorrects that and `x != nil` to solely `x`, which is
1003
+ # **usually** OK, but might change behavior.
1004
+ #
1005
+ # With `IncludeSemanticChanges` set to `false`, this cop does not report
1006
+ # offenses for `!x.nil?` and does no changes that might change behavior.
1007
+ IncludeSemanticChanges: false
1008
+
1009
+ Style/NumericLiterals:
1010
+ MinDigits: 5
1011
+ Strict: false
1012
+
1013
+ Style/NumericLiteralPrefix:
1014
+ EnforcedOctalStyle: zero_with_o
1015
+ SupportedOctalStyles:
1016
+ - zero_with_o
1017
+ - zero_only
1018
+
1019
+ Style/NumericPredicate:
1020
+ EnforcedStyle: predicate
1021
+ SupportedStyles:
1022
+ - predicate
1023
+ - comparison
1024
+ # Exclude RSpec specs because assertions like `expect(1).to be > 0` cause
1025
+ # false positives.
1026
+ Exclude:
1027
+ - 'spec/**/*'
1028
+
1029
+ Style/OptionHash:
1030
+ # A list of parameter names that will be flagged by this cop.
1031
+ SuspiciousParamNames:
1032
+ - options
1033
+ - opts
1034
+ - args
1035
+ - params
1036
+ - parameters
1037
+
1038
+ # Allow safe assignment in conditions.
1039
+ Style/ParenthesesAroundCondition:
1040
+ AllowSafeAssignment: true
1041
+
1042
+ Style/PercentLiteralDelimiters:
1043
+ # Specify the default preferred delimiter for all types with the 'default' key
1044
+ # Override individual delimiters (even with default specified) by specifying
1045
+ # an individual key
1046
+ PreferredDelimiters:
1047
+ default: ()
1048
+ '%i': '[]'
1049
+ '%I': '[]'
1050
+ '%r': '{}'
1051
+ '%w': '[]'
1052
+ '%W': '[]'
1053
+
1054
+ Style/PercentQLiterals:
1055
+ EnforcedStyle: lower_case_q
1056
+ SupportedStyles:
1057
+ - lower_case_q # Use `%q` when possible, `%Q` when necessary
1058
+ - upper_case_q # Always use `%Q`
1059
+
1060
+ Style/PredicateName:
1061
+ # Predicate name prefixes.
1062
+ NamePrefix:
1063
+ - is_
1064
+ - has_
1065
+ - have_
1066
+ # Predicate name prefixes that should be removed.
1067
+ NamePrefixBlacklist:
1068
+ - is_
1069
+ - has_
1070
+ - have_
1071
+ # Predicate names which, despite having a blacklisted prefix, or no `?`,
1072
+ # should still be accepted
1073
+ NameWhitelist:
1074
+ - is_a?
1075
+ # Exclude Rspec specs because there is a strong convention to write spec
1076
+ # helpers in the form of `have_something` or `be_something`.
1077
+ Exclude:
1078
+ - 'spec/**/*'
1079
+
1080
+ Style/PreferredHashMethods:
1081
+ EnforcedStyle: short
1082
+ SupportedStyles:
1083
+ - short
1084
+ - verbose
1085
+
1086
+ Style/RaiseArgs:
1087
+ EnforcedStyle: exploded
1088
+ SupportedStyles:
1089
+ - compact # raise Exception.new(msg)
1090
+ - exploded # raise Exception, msg
1091
+
1092
+ Style/RedundantReturn:
1093
+ # When `true` allows code like `return x, y`.
1094
+ AllowMultipleReturnValues: false
1095
+
1096
+ # Use `/` or `%r` around regular expressions.
1097
+ Style/RegexpLiteral:
1098
+ EnforcedStyle: slashes
1099
+ # slashes: Always use slashes.
1100
+ # percent_r: Always use `%r`.
1101
+ # mixed: Use slashes on single-line regexes, and `%r` on multi-line regexes.
1102
+ SupportedStyles:
1103
+ - slashes
1104
+ - percent_r
1105
+ - mixed
1106
+ # If `false`, the cop will always recommend using `%r` if one or more slashes
1107
+ # are found in the regexp string.
1108
+ AllowInnerSlashes: false
1109
+
1110
+ Style/SafeNavigation:
1111
+ # Safe navigation may cause a statement to start returning `nil` in addition
1112
+ # to whatever it used to return.
1113
+ ConvertCodeThatCanStartToReturnNil: false
1114
+
1115
+ Style/Semicolon:
1116
+ # Allow `;` to separate several expressions on the same line.
1117
+ AllowAsExpressionSeparator: false
1118
+
1119
+ Style/SignalException:
1120
+ EnforcedStyle: only_raise
1121
+ SupportedStyles:
1122
+ - only_raise
1123
+ - only_fail
1124
+ - semantic
1125
+
1126
+ Style/SingleLineBlockParams:
1127
+ Methods:
1128
+ - reduce:
1129
+ - acc
1130
+ - elem
1131
+ - inject:
1132
+ - acc
1133
+ - elem
1134
+
1135
+ Style/SingleLineMethods:
1136
+ AllowIfMethodIsEmpty: true
1137
+
1138
+ Style/SpecialGlobalVars:
1139
+ EnforcedStyle: use_english_names
1140
+ SupportedStyles:
1141
+ - use_perl_names
1142
+ - use_english_names
1143
+
1144
+ Style/StabbyLambdaParentheses:
1145
+ EnforcedStyle: require_parentheses
1146
+ SupportedStyles:
1147
+ - require_parentheses
1148
+ - require_no_parentheses
1149
+
1150
+ Style/StringLiterals:
1151
+ EnforcedStyle: double_quotes
1152
+ SupportedStyles:
1153
+ - single_quotes
1154
+ - double_quotes
1155
+ # If `true`, strings which span multiple lines using `\` for continuation must
1156
+ # use the same type of quotes on each line.
1157
+ ConsistentQuotesInMultiline: false
1158
+
1159
+ Style/StringLiteralsInInterpolation:
1160
+ EnforcedStyle: single_quotes
1161
+ SupportedStyles:
1162
+ - single_quotes
1163
+ - double_quotes
1164
+
1165
+ Style/StringMethods:
1166
+ # Mapping from undesired method to desired_method
1167
+ # e.g. to use `to_sym` over `intern`:
1168
+ #
1169
+ # StringMethods:
1170
+ # PreferredMethods:
1171
+ # intern: to_sym
1172
+ PreferredMethods:
1173
+ intern: to_sym
1174
+
1175
+ Style/SymbolArray:
1176
+ EnforcedStyle: percent
1177
+ MinSize: 0
1178
+ SupportedStyles:
1179
+ - percent
1180
+ - brackets
1181
+
1182
+ Style/SymbolProc:
1183
+ # A list of method names to be ignored by the check.
1184
+ # The names should be fairly unique, otherwise you'll end up ignoring lots of code.
1185
+ IgnoredMethods:
1186
+ - respond_to
1187
+ - define_method
1188
+
1189
+ Style/TernaryParentheses:
1190
+ EnforcedStyle: require_no_parentheses
1191
+ SupportedStyles:
1192
+ - require_parentheses
1193
+ - require_no_parentheses
1194
+ - require_parentheses_when_complex
1195
+ AllowSafeAssignment: true
1196
+
1197
+ Style/TrailingCommaInArguments:
1198
+ # If `comma`, the cop requires a comma after the last argument, but only for
1199
+ # parenthesized method calls where each argument is on its own line.
1200
+ # If `consistent_comma`, the cop requires a comma after the last argument,
1201
+ # for all parenthesized method calls with arguments.
1202
+ EnforcedStyleForMultiline: no_comma
1203
+ SupportedStylesForMultiline:
1204
+ - comma
1205
+ - consistent_comma
1206
+ - no_comma
1207
+
1208
+ Style/TrailingCommaInLiteral:
1209
+ # If `comma`, the cop requires a comma after the last item in an array or
1210
+ # hash, but only when each item is on its own line.
1211
+ # If `consistent_comma`, the cop requires a comma after the last item of all
1212
+ # non-empty array and hash literals.
1213
+ EnforcedStyleForMultiline: no_comma
1214
+ SupportedStylesForMultiline:
1215
+ - comma
1216
+ - consistent_comma
1217
+ - no_comma
1218
+
1219
+ # `TrivialAccessors` requires exact name matches and doesn't allow
1220
+ # predicated methods by default.
1221
+ Style/TrivialAccessors:
1222
+ # When set to `false` the cop will suggest the use of accessor methods
1223
+ # in situations like:
1224
+ #
1225
+ # def name
1226
+ # @other_name
1227
+ # end
1228
+ #
1229
+ # This way you can uncover "hidden" attributes in your code.
1230
+ ExactNameMatch: true
1231
+ AllowPredicates: true
1232
+ # Allows trivial writers that don't end in an equal sign. e.g.
1233
+ #
1234
+ # def on_exception(action)
1235
+ # @on_exception=action
1236
+ # end
1237
+ # on_exception :restart
1238
+ #
1239
+ # Commonly used in DSLs
1240
+ AllowDSLWriters: false
1241
+ IgnoreClassMethods: false
1242
+ Whitelist:
1243
+ - to_ary
1244
+ - to_a
1245
+ - to_c
1246
+ - to_enum
1247
+ - to_h
1248
+ - to_hash
1249
+ - to_i
1250
+ - to_int
1251
+ - to_io
1252
+ - to_open
1253
+ - to_path
1254
+ - to_proc
1255
+ - to_r
1256
+ - to_regexp
1257
+ - to_str
1258
+ - to_s
1259
+ - to_sym
1260
+
1261
+ Style/VariableName:
1262
+ EnforcedStyle: snake_case
1263
+ SupportedStyles:
1264
+ - snake_case
1265
+ - camelCase
1266
+
1267
+ Style/VariableNumber:
1268
+ EnforcedStyle: normalcase
1269
+ SupportedStyles:
1270
+ - snake_case
1271
+ - normalcase
1272
+ - non_integer
1273
+
1274
+ Style/WhileUntilModifier:
1275
+ MaxLineLength: 80
1276
+
1277
+ # `WordArray` enforces how array literals of word-like strings should be expressed.
1278
+ Style/WordArray:
1279
+ EnforcedStyle: percent
1280
+ SupportedStyles:
1281
+ # percent style: %w(word1 word2)
1282
+ - percent
1283
+ # bracket style: ['word1', 'word2']
1284
+ - brackets
1285
+ # The `MinSize` option causes the `WordArray` rule to be ignored for arrays
1286
+ # smaller than a certain size. The rule is only applied to arrays
1287
+ # whose element count is greater than or equal to `MinSize`.
1288
+ MinSize: 0
1289
+ # The regular expression `WordRegex` decides what is considered a word.
1290
+ WordRegex: !ruby/regexp '/\A[\p{Word}\n\t]+\z/'
1291
+
1292
+ #################### Metrics ###############################
1293
+
1294
+ Metrics/AbcSize:
1295
+ # The ABC size is a calculated magnitude, so this number can be an Integer or
1296
+ # a Float.
1297
+ Max: 15
1298
+
1299
+ Metrics/BlockLength:
1300
+ CountComments: false # count full line comments?
1301
+ Max: 25
1302
+ ExcludedMethods: []
1303
+
1304
+ Metrics/BlockNesting:
1305
+ CountBlocks: false
1306
+ Max: 3
1307
+
1308
+ Metrics/ClassLength:
1309
+ CountComments: false # count full line comments?
1310
+ Max: 100
1311
+
1312
+ # Avoid complex methods.
1313
+ Metrics/CyclomaticComplexity:
1314
+ Max: 6
1315
+
1316
+ Metrics/LineLength:
1317
+ Max: 80
1318
+ # To make it possible to copy or click on URIs in the code, we allow lines
1319
+ # containing a URI to be longer than Max.
1320
+ AllowHeredoc: true
1321
+ AllowURI: true
1322
+ URISchemes:
1323
+ - http
1324
+ - https
1325
+ # The IgnoreCopDirectives option causes the LineLength rule to ignore cop
1326
+ # directives like '# rubocop: enable ...' when calculating a line's length.
1327
+ IgnoreCopDirectives: false
1328
+ # The IgnoredPatterns option is a list of !ruby/regexp and/or string
1329
+ # elements. Strings will be converted to Regexp objects. A line that matches
1330
+ # any regular expression listed in this option will be ignored by LineLength.
1331
+ IgnoredPatterns: []
1332
+
1333
+ Metrics/MethodLength:
1334
+ CountComments: false # count full line comments?
1335
+ Max: 10
1336
+
1337
+ Metrics/ModuleLength:
1338
+ CountComments: false # count full line comments?
1339
+ Max: 100
1340
+
1341
+ Metrics/ParameterLists:
1342
+ Max: 5
1343
+ CountKeywordArgs: true
1344
+
1345
+ Metrics/PerceivedComplexity:
1346
+ Max: 7
1347
+
1348
+ #################### Lint ##################################
1349
+
1350
+ # Allow safe assignment in conditions.
1351
+ Lint/AssignmentInCondition:
1352
+ AllowSafeAssignment: true
1353
+
1354
+ # checks whether the end keywords are aligned properly for `do` `end` blocks.
1355
+ Lint/BlockAlignment:
1356
+ # The value `start_of_block` means that the `end` should be aligned with line
1357
+ # where the `do` keyword appears.
1358
+ # The value `start_of_line` means it should be aligned with the whole
1359
+ # expression's starting line.
1360
+ # The value `either` means both are allowed.
1361
+ EnforcedStyleAlignWith: either
1362
+ SupportedStylesAlignWith:
1363
+ - either
1364
+ - start_of_block
1365
+ - start_of_line
1366
+
1367
+ Lint/DefEndAlignment:
1368
+ # The value `def` means that `end` should be aligned with the def keyword.
1369
+ # The value `start_of_line` means that `end` should be aligned with method
1370
+ # calls like `private`, `public`, etc, if present in front of the `def`
1371
+ # keyword on the same line.
1372
+ EnforcedStyleAlignWith: start_of_line
1373
+ SupportedStylesAlignWith:
1374
+ - start_of_line
1375
+ - def
1376
+ AutoCorrect: false
1377
+
1378
+ # Align ends correctly.
1379
+ Lint/EndAlignment:
1380
+ # The value `keyword` means that `end` should be aligned with the matching
1381
+ # keyword (`if`, `while`, etc.).
1382
+ # The value `variable` means that in assignments, `end` should be aligned
1383
+ # with the start of the variable on the left hand side of `=`. In all other
1384
+ # situations, `end` should still be aligned with the keyword.
1385
+ # The value `start_of_line` means that `end` should be aligned with the start
1386
+ # of the line which the matching keyword appears on.
1387
+ EnforcedStyleAlignWith: keyword
1388
+ SupportedStylesAlignWith:
1389
+ - keyword
1390
+ - variable
1391
+ - start_of_line
1392
+ AutoCorrect: false
1393
+
1394
+ Lint/InheritException:
1395
+ # The default base class in favour of `Exception`.
1396
+ EnforcedStyle: runtime_error
1397
+ SupportedStyles:
1398
+ - runtime_error
1399
+ - standard_error
1400
+
1401
+ Lint/SafeNavigationChain:
1402
+ Whitelist:
1403
+ - present?
1404
+ - blank?
1405
+ - presence
1406
+ - try
1407
+
1408
+ # Checks for unused block arguments
1409
+ Lint/UnusedBlockArgument:
1410
+ IgnoreEmptyBlocks: true
1411
+ AllowUnusedKeywordArguments: false
1412
+
1413
+ # Checks for unused method arguments.
1414
+ Lint/UnusedMethodArgument:
1415
+ AllowUnusedKeywordArguments: false
1416
+ IgnoreEmptyMethods: true
1417
+
1418
+ #################### Performance ###########################
1419
+
1420
+ Performance/DoubleStartEndWith:
1421
+ # Used to check for `starts_with?` and `ends_with?`.
1422
+ # These methods are defined by `ActiveSupport`.
1423
+ IncludeActiveSupportAliases: false
1424
+
1425
+ Performance/RedundantMerge:
1426
+ # Max number of key-value pairs to consider an offense
1427
+ MaxKeyValuePairs: 2
1428
+
1429
+ #################### Rails #################################
1430
+
1431
+ Rails/ActionFilter:
1432
+ EnforcedStyle: action
1433
+ SupportedStyles:
1434
+ - action
1435
+ - filter
1436
+ Include:
1437
+ - app/controllers/**/*.rb
1438
+
1439
+ Rails/Date:
1440
+ # The value `strict` disallows usage of `Date.today`, `Date.current`,
1441
+ # `Date#to_time` etc.
1442
+ # The value `flexible` allows usage of `Date.current`, `Date.yesterday`, etc
1443
+ # (but not `Date.today`) which are overridden by ActiveSupport to handle current
1444
+ # time zone.
1445
+ EnforcedStyle: flexible
1446
+ SupportedStyles:
1447
+ - strict
1448
+ - flexible
1449
+
1450
+ Rails/DynamicFindBy:
1451
+ Whitelist:
1452
+ - find_by_sql
1453
+
1454
+ Rails/EnumUniqueness:
1455
+ Include:
1456
+ - app/models/**/*.rb
1457
+
1458
+ Rails/Exit:
1459
+ Include:
1460
+ - app/**/*.rb
1461
+ - config/**/*.rb
1462
+ - lib/**/*.rb
1463
+ Exclude:
1464
+ - lib/**/*.rake
1465
+
1466
+ Rails/FindBy:
1467
+ Include:
1468
+ - app/models/**/*.rb
1469
+
1470
+ Rails/FindEach:
1471
+ Include:
1472
+ - app/models/**/*.rb
1473
+
1474
+ Rails/HasAndBelongsToMany:
1475
+ Include:
1476
+ - app/models/**/*.rb
1477
+
1478
+ Rails/NotNullColumn:
1479
+ Include:
1480
+ - db/migrate/*.rb
1481
+
1482
+ Rails/Output:
1483
+ Include:
1484
+ - app/**/*.rb
1485
+ - config/**/*.rb
1486
+ - db/**/*.rb
1487
+ - lib/**/*.rb
1488
+
1489
+ Rails/ReadWriteAttribute:
1490
+ Include:
1491
+ - app/models/**/*.rb
1492
+
1493
+ Rails/RequestReferer:
1494
+ EnforcedStyle: referer
1495
+ SupportedStyles:
1496
+ - referer
1497
+ - referrer
1498
+
1499
+ Rails/ReversibleMigration:
1500
+ Include:
1501
+ - db/migrate/*.rb
1502
+
1503
+ Rails/SafeNavigation:
1504
+ # This will convert usages of `try` to use safe navigation as well as `try!`.
1505
+ # `try` and `try!` work slighly differently. `try!` and safe navigation will
1506
+ # both raise a `NoMethodError` if the receiver of the method call does not
1507
+ # implement the intended method. `try` will not raise an exception for this.
1508
+ ConvertTry: false
1509
+
1510
+ Rails/ScopeArgs:
1511
+ Include:
1512
+ - app/models/**/*.rb
1513
+
1514
+ Rails/TimeZone:
1515
+ # The value `strict` means that `Time` should be used with `zone`.
1516
+ # The value `flexible` allows usage of `in_time_zone` instead of `zone`.
1517
+ EnforcedStyle: flexible
1518
+ SupportedStyles:
1519
+ - strict
1520
+ - flexible
1521
+
1522
+ Rails/UniqBeforePluck:
1523
+ EnforcedStyle: conservative
1524
+ SupportedStyles:
1525
+ - conservative
1526
+ - aggressive
1527
+ AutoCorrect: false
1528
+
1529
+ Rails/SkipsModelValidations:
1530
+ Blacklist:
1531
+ - decrement!
1532
+ - decrement_counter
1533
+ - increment!
1534
+ - increment_counter
1535
+ - toggle!
1536
+ - touch
1537
+ - update_all
1538
+ - update_attribute
1539
+ - update_column
1540
+ - update_columns
1541
+ - update_counters
1542
+
1543
+ Rails/Validation:
1544
+ Include:
1545
+ - app/models/**/*.rb
1546
+
1547
+ Bundler/OrderedGems:
1548
+ TreatCommentsAsGroupSeparators: true