cookstyle 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,1118 @@
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
+ - '**/*.gemspec'
13
+ - '**/*.podspec'
14
+ - '**/*.jbuilder'
15
+ - '**/*.rake'
16
+ - '**/*.opal'
17
+ - '**/config.ru'
18
+ - '**/Gemfile'
19
+ - '**/Rakefile'
20
+ - '**/Capfile'
21
+ - '**/Guardfile'
22
+ - '**/Podfile'
23
+ - '**/Thorfile'
24
+ - '**/Vagrantfile'
25
+ - '**/Berksfile'
26
+ - '**/Cheffile'
27
+ - '**/Vagabondfile'
28
+ Exclude:
29
+ - 'vendor/**/*'
30
+ # Default formatter will be used if no -f/--format option is given.
31
+ DefaultFormatter: progress
32
+ # Cop names are not displayed in offense messages by default. Change behavior
33
+ # by overriding DisplayCopNames, or by giving the -D/--display-cop-names
34
+ # option.
35
+ DisplayCopNames: false
36
+ # Style guide URLs are not displayed in offense messages by default. Change
37
+ # behavior by overriding DisplayStyleGuide, or by giving the
38
+ # -S/--display-style-guide option.
39
+ DisplayStyleGuide: false
40
+ # Extra details are not displayed in offense messages by default. Change
41
+ # behavior by overriding ExtraDetails, or by giving the
42
+ # -E/--extra-details option.
43
+ ExtraDetails: false
44
+ # Additional cops that do not reference a style guide rule may be enabled by
45
+ # default. Change behavior by overriding StyleGuideCopsOnly, or by giving
46
+ # the --only-guide-cops option.
47
+ StyleGuideCopsOnly: false
48
+ # All cops except the ones in disabled.yml are enabled by default. Change
49
+ # this behavior by overriding DisabledByDefault. When DisabledByDefault is
50
+ # true, all cops in the default configuration are disabled, and and only cops
51
+ # in user configuration are enabled. This makes cops opt-in instead of
52
+ # opt-out. Note that when DisabledByDefault is true, cops in user
53
+ # configuration will be enabled even if they don't set the Enabled parameter.
54
+ DisabledByDefault: false
55
+ # Enables the result cache if true. Can be overridden by the --cache command
56
+ # line option.
57
+ UseCache: true
58
+ # Threshold for how many files can be stored in the result cache before some
59
+ # of the files are automatically removed.
60
+ MaxFilesInCache: 20000
61
+ # The cache will be stored in "rubocop_cache" under this directory. The name
62
+ # "/tmp" is special and will be converted to the system temporary directory,
63
+ # which is "/tmp" on Unix-like systems, but could be something else on other
64
+ # systems.
65
+ CacheRootDirectory: /tmp
66
+ # What version of the Ruby interpreter is the inspected code intended to
67
+ # run on? (If there is more than one, set this to the lowest version.)
68
+ TargetRubyVersion: 2.0
69
+
70
+ # Indent private/protected/public as deep as method definitions
71
+ Style/AccessModifierIndentation:
72
+ EnforcedStyle: indent
73
+ SupportedStyles:
74
+ - outdent
75
+ - indent
76
+ # By default, the indentation width from Style/IndentationWidth is used
77
+ # But it can be overridden by setting this parameter
78
+ IndentationWidth: ~
79
+
80
+ Style/Alias:
81
+ EnforcedStyle: prefer_alias
82
+ SupportedStyles:
83
+ - prefer_alias
84
+ - prefer_alias_method
85
+
86
+ # Align the elements of a hash literal if they span more than one line.
87
+ Style/AlignHash:
88
+ # Alignment of entries using hash rocket as separator. Valid values are:
89
+ #
90
+ # key - left alignment of keys
91
+ # 'a' => 2
92
+ # 'bb' => 3
93
+ # separator - alignment of hash rockets, keys are right aligned
94
+ # 'a' => 2
95
+ # 'bb' => 3
96
+ # table - left alignment of keys, hash rockets, and values
97
+ # 'a' => 2
98
+ # 'bb' => 3
99
+ EnforcedHashRocketStyle: key
100
+ # Alignment of entries using colon as separator. Valid values are:
101
+ #
102
+ # key - left alignment of keys
103
+ # a: 0
104
+ # bb: 1
105
+ # separator - alignment of colons, keys are right aligned
106
+ # a: 0
107
+ # bb: 1
108
+ # table - left alignment of keys and values
109
+ # a: 0
110
+ # bb: 1
111
+ EnforcedColonStyle: key
112
+ # Select whether hashes that are the last argument in a method call should be
113
+ # inspected? Valid values are:
114
+ #
115
+ # always_inspect - Inspect both implicit and explicit hashes.
116
+ # Registers an offense for:
117
+ # function(a: 1,
118
+ # b: 2)
119
+ # Registers an offense for:
120
+ # function({a: 1,
121
+ # b: 2})
122
+ # always_ignore - Ignore both implicit and explicit hashes.
123
+ # Accepts:
124
+ # function(a: 1,
125
+ # b: 2)
126
+ # Accepts:
127
+ # function({a: 1,
128
+ # b: 2})
129
+ # ignore_implicit - Ignore only implicit hashes.
130
+ # Accepts:
131
+ # function(a: 1,
132
+ # b: 2)
133
+ # Registers an offense for:
134
+ # function({a: 1,
135
+ # b: 2})
136
+ # ignore_explicit - Ignore only explicit hashes.
137
+ # Accepts:
138
+ # function({a: 1,
139
+ # b: 2})
140
+ # Registers an offense for:
141
+ # function(a: 1,
142
+ # b: 2)
143
+ EnforcedLastArgumentHashStyle: always_inspect
144
+ SupportedLastArgumentHashStyles:
145
+ - always_inspect
146
+ - always_ignore
147
+ - ignore_implicit
148
+ - ignore_explicit
149
+
150
+ Style/AlignParameters:
151
+ # Alignment of parameters in multi-line method calls.
152
+ #
153
+ # The `with_first_parameter` style aligns the following lines along the same
154
+ # column as the first parameter.
155
+ #
156
+ # method_call(a,
157
+ # b)
158
+ #
159
+ # The `with_fixed_indentation` style aligns the following lines with one
160
+ # level of indentation relative to the start of the line with the method call.
161
+ #
162
+ # method_call(a,
163
+ # b)
164
+ EnforcedStyle: with_first_parameter
165
+ SupportedStyles:
166
+ - with_first_parameter
167
+ - with_fixed_indentation
168
+
169
+ Style/AndOr:
170
+ # Whether `and` and `or` are banned only in conditionals (conditionals)
171
+ # or completely (always).
172
+ EnforcedStyle: always
173
+ SupportedStyles:
174
+ - always
175
+ - conditionals
176
+
177
+
178
+ # Checks if usage of %() or %Q() matches configuration.
179
+ Style/BarePercentLiterals:
180
+ EnforcedStyle: bare_percent
181
+ SupportedStyles:
182
+ - percent_q
183
+ - bare_percent
184
+
185
+ Style/BlockDelimiters:
186
+ EnforcedStyle: line_count_based
187
+ SupportedStyles:
188
+ # The `line_count_based` style enforces braces around single line blocks and
189
+ # do..end around multi-line blocks.
190
+ - line_count_based
191
+ # The `semantic` style enforces braces around functional blocks, where the
192
+ # primary purpose of the block is to return a value and do..end for
193
+ # procedural blocks, where the primary purpose of the block is its
194
+ # side-effects.
195
+ #
196
+ # This looks at the usage of a block's method to determine its type (e.g. is
197
+ # the result of a `map` assigned to a variable or passed to another
198
+ # method) but exceptions are permitted in the `ProceduralMethods`,
199
+ # `FunctionalMethods` and `IgnoredMethods` sections below.
200
+ - semantic
201
+ # The `braces_for_chaining` style enforces braces around single line blocks
202
+ # and do..end around multi-line blocks, except for multi-line blocks whose
203
+ # return value is being chained with another method (in which case braces
204
+ # are enforced).
205
+ - braces_for_chaining
206
+ ProceduralMethods:
207
+ # Methods that are known to be procedural in nature but look functional from
208
+ # their usage, e.g.
209
+ #
210
+ # time = Benchmark.realtime do
211
+ # foo.bar
212
+ # end
213
+ #
214
+ # Here, the return value of the block is discarded but the return value of
215
+ # `Benchmark.realtime` is used.
216
+ - benchmark
217
+ - bm
218
+ - bmbm
219
+ - create
220
+ - each_with_object
221
+ - measure
222
+ - new
223
+ - realtime
224
+ - tap
225
+ - with_object
226
+ FunctionalMethods:
227
+ # Methods that are known to be functional in nature but look procedural from
228
+ # their usage, e.g.
229
+ #
230
+ # let(:foo) { Foo.new }
231
+ #
232
+ # Here, the return value of `Foo.new` is used to define a `foo` helper but
233
+ # doesn't appear to be used from the return value of `let`.
234
+ - let
235
+ - let!
236
+ - subject
237
+ - watch
238
+ IgnoredMethods:
239
+ # Methods that can be either procedural or functional and cannot be
240
+ # categorised from their usage alone, e.g.
241
+ #
242
+ # foo = lambda do |x|
243
+ # puts "Hello, #{x}"
244
+ # end
245
+ #
246
+ # foo = lambda do |x|
247
+ # x * 100
248
+ # end
249
+ #
250
+ # Here, it is impossible to tell from the return value of `lambda` whether
251
+ # the inner block's return value is significant.
252
+ - lambda
253
+ - proc
254
+ - it
255
+
256
+ Style/BracesAroundHashParameters:
257
+ EnforcedStyle: no_braces
258
+ SupportedStyles:
259
+ # The `braces` style enforces braces around all method parameters that are
260
+ # hashes.
261
+ - braces
262
+ # The `no_braces` style checks that the last parameter doesn't have braces
263
+ # around it.
264
+ - no_braces
265
+ # The `context_dependent` style checks that the last parameter doesn't have
266
+ # braces around it, but requires braces if the second to last parameter is
267
+ # also a hash literal.
268
+ - context_dependent
269
+
270
+ # Indentation of `when`.
271
+ Style/CaseIndentation:
272
+ IndentWhenRelativeTo: case
273
+ SupportedStyles:
274
+ - case
275
+ - end
276
+ IndentOneStep: false
277
+ # By default, the indentation width from Style/IndentationWidth is used
278
+ # But it can be overridden by setting this parameter
279
+ # This only matters if IndentOneStep is true
280
+ IndentationWidth: ~
281
+
282
+ Style/ClassAndModuleChildren:
283
+ # Checks the style of children definitions at classes and modules.
284
+ #
285
+ # Basically there are two different styles:
286
+ #
287
+ # `nested` - have each child on a separate line
288
+ # class Foo
289
+ # class Bar
290
+ # end
291
+ # end
292
+ #
293
+ # `compact` - combine definitions as much as possible
294
+ # class Foo::Bar
295
+ # end
296
+ #
297
+ # The compact style is only forced, for classes / modules with one child.
298
+ EnforcedStyle: nested
299
+ SupportedStyles:
300
+ - nested
301
+ - compact
302
+
303
+ Style/ClassCheck:
304
+ EnforcedStyle: is_a?
305
+ SupportedStyles:
306
+ - is_a?
307
+ - kind_of?
308
+
309
+ # Align with the style guide.
310
+ Style/CollectionMethods:
311
+ # Mapping from undesired method to desired_method
312
+ # e.g. to use `detect` over `find`:
313
+ #
314
+ # CollectionMethods:
315
+ # PreferredMethods:
316
+ # find: detect
317
+ PreferredMethods:
318
+ collect: 'map'
319
+ collect!: 'map!'
320
+ inject: 'reduce'
321
+ detect: 'find'
322
+ find_all: 'select'
323
+
324
+ # Use ` or %x around command literals.
325
+ Style/CommandLiteral:
326
+ EnforcedStyle: backticks
327
+ # backticks: Always use backticks.
328
+ # percent_x: Always use %x.
329
+ # mixed: Use backticks on single-line commands, and %x on multi-line commands.
330
+ SupportedStyles:
331
+ - backticks
332
+ - percent_x
333
+ - mixed
334
+ # If false, the cop will always recommend using %x if one or more backticks
335
+ # are found in the command string.
336
+ AllowInnerBackticks: false
337
+
338
+ # Checks formatting of special comments
339
+ Style/CommentAnnotation:
340
+ Keywords:
341
+ - TODO
342
+ - FIXME
343
+ - OPTIMIZE
344
+ - HACK
345
+ - REVIEW
346
+
347
+ Style/ConditionalAssignment:
348
+ EnforcedStyle: assign_to_condition
349
+ SupportedStyles:
350
+ - assign_to_condition
351
+ - assign_inside_condition
352
+ # When configured to `assign_to_condition`, `SingleLineConditionsOnly`
353
+ # will only register an offense when all branches of a condition are
354
+ # a single line.
355
+ # When configured to `assign_inside_condition`, `SingleLineConditionsOnly`
356
+ # will only register an offense for assignment to a condition that has
357
+ # at least one multiline branch.
358
+ SingleLineConditionsOnly: true
359
+
360
+ # Checks that you have put a copyright in a comment before any code.
361
+ #
362
+ # You can override the default Notice in your .rubocop.yml file.
363
+ #
364
+ # In order to use autocorrect, you must supply a value for the
365
+ # AutocorrectNotice key that matches the regexp Notice. A blank
366
+ # AutocorrectNotice will cause an error during autocorrect.
367
+ #
368
+ # Autocorrect will add a copyright notice in a comment at the top
369
+ # of the file immediately after any shebang or encoding comments.
370
+ #
371
+ # Example rubocop.yml:
372
+ #
373
+ # Style/Copyright:
374
+ # Enabled: true
375
+ # Notice: 'Copyright (\(c\) )?2015 Yahoo! Inc'
376
+ # AutocorrectNotice: '# Copyright (c) 2015 Yahoo! Inc.'
377
+ #
378
+ Style/Copyright:
379
+ Notice: '^Copyright (\(c\) )?2[0-9]{3} .+'
380
+ AutocorrectNotice: ''
381
+
382
+ # Multi-line method chaining should be done with leading dots.
383
+ Style/DotPosition:
384
+ EnforcedStyle: leading
385
+ SupportedStyles:
386
+ - leading
387
+ - trailing
388
+
389
+ # Warn on empty else statements
390
+ # empty - warn only on empty else
391
+ # nil - warn on else with nil in it
392
+ # both - warn on empty else and else with nil in it
393
+ Style/EmptyElse:
394
+ EnforcedStyle: both
395
+ SupportedStyles:
396
+ - empty
397
+ - nil
398
+ - both
399
+
400
+ # Use empty lines between defs.
401
+ Style/EmptyLineBetweenDefs:
402
+ # If true, this parameter means that single line method definitions don't
403
+ # need an empty line between them.
404
+ AllowAdjacentOneLineDefs: false
405
+
406
+ Style/EmptyLinesAroundBlockBody:
407
+ EnforcedStyle: no_empty_lines
408
+ SupportedStyles:
409
+ - empty_lines
410
+ - no_empty_lines
411
+
412
+ Style/EmptyLinesAroundClassBody:
413
+ EnforcedStyle: no_empty_lines
414
+ SupportedStyles:
415
+ - empty_lines
416
+ - no_empty_lines
417
+
418
+ Style/EmptyLinesAroundModuleBody:
419
+ EnforcedStyle: no_empty_lines
420
+ SupportedStyles:
421
+ - empty_lines
422
+ - no_empty_lines
423
+
424
+ # Checks whether the source file has a utf-8 encoding comment or not
425
+ # AutoCorrectEncodingComment must match the regex
426
+ # /#.*coding\s?[:=]\s?(?:UTF|utf)-8/
427
+ Style/Encoding:
428
+ EnforcedStyle: always
429
+ SupportedStyles:
430
+ - when_needed
431
+ - always
432
+ AutoCorrectEncodingComment: '# encoding: utf-8'
433
+
434
+ Style/ExtraSpacing:
435
+ # When true, allows most uses of extra spacing if the intent is to align
436
+ # things with the previous or next line, not counting empty lines or comment
437
+ # lines.
438
+ AllowForAlignment: true
439
+ # When true, forces the alignment of = in assignments on consecutive lines.
440
+ ForceEqualSignAlignment: false
441
+
442
+ Style/FileName:
443
+ # File names listed in AllCops:Include are excluded by default. Add extra
444
+ # excludes here.
445
+ Exclude: []
446
+ # When true, requires that each source file should define a class or module
447
+ # with a name which matches the file name (converted to ... case).
448
+ # It further expects it to be nested inside modules which match the names
449
+ # of subdirectories in its path.
450
+ ExpectMatchingDefinition: false
451
+ # If non-nil, expect all source file names to match the following regex.
452
+ # Only the file name itself is matched, not the entire file path.
453
+ # Use anchors as necessary if you want to match the entire name rather than
454
+ # just a part of it.
455
+ Regex: ~
456
+ # With `IgnoreExecutableScripts` set to `true`, this cop does not
457
+ # report offending filenames for executable scripts (i.e. source
458
+ # files with a shebang in the first line).
459
+ IgnoreExecutableScripts: true
460
+
461
+ Style/FirstParameterIndentation:
462
+ EnforcedStyle: special_for_inner_method_call_in_parentheses
463
+ SupportedStyles:
464
+ # The first parameter should always be indented one step more than the
465
+ # preceding line.
466
+ - consistent
467
+ # The first parameter should normally be indented one step more than the
468
+ # preceding line, but if it's a parameter for a method call that is itself
469
+ # a parameter in a method call, then the inner parameter should be indented
470
+ # relative to the inner method.
471
+ - special_for_inner_method_call
472
+ # Same as special_for_inner_method_call except that the special rule only
473
+ # applies if the outer method call encloses its arguments in parentheses.
474
+ - special_for_inner_method_call_in_parentheses
475
+ # By default, the indentation width from Style/IndentationWidth is used
476
+ # But it can be overridden by setting this parameter
477
+ IndentationWidth: ~
478
+
479
+ # Checks use of for or each in multiline loops.
480
+ Style/For:
481
+ EnforcedStyle: each
482
+ SupportedStyles:
483
+ - for
484
+ - each
485
+
486
+ # Enforce the method used for string formatting.
487
+ Style/FormatString:
488
+ EnforcedStyle: format
489
+ SupportedStyles:
490
+ - format
491
+ - sprintf
492
+ - percent
493
+
494
+ Style/FrozenStringLiteralComment:
495
+ EnforcedStyle: when_needed
496
+ SupportedStyles:
497
+ # `when_needed` will add the frozen string literal comment to files
498
+ # only when the `TargetRubyVersion` is set to 2.3+.
499
+ - when_needed
500
+ # `always` will always add the frozen string literal comment to a file
501
+ # regardless of the Ruby version or if `freeze` or `<<` are called on a
502
+ # string literal. If you run code against multiple versions of Ruby, it is
503
+ # possible that this will create errors in Ruby 2.3.0+.
504
+ - always
505
+
506
+ # Built-in global variables are allowed by default.
507
+ Style/GlobalVars:
508
+ AllowedVariables: []
509
+
510
+ # `MinBodyLength` defines the number of lines of the a body of an if / unless
511
+ # needs to have to trigger this cop
512
+ Style/GuardClause:
513
+ MinBodyLength: 1
514
+
515
+ Style/HashSyntax:
516
+ EnforcedStyle: ruby19
517
+ SupportedStyles:
518
+ - ruby19
519
+ - ruby19_no_mixed_keys
520
+ - hash_rockets
521
+ # Force hashes that have a symbol value to use hash rockets
522
+ UseHashRocketsWithSymbolValues: false
523
+
524
+ Style/IfUnlessModifier:
525
+ MaxLineLength: 80
526
+
527
+ Style/IndentationConsistency:
528
+ # The difference between `rails` and `normal` is that the `rails` style
529
+ # prescribes that in classes and modules the `protected` and `private`
530
+ # modifier keywords shall be indented the same as public methods and that
531
+ # protected and private members shall be indented one step more than the
532
+ # modifiers. Other than that, both styles mean that entities on the same
533
+ # logical depth shall have the same indentation.
534
+ EnforcedStyle: normal
535
+ SupportedStyles:
536
+ - normal
537
+ - rails
538
+
539
+ Style/IndentationWidth:
540
+ # Number of spaces for each indentation level.
541
+ Width: 2
542
+
543
+ # Checks the indentation of the first element in an array literal.
544
+ Style/IndentArray:
545
+ # The value `special_inside_parentheses` means that array literals with
546
+ # brackets that have their opening bracket on the same line as a surrounding
547
+ # opening round parenthesis, shall have their first element indented relative
548
+ # to the first position inside the parenthesis.
549
+ #
550
+ # The value `consistent` means that the indentation of the first element shall
551
+ # always be relative to the first position of the line where the opening
552
+ # bracket is.
553
+ #
554
+ # The value `align_brackets` means that the indentation of the first element
555
+ # shall always be relative to the position of the opening bracket.
556
+ EnforcedStyle: special_inside_parentheses
557
+ SupportedStyles:
558
+ - special_inside_parentheses
559
+ - consistent
560
+ - align_brackets
561
+ # By default, the indentation width from Style/IndentationWidth is used
562
+ # But it can be overridden by setting this parameter
563
+ IndentationWidth: ~
564
+
565
+ # Checks the indentation of assignment RHS, when on a different line from LHS
566
+ Style/IndentAssignment:
567
+ # By default, the indentation width from Style/IndentationWidth is used
568
+ # But it can be overridden by setting this parameter
569
+ IndentationWidth: ~
570
+
571
+ # Checks the indentation of the first key in a hash literal.
572
+ Style/IndentHash:
573
+ # The value `special_inside_parentheses` means that hash literals with braces
574
+ # that have their opening brace on the same line as a surrounding opening
575
+ # round parenthesis, shall have their first key indented relative to the
576
+ # first position inside the parenthesis.
577
+ #
578
+ # The value `consistent` means that the indentation of the first key shall
579
+ # always be relative to the first position of the line where the opening
580
+ # brace is.
581
+ #
582
+ # The value `align_braces` means that the indentation of the first key shall
583
+ # always be relative to the position of the opening brace.
584
+ EnforcedStyle: special_inside_parentheses
585
+ SupportedStyles:
586
+ - special_inside_parentheses
587
+ - consistent
588
+ - align_braces
589
+ # By default, the indentation width from Style/IndentationWidth is used
590
+ # But it can be overridden by setting this parameter
591
+ IndentationWidth: ~
592
+
593
+ Style/LambdaCall:
594
+ EnforcedStyle: call
595
+ SupportedStyles:
596
+ - call
597
+ - braces
598
+
599
+ Style/Next:
600
+ # With `always` all conditions at the end of an iteration needs to be
601
+ # replaced by next - with `skip_modifier_ifs` the modifier if like this one
602
+ # are ignored: [1, 2].each { |a| return 'yes' if a == 1 }
603
+ EnforcedStyle: skip_modifier_ifs
604
+ # `MinBodyLength` defines the number of lines of the a body of an if / unless
605
+ # needs to have to trigger this cop
606
+ MinBodyLength: 3
607
+ SupportedStyles:
608
+ - skip_modifier_ifs
609
+ - always
610
+
611
+ Style/NonNilCheck:
612
+ # With `IncludeSemanticChanges` set to `true`, this cop reports offenses for
613
+ # `!x.nil?` and autocorrects that and `x != nil` to solely `x`, which is
614
+ # **usually** OK, but might change behavior.
615
+ #
616
+ # With `IncludeSemanticChanges` set to `false`, this cop does not report
617
+ # offenses for `!x.nil?` and does no changes that might change behavior.
618
+ IncludeSemanticChanges: false
619
+
620
+ Style/MethodDefParentheses:
621
+ EnforcedStyle: require_parentheses
622
+ SupportedStyles:
623
+ - require_parentheses
624
+ - require_no_parentheses
625
+ - require_no_parentheses_except_multiline
626
+
627
+ Style/MethodName:
628
+ EnforcedStyle: snake_case
629
+ SupportedStyles:
630
+ - snake_case
631
+ - camelCase
632
+
633
+ Style/MultilineAssignmentLayout:
634
+ # The types of assignments which are subject to this rule.
635
+ SupportedTypes:
636
+ - block
637
+ - case
638
+ - class
639
+ - if
640
+ - kwbegin
641
+ - module
642
+ EnforcedStyle: new_line
643
+ SupportedStyles:
644
+ # Ensures that the assignment operator and the rhs are on the same line for
645
+ # the set of supported types.
646
+ - same_line
647
+ # Ensures that the assignment operator and the rhs are on separate lines
648
+ # for the set of supported types.
649
+ - new_line
650
+
651
+ Style/MultilineMethodCallIndentation:
652
+ EnforcedStyle: aligned
653
+ SupportedStyles:
654
+ - aligned
655
+ - indented
656
+ # By default, the indentation width from Style/IndentationWidth is used
657
+ # But it can be overridden by setting this parameter
658
+ IndentationWidth: ~
659
+
660
+ Style/MultilineOperationIndentation:
661
+ EnforcedStyle: aligned
662
+ SupportedStyles:
663
+ - aligned
664
+ - indented
665
+ # By default, the indentation width from Style/IndentationWidth is used
666
+ # But it can be overridden by setting this parameter
667
+ IndentationWidth: ~
668
+
669
+ Style/NumericLiterals:
670
+ MinDigits: 5
671
+
672
+ Style/OptionHash:
673
+ # A list of parameter names that will be flagged by this cop.
674
+ SuspiciousParamNames:
675
+ - options
676
+ - opts
677
+ - args
678
+ - params
679
+ - parameters
680
+
681
+ # Allow safe assignment in conditions.
682
+ Style/ParenthesesAroundCondition:
683
+ AllowSafeAssignment: true
684
+
685
+ Style/PercentLiteralDelimiters:
686
+ PreferredDelimiters:
687
+ '%': ()
688
+ '%i': ()
689
+ '%q': ()
690
+ '%Q': ()
691
+ '%r': '{}'
692
+ '%s': ()
693
+ '%w': ()
694
+ '%W': ()
695
+ '%x': ()
696
+
697
+ Style/PercentQLiterals:
698
+ EnforcedStyle: lower_case_q
699
+ SupportedStyles:
700
+ - lower_case_q # Use %q when possible, %Q when necessary
701
+ - upper_case_q # Always use %Q
702
+
703
+ Style/PredicateName:
704
+ # Predicate name prefixes.
705
+ NamePrefix:
706
+ - is_
707
+ - has_
708
+ - have_
709
+ # Predicate name prefixes that should be removed.
710
+ NamePrefixBlacklist:
711
+ - is_
712
+ - has_
713
+ - have_
714
+ # Predicate names which, despite having a blacklisted prefix, or no ?,
715
+ # should still be accepted
716
+ NameWhitelist:
717
+ - is_a?
718
+
719
+ Style/RaiseArgs:
720
+ EnforcedStyle: exploded
721
+ SupportedStyles:
722
+ - compact # raise Exception.new(msg)
723
+ - exploded # raise Exception, msg
724
+
725
+ Style/RedundantReturn:
726
+ # When true allows code like `return x, y`.
727
+ AllowMultipleReturnValues: false
728
+
729
+ # Use / or %r around regular expressions.
730
+ Style/RegexpLiteral:
731
+ EnforcedStyle: slashes
732
+ # slashes: Always use slashes.
733
+ # percent_r: Always use %r.
734
+ # mixed: Use slashes on single-line regexes, and %r on multi-line regexes.
735
+ SupportedStyles:
736
+ - slashes
737
+ - percent_r
738
+ - mixed
739
+ # If false, the cop will always recommend using %r if one or more slashes
740
+ # are found in the regexp string.
741
+ AllowInnerSlashes: false
742
+
743
+ Style/Semicolon:
744
+ # Allow ; to separate several expressions on the same line.
745
+ AllowAsExpressionSeparator: false
746
+
747
+ Style/SignalException:
748
+ EnforcedStyle: only_raise
749
+ SupportedStyles:
750
+ - only_raise
751
+ - only_fail
752
+ - semantic
753
+
754
+ Style/SingleLineBlockParams:
755
+ Methods:
756
+ - reduce:
757
+ - a
758
+ - e
759
+ - inject:
760
+ - a
761
+ - e
762
+
763
+ Style/SingleLineMethods:
764
+ AllowIfMethodIsEmpty: true
765
+
766
+ Style/SpaceBeforeFirstArg:
767
+ # When true, allows most uses of extra spacing if the intent is to align
768
+ # things with the previous or next line, not counting empty lines or comment
769
+ # lines.
770
+ AllowForAlignment: true
771
+
772
+ Style/SpecialGlobalVars:
773
+ EnforcedStyle: use_english_names
774
+ SupportedStyles:
775
+ - use_perl_names
776
+ - use_english_names
777
+
778
+ Style/StabbyLambdaParentheses:
779
+ EnforcedStyle: require_parentheses
780
+ SupportedStyles:
781
+ - require_parentheses
782
+ - require_no_parentheses
783
+
784
+ Style/StringLiterals:
785
+ EnforcedStyle: single_quotes
786
+ SupportedStyles:
787
+ - single_quotes
788
+ - double_quotes
789
+ # If true, strings which span multiple lines using \ for continuation must
790
+ # use the same type of quotes on each line.
791
+ ConsistentQuotesInMultiline: false
792
+
793
+ Style/StringLiteralsInInterpolation:
794
+ EnforcedStyle: single_quotes
795
+ SupportedStyles:
796
+ - single_quotes
797
+ - double_quotes
798
+
799
+ Style/StringMethods:
800
+ # Mapping from undesired method to desired_method
801
+ # e.g. to use `to_sym` over `intern`:
802
+ #
803
+ # StringMethods:
804
+ # PreferredMethods:
805
+ # intern: to_sym
806
+ PreferredMethods:
807
+ intern: to_sym
808
+
809
+ Style/SpaceAroundBlockParameters:
810
+ EnforcedStyleInsidePipes: no_space
811
+ SupportedStyles:
812
+ - space
813
+ - no_space
814
+
815
+ Style/SpaceAroundEqualsInParameterDefault:
816
+ EnforcedStyle: space
817
+ SupportedStyles:
818
+ - space
819
+ - no_space
820
+
821
+ Style/SpaceAroundOperators:
822
+ # When true, allows most uses of extra spacing if the intent is to align
823
+ # with an operator on the previous or next line, not counting empty lines
824
+ # or comment lines.
825
+ AllowForAlignment: true
826
+
827
+ Style/SpaceBeforeBlockBraces:
828
+ EnforcedStyle: space
829
+ SupportedStyles:
830
+ - space
831
+ - no_space
832
+
833
+ Style/SpaceInsideBlockBraces:
834
+ EnforcedStyle: space
835
+ SupportedStyles:
836
+ - space
837
+ - no_space
838
+ # Valid values are: space, no_space
839
+ EnforcedStyleForEmptyBraces: no_space
840
+ # Space between { and |. Overrides EnforcedStyle if there is a conflict.
841
+ SpaceBeforeBlockParameters: true
842
+
843
+ Style/SpaceInsideHashLiteralBraces:
844
+ EnforcedStyle: space
845
+ EnforcedStyleForEmptyBraces: no_space
846
+ SupportedStyles:
847
+ - space
848
+ - no_space
849
+
850
+ Style/SpaceInsideStringInterpolation:
851
+ EnforcedStyle: no_space
852
+ SupportedStyles:
853
+ - space
854
+ - no_space
855
+
856
+ Style/SymbolArray:
857
+ EnforcedStyle: percent
858
+ SupportedStyles:
859
+ - percent
860
+ - brackets
861
+
862
+ Style/SymbolProc:
863
+ # A list of method names to be ignored by the check.
864
+ # The names should be fairly unique, otherwise you'll end up ignoring lots of code.
865
+ IgnoredMethods:
866
+ - respond_to
867
+
868
+ Style/TrailingBlankLines:
869
+ EnforcedStyle: final_newline
870
+ SupportedStyles:
871
+ - final_newline
872
+ - final_blank_line
873
+
874
+ Style/TrailingCommaInArguments:
875
+ # If `comma`, the cop requires a comma after the last argument, but only for
876
+ # parenthesized method calls where each argument is on its own line.
877
+ # If `consistent_comma`, the cop requires a comma after the last argument,
878
+ # for all parenthesized method calls with arguments.
879
+ EnforcedStyleForMultiline: no_comma
880
+ SupportedStyles:
881
+ - comma
882
+ - consistent_comma
883
+ - no_comma
884
+
885
+ Style/TrailingCommaInLiteral:
886
+ # If `comma`, the cop requires a comma after the last item in an array or
887
+ # hash, but only when each item is on its own line.
888
+ # If `consistent_comma`, the cop requires a comma after the last item of all
889
+ # non-empty array and hash literals.
890
+ EnforcedStyleForMultiline: no_comma
891
+ SupportedStyles:
892
+ - comma
893
+ - consistent_comma
894
+ - no_comma
895
+
896
+ # TrivialAccessors requires exact name matches and doesn't allow
897
+ # predicated methods by default.
898
+ Style/TrivialAccessors:
899
+ # When set to false the cop will suggest the use of accessor methods
900
+ # in situations like:
901
+ #
902
+ # def name
903
+ # @other_name
904
+ # end
905
+ #
906
+ # This way you can uncover "hidden" attributes in your code.
907
+ ExactNameMatch: true
908
+ AllowPredicates: true
909
+ # Allows trivial writers that don't end in an equal sign. e.g.
910
+ #
911
+ # def on_exception(action)
912
+ # @on_exception=action
913
+ # end
914
+ # on_exception :restart
915
+ #
916
+ # Commonly used in DSLs
917
+ AllowDSLWriters: false
918
+ IgnoreClassMethods: false
919
+ Whitelist:
920
+ - to_ary
921
+ - to_a
922
+ - to_c
923
+ - to_enum
924
+ - to_h
925
+ - to_hash
926
+ - to_i
927
+ - to_int
928
+ - to_io
929
+ - to_open
930
+ - to_path
931
+ - to_proc
932
+ - to_r
933
+ - to_regexp
934
+ - to_str
935
+ - to_s
936
+ - to_sym
937
+
938
+ Style/VariableName:
939
+ EnforcedStyle: snake_case
940
+ SupportedStyles:
941
+ - snake_case
942
+ - camelCase
943
+
944
+ Style/WhileUntilModifier:
945
+ MaxLineLength: 80
946
+
947
+ Style/WordArray:
948
+ EnforcedStyle: percent
949
+ SupportedStyles:
950
+ - percent
951
+ - brackets
952
+ MinSize: 0
953
+ # The regular expression WordRegex decides what is considered a word.
954
+ WordRegex: !ruby/regexp '/\A[\p{Word}\n\t]+\z/'
955
+
956
+ ##################### Metrics ##################################
957
+
958
+ Metrics/AbcSize:
959
+ # The ABC size is a calculated magnitude, so this number can be a Fixnum or
960
+ # a Float.
961
+ Max: 15
962
+
963
+ Metrics/BlockNesting:
964
+ Max: 3
965
+
966
+ Metrics/ClassLength:
967
+ CountComments: false # count full line comments?
968
+ Max: 100
969
+
970
+ Metrics/ModuleLength:
971
+ CountComments: false # count full line comments?
972
+ Max: 100
973
+
974
+ # Avoid complex methods.
975
+ Metrics/CyclomaticComplexity:
976
+ Max: 6
977
+
978
+ Metrics/LineLength:
979
+ Max: 80
980
+ # To make it possible to copy or click on URIs in the code, we allow lines
981
+ # containing a URI to be longer than Max.
982
+ AllowHeredoc: true
983
+ AllowURI: true
984
+ URISchemes:
985
+ - http
986
+ - https
987
+
988
+ Metrics/MethodLength:
989
+ CountComments: false # count full line comments?
990
+ Max: 10
991
+
992
+ Metrics/ParameterLists:
993
+ Max: 5
994
+ CountKeywordArgs: true
995
+
996
+ Metrics/PerceivedComplexity:
997
+ Max: 7
998
+
999
+ ##################### Lint ##################################
1000
+
1001
+ # Allow safe assignment in conditions.
1002
+ Lint/AssignmentInCondition:
1003
+ AllowSafeAssignment: true
1004
+
1005
+ # checks whether the end keywords are aligned properly for `do` `end` blocks.
1006
+ Lint/BlockAlignment:
1007
+ # The value `start_of_block` means that the `end` should be aligned with line
1008
+ # where the `do` keyword appears.
1009
+ # The value `start_of_line` means it should be aligned with the whole
1010
+ # expression's starting line.
1011
+ # The value `either` means both are allowed.
1012
+ AlignWith: either
1013
+ SupportedStyles:
1014
+ - either
1015
+ - start_of_block
1016
+ - start_of_line
1017
+
1018
+ # Align ends correctly.
1019
+ Lint/EndAlignment:
1020
+ # The value `keyword` means that `end` should be aligned with the matching
1021
+ # keyword (if, while, etc.).
1022
+ # The value `variable` means that in assignments, `end` should be aligned
1023
+ # with the start of the variable on the left hand side of `=`. In all other
1024
+ # situations, `end` should still be aligned with the keyword.
1025
+ # The value `start_of_line` means that `end` should be aligned with the start
1026
+ # of the line which the matching keyword appears on.
1027
+ AlignWith: keyword
1028
+ SupportedStyles:
1029
+ - keyword
1030
+ - variable
1031
+ - start_of_line
1032
+ AutoCorrect: false
1033
+
1034
+ Lint/DefEndAlignment:
1035
+ # The value `def` means that `end` should be aligned with the def keyword.
1036
+ # The value `start_of_line` means that `end` should be aligned with method
1037
+ # calls like `private`, `public`, etc, if present in front of the `def`
1038
+ # keyword on the same line.
1039
+ AlignWith: start_of_line
1040
+ SupportedStyles:
1041
+ - start_of_line
1042
+ - def
1043
+ AutoCorrect: false
1044
+
1045
+ # Checks for unused block arguments
1046
+ Lint/UnusedBlockArgument:
1047
+ IgnoreEmptyBlocks: true
1048
+
1049
+ # Checks for unused method arguments.
1050
+ Lint/UnusedMethodArgument:
1051
+ AllowUnusedKeywordArguments: false
1052
+ IgnoreEmptyMethods: true
1053
+
1054
+ ##################### Performance ############################
1055
+
1056
+ Performance/RedundantMerge:
1057
+ # Max number of key-value pairs to consider an offense
1058
+ MaxKeyValuePairs: 2
1059
+
1060
+ ##################### Rails ##################################
1061
+
1062
+ Rails/ActionFilter:
1063
+ EnforcedStyle: action
1064
+ SupportedStyles:
1065
+ - action
1066
+ - filter
1067
+ Include:
1068
+ - app/controllers/**/*.rb
1069
+
1070
+ Rails/Date:
1071
+ # The value `strict` disallows usage of `Date.today`, `Date.current`,
1072
+ # `Date#to_time` etc.
1073
+ # The value `flexible` allows usage of `Date.current`, `Date.yesterday`, etc
1074
+ # (but not `Date.today`) which are overridden by ActiveSupport to handle current
1075
+ # time zone.
1076
+ EnforcedStyle: flexible
1077
+ SupportedStyles:
1078
+ - strict
1079
+ - flexible
1080
+
1081
+ Rails/FindBy:
1082
+ Include:
1083
+ - app/models/**/*.rb
1084
+
1085
+ Rails/FindEach:
1086
+ Include:
1087
+ - app/models/**/*.rb
1088
+
1089
+ Rails/HasAndBelongsToMany:
1090
+ Include:
1091
+ - app/models/**/*.rb
1092
+
1093
+ Rails/Output:
1094
+ Include:
1095
+ - app/**/*.rb
1096
+ - config/**/*.rb
1097
+ - db/**/*.rb
1098
+ - lib/**/*.rb
1099
+
1100
+ Rails/ReadWriteAttribute:
1101
+ Include:
1102
+ - app/models/**/*.rb
1103
+
1104
+ Rails/ScopeArgs:
1105
+ Include:
1106
+ - app/models/**/*.rb
1107
+
1108
+ Rails/TimeZone:
1109
+ # The value `strict` means that `Time` should be used with `zone`.
1110
+ # The value `flexible` allows usage of `in_time_zone` instead of `zone`.
1111
+ EnforcedStyle: flexible
1112
+ SupportedStyles:
1113
+ - strict
1114
+ - flexible
1115
+
1116
+ Rails/Validation:
1117
+ Include:
1118
+ - app/models/**/*.rb