silvercop 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +80 -0
  3. data/config/default.yml +4315 -0
  4. data/lib/silvercop.rb +1 -0
  5. metadata +103 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 050ab61a201c3c88bd7ca9b2b6eb06b29c640ce9
4
+ data.tar.gz: 9680ec4e3d5ee68f81e857359beb3f07b8a98b03
5
+ SHA512:
6
+ metadata.gz: 4e51fc1fafe15b25843a9b114687b09f9fc8736b6bb3a3a4336bf85f80a71c4992606a444f4b24daeb65aebeb7c392389b589945ce4d426162a14518a48c11e7
7
+ data.tar.gz: 96dfde732919a3fb541c9b7db6085bbe2922a84c9b33dd9d2c653ace212c5aa1686b044e988fd4609bf9030e0cb49f826f3175a24f16ccdee7fcd26214aa4380
@@ -0,0 +1,80 @@
1
+ # Overview
2
+
3
+ This gem houses RuboCop configuration files to be included in Silvercar Ruby projects.
4
+
5
+ # Branching Strategy
6
+
7
+ This repository uses [GitHub flow](https://guides.github.com/introduction/flow/).
8
+
9
+ * Feature branches should be Pull Requests opened against master.
10
+ * Feature branches should begin with the JIRA ticket number
11
+
12
+ # Pull Requests
13
+ All code merged into master must be merged via a pull request.
14
+
15
+ Pull requests must:
16
+
17
+ * Have one or more reviewers
18
+ * Be approved by one or more reviewers
19
+
20
+ Pull requests should:
21
+
22
+ * Be small, less than 2 days of work
23
+ * Be merged by author after review process
24
+
25
+ ## Usage
26
+
27
+ Add to gemfile:
28
+
29
+ ```gem 'silvercop'```
30
+
31
+ And then execute:
32
+
33
+ $ bundle
34
+
35
+ Or install it yourself as:
36
+
37
+ $ gem install silvercop
38
+
39
+ ## Publishing changes
40
+ After merging your changes to master, create a tag in the github repo. This will trigger a CircleCi build
41
+ which will push the gem to RubyGems.
42
+
43
+ **Note**: Make sure you update the `Silvercop::VERSION`, otherwise the build will fail saying the package already
44
+ exists.
45
+
46
+ ## Usage
47
+
48
+ RuboCop uses yml files to describe configuration. To begin using this with default configuration,
49
+ create a `.rubocop.yml` file in the root of your project with the following contents:
50
+
51
+ ```ruby
52
+ inherit_gem:
53
+ silvercop: .rubocop.yml
54
+ ```
55
+
56
+ It is recommended to use this gem as `bundle exec rubocop -RD`, the two options being to run
57
+ Rails cops as well as output the cop in question for that line of code.
58
+
59
+ If many offenses are detected, it is recommended to generate a TODO list that can be handled over
60
+ time without needing to fix all of the existing offenses. This can be done by generating and
61
+ including the following config:
62
+
63
+ `bundle exec rubocop -RD --auto-gen-config`
64
+
65
+ Then add `inherit_from: .rubocop_todo.yml` to your `.rubocop.yml` file. Adding `--exclude-limit 10000` can help prevent
66
+ the generated config from disabling cops entirely with `Enabled: false`.
67
+
68
+ Example usage of configuration inside Ruby project:
69
+
70
+ ```ruby
71
+ inherit_gem:
72
+ silvercop: .rubocop.yml
73
+
74
+ inherit_from: .rubocop_todo.yml
75
+
76
+ ```
77
+
78
+ ## Cop Documentation
79
+ Rubocop's documentation is thorough, he's a link directly to the Cops:
80
+ http://www.rubydoc.info/github/bbatsov/RuboCop/RuboCop/Cop
@@ -0,0 +1,4315 @@
1
+ # Common configuration.
2
+ # This file was copied directly from https://github.com/rubocop-hq/rubocop/blob/v0.68.1/config/default.yml
3
+ # That means it has more configuration than it needs, but it's easier to copy and paste into new versions
4
+ # since we're just adopting everything in the new version.
5
+
6
+ AllCops:
7
+ RubyInterpreters:
8
+ - ruby
9
+ - macruby
10
+ - rake
11
+ - jruby
12
+ - rbx
13
+ # Include common Ruby source files.
14
+ Include:
15
+ - '**/*.rb'
16
+ - '**/*.arb'
17
+ - '**/*.axlsx'
18
+ - '**/*.builder'
19
+ - '**/*.fcgi'
20
+ - '**/*.gemfile'
21
+ - '**/*.gemspec'
22
+ - '**/*.god'
23
+ - '**/*.jb'
24
+ - '**/*.jbuilder'
25
+ - '**/*.mspec'
26
+ - '**/*.opal'
27
+ - '**/*.pluginspec'
28
+ - '**/*.podspec'
29
+ - '**/*.rabl'
30
+ - '**/*.rake'
31
+ - '**/*.rbuild'
32
+ - '**/*.rbw'
33
+ - '**/*.rbx'
34
+ - '**/*.ru'
35
+ - '**/*.ruby'
36
+ - '**/*.spec'
37
+ - '**/*.thor'
38
+ - '**/*.watchr'
39
+ - '**/.irbrc'
40
+ - '**/.pryrc'
41
+ - '**/buildfile'
42
+ - '**/Appraisals'
43
+ - '**/Berksfile'
44
+ - '**/Brewfile'
45
+ - '**/Buildfile'
46
+ - '**/Capfile'
47
+ - '**/Cheffile'
48
+ - '**/Dangerfile'
49
+ - '**/Deliverfile'
50
+ - '**/Fastfile'
51
+ - '**/*Fastfile'
52
+ - '**/Gemfile'
53
+ - '**/Guardfile'
54
+ - '**/Jarfile'
55
+ - '**/Mavenfile'
56
+ - '**/Podfile'
57
+ - '**/Puppetfile'
58
+ - '**/Rakefile'
59
+ - '**/Snapfile'
60
+ - '**/Thorfile'
61
+ - '**/Vagabondfile'
62
+ - '**/Vagrantfile'
63
+ Exclude:
64
+ - 'node_modules/**/*'
65
+ - 'vendor/**/*'
66
+ - '.git/**/*'
67
+ # Default formatter will be used if no `-f/--format` option is given.
68
+ DefaultFormatter: progress
69
+ # Cop names are displayed in offense messages by default. Change behavior
70
+ # by overriding DisplayCopNames, or by giving the `--no-display-cop-names`
71
+ # option.
72
+ DisplayCopNames: true
73
+ # Style guide URLs are not displayed in offense messages by default. Change
74
+ # behavior by overriding `DisplayStyleGuide`, or by giving the
75
+ # `-S/--display-style-guide` option.
76
+ DisplayStyleGuide: false
77
+ # When specifying style guide URLs, any paths and/or fragments will be
78
+ # evaluated relative to the base URL.
79
+ StyleGuideBaseURL: https://github.com/rubocop-hq/ruby-style-guide
80
+ # Extra details are not displayed in offense messages by default. Change
81
+ # behavior by overriding ExtraDetails, or by giving the
82
+ # `-E/--extra-details` option.
83
+ ExtraDetails: false
84
+ # Additional cops that do not reference a style guide rule may be enabled by
85
+ # default. Change behavior by overriding `StyleGuideCopsOnly`, or by giving
86
+ # the `--only-guide-cops` option.
87
+ StyleGuideCopsOnly: false
88
+ # All cops except the ones configured `Enabled: false` in this file are enabled by default.
89
+ # Change this behavior by overriding either `DisabledByDefault` or `EnabledByDefault`.
90
+ # When `DisabledByDefault` is `true`, all cops in the default configuration
91
+ # are disabled, and only cops in user configuration are enabled. This makes
92
+ # cops opt-in instead of opt-out. Note that when `DisabledByDefault` is `true`,
93
+ # cops in user configuration will be enabled even if they don't set the
94
+ # Enabled parameter.
95
+ # When `EnabledByDefault` is `true`, all cops, even those configured `Enabled: false`
96
+ # in this file are enabled by default. Cops can still be disabled in user configuration.
97
+ # Note that it is invalid to set both EnabledByDefault and DisabledByDefault
98
+ # to true in the same configuration.
99
+ EnabledByDefault: false
100
+ DisabledByDefault: false
101
+ # Enables the result cache if `true`. Can be overridden by the `--cache` command
102
+ # line option.
103
+ UseCache: true
104
+ # Threshold for how many files can be stored in the result cache before some
105
+ # of the files are automatically removed.
106
+ MaxFilesInCache: 20000
107
+ # The cache will be stored in "rubocop_cache" under this directory. If
108
+ # CacheRootDirectory is ~ (nil), which it is by default, the root will be
109
+ # taken from the environment variable `$XDG_CACHE_HOME` if it is set, or if
110
+ # `$XDG_CACHE_HOME` is not set, it will be `$HOME/.cache/`.
111
+ CacheRootDirectory: ~
112
+ # It is possible for a malicious user to know the location of RuboCop's cache
113
+ # directory by looking at CacheRootDirectory, and create a symlink in its
114
+ # place that could cause RuboCop to overwrite unintended files, or read
115
+ # malicious input. If you are certain that your cache location is secure from
116
+ # this kind of attack, and wish to use a symlinked cache location, set this
117
+ # value to "true".
118
+ AllowSymlinksInCacheRootDirectory: false
119
+ # What MRI version of the Ruby interpreter is the inspected code intended to
120
+ # run on? (If there is more than one, set this to the lowest version.)
121
+ # If a value is specified for TargetRubyVersion then it is used. Acceptable
122
+ # values are specificed as a float (i.e. 2.5); the teeny version of Ruby
123
+ # should not be included. If the project specifies a Ruby version in the
124
+ # .ruby-version file, Gemfile or gems.rb file, RuboCop will try to determine
125
+ # the desired version of Ruby by inspecting the .ruby-version file first,
126
+ # followed by the Gemfile.lock or gems.locked file. (Although the Ruby version
127
+ # is specified in the Gemfile or gems.rb file, RuboCop reads the final value
128
+ # from the lock file.) If the Ruby version is still unresolved, RuboCop will
129
+ # use the oldest officially supported Ruby version (currently Ruby 2.2).
130
+ TargetRubyVersion: ~
131
+ # What version of Rails is the inspected code using? If a value is specified
132
+ # for TargetRailsVersion then it is used. Acceptable values are specificed
133
+ # as a float (i.e. 5.1); the patch version of Rails should not be included.
134
+ # If TargetRailsVersion is not set, RuboCop will parse the Gemfile.lock or
135
+ # gems.locked file to find the version of Rails that has been bound to the
136
+ # application. If neither of those files exist, RuboCop will use Rails 5.0
137
+ # as the default.
138
+ TargetRailsVersion: ~
139
+
140
+ #################### Bundler ###############################
141
+
142
+ Bundler/DuplicatedGem:
143
+ Description: 'Checks for duplicate gem entries in Gemfile.'
144
+ Enabled: true
145
+ VersionAdded: '0.46'
146
+ Include:
147
+ - '**/*.gemfile'
148
+ - '**/Gemfile'
149
+ - '**/gems.rb'
150
+
151
+ Bundler/GemComment:
152
+ Description: 'Add a comment describing each gem.'
153
+ Enabled: false
154
+ VersionAdded: '0.59'
155
+ Include:
156
+ - '**/*.gemfile'
157
+ - '**/Gemfile'
158
+ - '**/gems.rb'
159
+ Whitelist: []
160
+
161
+ Bundler/InsecureProtocolSource:
162
+ Description: >-
163
+ The source `:gemcutter`, `:rubygems` and `:rubyforge` are deprecated
164
+ because HTTP requests are insecure. Please change your source to
165
+ 'https://rubygems.org' if possible, or 'http://rubygems.org' if not.
166
+ Enabled: true
167
+ VersionAdded: '0.50'
168
+ Include:
169
+ - '**/*.gemfile'
170
+ - '**/Gemfile'
171
+ - '**/gems.rb'
172
+
173
+ Bundler/OrderedGems:
174
+ Description: >-
175
+ Gems within groups in the Gemfile should be alphabetically sorted.
176
+ Enabled: true
177
+ VersionAdded: '0.46'
178
+ VersionChanged: '0.47'
179
+ TreatCommentsAsGroupSeparators: true
180
+ Include:
181
+ - '**/*.gemfile'
182
+ - '**/Gemfile'
183
+ - '**/gems.rb'
184
+
185
+ #################### Gemspec ###############################
186
+
187
+ Gemspec/DuplicatedAssignment:
188
+ Description: 'An attribute assignment method calls should be listed only once in a gemspec.'
189
+ Enabled: true
190
+ VersionAdded: '0.52'
191
+ Include:
192
+ - '**/*.gemspec'
193
+
194
+ Gemspec/OrderedDependencies:
195
+ Description: >-
196
+ Dependencies in the gemspec should be alphabetically sorted.
197
+ Enabled: true
198
+ VersionAdded: '0.51'
199
+ TreatCommentsAsGroupSeparators: true
200
+ Include:
201
+ - '**/*.gemspec'
202
+
203
+ Gemspec/RequiredRubyVersion:
204
+ Description: 'Checks that `required_ruby_version` of gemspec and `TargetRubyVersion` of .rubocop.yml are equal.'
205
+ Enabled: true
206
+ VersionAdded: '0.52'
207
+ Include:
208
+ - '**/*.gemspec'
209
+
210
+ #################### Layout ###########################
211
+
212
+ Layout/AccessModifierIndentation:
213
+ Description: Check indentation of private/protected visibility modifiers.
214
+ StyleGuide: '#indent-public-private-protected'
215
+ Enabled: true
216
+ VersionAdded: '0.49'
217
+ EnforcedStyle: indent
218
+ SupportedStyles:
219
+ - outdent
220
+ - indent
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
+ Layout/AlignArguments:
226
+ Description: >-
227
+ Align the arguments of a method call if they span more
228
+ than one line.
229
+ StyleGuide: '#no-double-indent'
230
+ Enabled: true
231
+ VersionAdded: '0.68'
232
+ # Alignment of arguments in multi-line method calls.
233
+ #
234
+ # The `with_first_argument` style aligns the following lines along the same
235
+ # column as the first parameter.
236
+ #
237
+ # method_call(a,
238
+ # b)
239
+ #
240
+ # The `with_fixed_indentation` style aligns the following lines with one
241
+ # level of indentation relative to the start of the line with the method call.
242
+ #
243
+ # method_call(a,
244
+ # b)
245
+ EnforcedStyle: with_first_argument
246
+ SupportedStyles:
247
+ - with_first_argument
248
+ - with_fixed_indentation
249
+ # By default, the indentation width from Layout/IndentationWidth is used
250
+ # But it can be overridden by setting this parameter
251
+ IndentationWidth: ~
252
+
253
+ Layout/AlignArray:
254
+ Description: >-
255
+ Align the elements of an array literal if they span more than
256
+ one line.
257
+ StyleGuide: '#align-multiline-arrays'
258
+ Enabled: true
259
+ VersionAdded: '0.49'
260
+
261
+ Layout/AlignHash:
262
+ Description: >-
263
+ Align the elements of a hash literal if they span more than
264
+ one line.
265
+ Enabled: true
266
+ VersionAdded: '0.49'
267
+ # Alignment of entries using hash rocket as separator. Valid values are:
268
+ #
269
+ # key - left alignment of keys
270
+ # 'a' => 2
271
+ # 'bb' => 3
272
+ # separator - alignment of hash rockets, keys are right aligned
273
+ # 'a' => 2
274
+ # 'bb' => 3
275
+ # table - left alignment of keys, hash rockets, and values
276
+ # 'a' => 2
277
+ # 'bb' => 3
278
+ EnforcedHashRocketStyle: key
279
+ SupportedHashRocketStyles:
280
+ - key
281
+ - separator
282
+ - table
283
+ # Alignment of entries using colon as separator. Valid values are:
284
+ #
285
+ # key - left alignment of keys
286
+ # a: 0
287
+ # bb: 1
288
+ # separator - alignment of colons, keys are right aligned
289
+ # a: 0
290
+ # bb: 1
291
+ # table - left alignment of keys and values
292
+ # a: 0
293
+ # bb: 1
294
+ EnforcedColonStyle: key
295
+ SupportedColonStyles:
296
+ - key
297
+ - separator
298
+ - table
299
+ # Select whether hashes that are the last argument in a method call should be
300
+ # inspected? Valid values are:
301
+ #
302
+ # always_inspect - Inspect both implicit and explicit hashes.
303
+ # Registers an offense for:
304
+ # function(a: 1,
305
+ # b: 2)
306
+ # Registers an offense for:
307
+ # function({a: 1,
308
+ # b: 2})
309
+ # always_ignore - Ignore both implicit and explicit hashes.
310
+ # Accepts:
311
+ # function(a: 1,
312
+ # b: 2)
313
+ # Accepts:
314
+ # function({a: 1,
315
+ # b: 2})
316
+ # ignore_implicit - Ignore only implicit hashes.
317
+ # Accepts:
318
+ # function(a: 1,
319
+ # b: 2)
320
+ # Registers an offense for:
321
+ # function({a: 1,
322
+ # b: 2})
323
+ # ignore_explicit - Ignore only explicit hashes.
324
+ # Accepts:
325
+ # function({a: 1,
326
+ # b: 2})
327
+ # Registers an offense for:
328
+ # function(a: 1,
329
+ # b: 2)
330
+ EnforcedLastArgumentHashStyle: always_inspect
331
+ SupportedLastArgumentHashStyles:
332
+ - always_inspect
333
+ - always_ignore
334
+ - ignore_implicit
335
+ - ignore_explicit
336
+
337
+ Layout/AlignParameters:
338
+ Description: >-
339
+ Align the parameters of a method definition if they span more
340
+ than one line.
341
+ StyleGuide: '#no-double-indent'
342
+ Enabled: true
343
+ VersionAdded: '0.49'
344
+ VersionChanged: '0.68'
345
+ # Alignment of parameters in multi-line method calls.
346
+ #
347
+ # The `with_first_parameter` style aligns the following lines along the same
348
+ # column as the first parameter.
349
+ #
350
+ # def method_foo(a,
351
+ # b)
352
+ #
353
+ # The `with_fixed_indentation` style aligns the following lines with one
354
+ # level of indentation relative to the start of the line with the method call.
355
+ #
356
+ # def method_foo(a,
357
+ # b)
358
+ EnforcedStyle: with_first_parameter
359
+ SupportedStyles:
360
+ - with_first_parameter
361
+ - with_fixed_indentation
362
+ # By default, the indentation width from Layout/IndentationWidth is used
363
+ # But it can be overridden by setting this parameter
364
+ IndentationWidth: ~
365
+
366
+ Layout/BlockAlignment:
367
+ Description: 'Align block ends correctly.'
368
+ Enabled: true
369
+ VersionAdded: '0.53'
370
+ # The value `start_of_block` means that the `end` should be aligned with line
371
+ # where the `do` keyword appears.
372
+ # The value `start_of_line` means it should be aligned with the whole
373
+ # expression's starting line.
374
+ # The value `either` means both are allowed.
375
+ EnforcedStyleAlignWith: either
376
+ SupportedStylesAlignWith:
377
+ - either
378
+ - start_of_block
379
+ - start_of_line
380
+
381
+ Layout/BlockEndNewline:
382
+ Description: 'Put end statement of multiline block on its own line.'
383
+ Enabled: true
384
+ VersionAdded: '0.49'
385
+
386
+ Layout/CaseIndentation:
387
+ Description: 'Indentation of when in a case/when/[else/]end.'
388
+ StyleGuide: '#indent-when-to-case'
389
+ Enabled: true
390
+ VersionAdded: '0.49'
391
+ EnforcedStyle: case
392
+ SupportedStyles:
393
+ - case
394
+ - end
395
+ IndentOneStep: false
396
+ # By default, the indentation width from `Layout/IndentationWidth` is used.
397
+ # But it can be overridden by setting this parameter.
398
+ # This only matters if `IndentOneStep` is `true`
399
+ IndentationWidth: ~
400
+
401
+ Layout/ClassStructure:
402
+ Description: 'Enforces a configured order of definitions within a class body.'
403
+ StyleGuide: '#consistent-classes'
404
+ Enabled: false
405
+ VersionAdded: '0.52'
406
+ Categories:
407
+ module_inclusion:
408
+ - include
409
+ - prepend
410
+ - extend
411
+ ExpectedOrder:
412
+ - module_inclusion
413
+ - constants
414
+ - public_class_methods
415
+ - initializer
416
+ - public_methods
417
+ - protected_methods
418
+ - private_methods
419
+
420
+ Layout/ClosingHeredocIndentation:
421
+ Description: 'Checks the indentation of here document closings.'
422
+ Enabled: true
423
+ VersionAdded: '0.57'
424
+
425
+ Layout/ClosingParenthesisIndentation:
426
+ Description: 'Checks the indentation of hanging closing parentheses.'
427
+ Enabled: true
428
+ VersionAdded: '0.49'
429
+
430
+ Layout/CommentIndentation:
431
+ Description: 'Indentation of comments.'
432
+ Enabled: true
433
+ VersionAdded: '0.49'
434
+
435
+ Layout/ConditionPosition:
436
+ Description: >-
437
+ Checks for condition placed in a confusing position relative to
438
+ the keyword.
439
+ StyleGuide: '#same-line-condition'
440
+ Enabled: true
441
+ VersionAdded: '0.53'
442
+
443
+ Layout/DefEndAlignment:
444
+ Description: 'Align ends corresponding to defs correctly.'
445
+ Enabled: true
446
+ VersionAdded: '0.53'
447
+ # The value `def` means that `end` should be aligned with the def keyword.
448
+ # The value `start_of_line` means that `end` should be aligned with method
449
+ # calls like `private`, `public`, etc, if present in front of the `def`
450
+ # keyword on the same line.
451
+ EnforcedStyleAlignWith: start_of_line
452
+ SupportedStylesAlignWith:
453
+ - start_of_line
454
+ - def
455
+ AutoCorrect: false
456
+ Severity: warning
457
+
458
+ Layout/DotPosition:
459
+ Description: 'Checks the position of the dot in multi-line method calls.'
460
+ StyleGuide: '#consistent-multi-line-chains'
461
+ Enabled: true
462
+ VersionAdded: '0.49'
463
+ EnforcedStyle: leading
464
+ SupportedStyles:
465
+ - leading
466
+ - trailing
467
+
468
+ Layout/ElseAlignment:
469
+ Description: 'Align elses and elsifs correctly.'
470
+ Enabled: true
471
+ VersionAdded: '0.49'
472
+
473
+ Layout/EmptyComment:
474
+ Description: 'Checks empty comment.'
475
+ Enabled: true
476
+ VersionAdded: '0.53'
477
+ AllowBorderComment: true
478
+ AllowMarginComment: true
479
+
480
+ Layout/EmptyLineAfterGuardClause:
481
+ Description: 'Add empty line after guard clause.'
482
+ Enabled: true
483
+ VersionAdded: '0.56'
484
+ VersionChanged: '0.59'
485
+
486
+ Layout/EmptyLineAfterMagicComment:
487
+ Description: 'Add an empty line after magic comments to separate them from code.'
488
+ StyleGuide: '#separate-magic-comments-from-code'
489
+ Enabled: true
490
+ VersionAdded: '0.49'
491
+
492
+ Layout/EmptyLineBetweenDefs:
493
+ Description: 'Use empty lines between defs.'
494
+ StyleGuide: '#empty-lines-between-methods'
495
+ Enabled: true
496
+ VersionAdded: '0.49'
497
+ # If `true`, this parameter means that single line method definitions don't
498
+ # need an empty line between them.
499
+ AllowAdjacentOneLineDefs: false
500
+ # Can be array to specify minimum and maximum number of empty lines, e.g. [1, 2]
501
+ NumberOfEmptyLines: 1
502
+
503
+ Layout/EmptyLines:
504
+ Description: "Don't use several empty lines in a row."
505
+ StyleGuide: '#two-or-more-empty-lines'
506
+ Enabled: true
507
+ VersionAdded: '0.49'
508
+
509
+ Layout/EmptyLinesAroundAccessModifier:
510
+ Description: "Keep blank lines around access modifiers."
511
+ StyleGuide: '#empty-lines-around-access-modifier'
512
+ Enabled: true
513
+ VersionAdded: '0.49'
514
+
515
+ Layout/EmptyLinesAroundArguments:
516
+ Description: "Keeps track of empty lines around method arguments."
517
+ Enabled: true
518
+ VersionAdded: '0.52'
519
+
520
+ Layout/EmptyLinesAroundBeginBody:
521
+ Description: "Keeps track of empty lines around begin-end bodies."
522
+ StyleGuide: '#empty-lines-around-bodies'
523
+ Enabled: true
524
+ VersionAdded: '0.49'
525
+
526
+ Layout/EmptyLinesAroundBlockBody:
527
+ Description: "Keeps track of empty lines around block bodies."
528
+ StyleGuide: '#empty-lines-around-bodies'
529
+ Enabled: true
530
+ VersionAdded: '0.49'
531
+ EnforcedStyle: no_empty_lines
532
+ SupportedStyles:
533
+ - empty_lines
534
+ - no_empty_lines
535
+
536
+ Layout/EmptyLinesAroundClassBody:
537
+ Description: "Keeps track of empty lines around class bodies."
538
+ StyleGuide: '#empty-lines-around-bodies'
539
+ Enabled: true
540
+ VersionAdded: '0.49'
541
+ VersionChanged: '0.53'
542
+ EnforcedStyle: no_empty_lines
543
+ SupportedStyles:
544
+ - empty_lines
545
+ - empty_lines_except_namespace
546
+ - empty_lines_special
547
+ - no_empty_lines
548
+ - beginning_only
549
+ - ending_only
550
+
551
+ Layout/EmptyLinesAroundExceptionHandlingKeywords:
552
+ Description: "Keeps track of empty lines around exception handling keywords."
553
+ StyleGuide: '#empty-lines-around-bodies'
554
+ Enabled: true
555
+ VersionAdded: '0.49'
556
+
557
+ Layout/EmptyLinesAroundMethodBody:
558
+ Description: "Keeps track of empty lines around method bodies."
559
+ StyleGuide: '#empty-lines-around-bodies'
560
+ Enabled: true
561
+ VersionAdded: '0.49'
562
+
563
+ Layout/EmptyLinesAroundModuleBody:
564
+ Description: "Keeps track of empty lines around module bodies."
565
+ StyleGuide: '#empty-lines-around-bodies'
566
+ Enabled: true
567
+ VersionAdded: '0.49'
568
+ EnforcedStyle: no_empty_lines
569
+ SupportedStyles:
570
+ - empty_lines
571
+ - empty_lines_except_namespace
572
+ - empty_lines_special
573
+ - no_empty_lines
574
+
575
+ Layout/EndAlignment:
576
+ Description: 'Align ends correctly.'
577
+ Enabled: true
578
+ VersionAdded: '0.53'
579
+ # The value `keyword` means that `end` should be aligned with the matching
580
+ # keyword (`if`, `while`, etc.).
581
+ # The value `variable` means that in assignments, `end` should be aligned
582
+ # with the start of the variable on the left hand side of `=`. In all other
583
+ # situations, `end` should still be aligned with the keyword.
584
+ # The value `start_of_line` means that `end` should be aligned with the start
585
+ # of the line which the matching keyword appears on.
586
+ EnforcedStyleAlignWith: keyword
587
+ SupportedStylesAlignWith:
588
+ - keyword
589
+ - variable
590
+ - start_of_line
591
+ AutoCorrect: false
592
+ Severity: warning
593
+
594
+ Layout/EndOfLine:
595
+ Description: 'Use Unix-style line endings.'
596
+ StyleGuide: '#crlf'
597
+ Enabled: true
598
+ VersionAdded: '0.49'
599
+ # The `native` style means that CR+LF (Carriage Return + Line Feed) is
600
+ # enforced on Windows, and LF is enforced on other platforms. The other styles
601
+ # mean LF and CR+LF, respectively.
602
+ EnforcedStyle: native
603
+ SupportedStyles:
604
+ - native
605
+ - lf
606
+ - crlf
607
+
608
+ Layout/ExtraSpacing:
609
+ Description: 'Do not use unnecessary spacing.'
610
+ Enabled: true
611
+ VersionAdded: '0.49'
612
+ # When true, allows most uses of extra spacing if the intent is to align
613
+ # things with the previous or next line, not counting empty lines or comment
614
+ # lines.
615
+ AllowForAlignment: true
616
+ # When true, allows things like 'obj.meth(arg) # comment',
617
+ # rather than insisting on 'obj.meth(arg) # comment'.
618
+ # If done for alignment, either this OR AllowForAlignment will allow it.
619
+ AllowBeforeTrailingComments: false
620
+ # When true, forces the alignment of `=` in assignments on consecutive lines.
621
+ ForceEqualSignAlignment: false
622
+
623
+ Layout/FirstArrayElementLineBreak:
624
+ Description: >-
625
+ Checks for a line break before the first element in a
626
+ multi-line array.
627
+ Enabled: false
628
+ VersionAdded: '0.49'
629
+
630
+ Layout/FirstHashElementLineBreak:
631
+ Description: >-
632
+ Checks for a line break before the first element in a
633
+ multi-line hash.
634
+ Enabled: false
635
+ VersionAdded: '0.49'
636
+
637
+ Layout/FirstMethodArgumentLineBreak:
638
+ Description: >-
639
+ Checks for a line break before the first argument in a
640
+ multi-line method call.
641
+ Enabled: false
642
+ VersionAdded: '0.49'
643
+
644
+ Layout/FirstMethodParameterLineBreak:
645
+ Description: >-
646
+ Checks for a line break before the first parameter in a
647
+ multi-line method parameter definition.
648
+ Enabled: false
649
+ VersionAdded: '0.49'
650
+
651
+ Layout/HeredocArgumentClosingParenthesis:
652
+ Description: >-
653
+ Checks for the placement of the closing parenthesis in a
654
+ method call that passes a HEREDOC string as an argument.
655
+ Enabled: false
656
+ StyleGuide: '#heredoc-argument-closing-parentheses'
657
+ VersionAdded: '0.68'
658
+
659
+ Layout/IndentAssignment:
660
+ Description: >-
661
+ Checks the indentation of the first line of the
662
+ right-hand-side of a multi-line assignment.
663
+ Enabled: true
664
+ VersionAdded: '0.49'
665
+ # By default, the indentation width from `Layout/IndentationWidth` is used
666
+ # But it can be overridden by setting this parameter
667
+ IndentationWidth: ~
668
+
669
+ Layout/IndentFirstArgument:
670
+ Description: 'Checks the indentation of the first argument in a method call.'
671
+ Enabled: true
672
+ VersionAdded: '0.68'
673
+ EnforcedStyle: special_for_inner_method_call_in_parentheses
674
+ SupportedStyles:
675
+ # The first parameter should always be indented one step more than the
676
+ # preceding line.
677
+ - consistent
678
+ # The first parameter should always be indented one level relative to the
679
+ # parent that is receiving the parameter
680
+ - consistent_relative_to_receiver
681
+ # The first parameter should normally be indented one step more than the
682
+ # preceding line, but if it's a parameter for a method call that is itself
683
+ # a parameter in a method call, then the inner parameter should be indented
684
+ # relative to the inner method.
685
+ - special_for_inner_method_call
686
+ # Same as `special_for_inner_method_call` except that the special rule only
687
+ # applies if the outer method call encloses its arguments in parentheses.
688
+ - special_for_inner_method_call_in_parentheses
689
+ # By default, the indentation width from `Layout/IndentationWidth` is used
690
+ # But it can be overridden by setting this parameter
691
+ IndentationWidth: ~
692
+
693
+ Layout/IndentFirstArrayElement:
694
+ Description: >-
695
+ Checks the indentation of the first element in an array
696
+ literal.
697
+ Enabled: true
698
+ VersionAdded: '0.68'
699
+ # The value `special_inside_parentheses` means that array literals with
700
+ # brackets that have their opening bracket on the same line as a surrounding
701
+ # opening round parenthesis, shall have their first element indented relative
702
+ # to the first position inside the parenthesis.
703
+ #
704
+ # The value `consistent` means that the indentation of the first element shall
705
+ # always be relative to the first position of the line where the opening
706
+ # bracket is.
707
+ #
708
+ # The value `align_brackets` means that the indentation of the first element
709
+ # shall always be relative to the position of the opening bracket.
710
+ EnforcedStyle: special_inside_parentheses
711
+ SupportedStyles:
712
+ - special_inside_parentheses
713
+ - consistent
714
+ - align_brackets
715
+ # By default, the indentation width from `Layout/IndentationWidth` is used
716
+ # But it can be overridden by setting this parameter
717
+ IndentationWidth: ~
718
+
719
+ Layout/IndentFirstHashElement:
720
+ Description: 'Checks the indentation of the first key in a hash literal.'
721
+ Enabled: true
722
+ VersionAdded: '0.68'
723
+ # The value `special_inside_parentheses` means that hash literals with braces
724
+ # that have their opening brace on the same line as a surrounding opening
725
+ # round parenthesis, shall have their first key indented relative to the
726
+ # first position inside the parenthesis.
727
+ #
728
+ # The value `consistent` means that the indentation of the first key shall
729
+ # always be relative to the first position of the line where the opening
730
+ # brace is.
731
+ #
732
+ # The value `align_braces` means that the indentation of the first key shall
733
+ # always be relative to the position of the opening brace.
734
+ EnforcedStyle: special_inside_parentheses
735
+ SupportedStyles:
736
+ - special_inside_parentheses
737
+ - consistent
738
+ - align_braces
739
+ # By default, the indentation width from `Layout/IndentationWidth` is used
740
+ # But it can be overridden by setting this parameter
741
+ IndentationWidth: ~
742
+
743
+ Layout/IndentFirstParameter:
744
+ Description: >-
745
+ Checks the indentation of the first parameter in a
746
+ method definition.
747
+ Enabled: true
748
+ VersionAdded: '0.49'
749
+ VersionChanged: '0.68'
750
+ EnforcedStyle: consistent
751
+ SupportedStyles:
752
+ - consistent
753
+ - align_parentheses
754
+ # By default, the indentation width from `Layout/IndentationWidth` is used
755
+ # But it can be overridden by setting this parameter
756
+ IndentationWidth: ~
757
+
758
+ Layout/IndentHeredoc:
759
+ Description: 'This cop checks the indentation of the here document bodies.'
760
+ StyleGuide: '#squiggly-heredocs'
761
+ Enabled: true
762
+ VersionAdded: '0.49'
763
+ EnforcedStyle: auto_detection
764
+ SupportedStyles:
765
+ - auto_detection
766
+ - squiggly
767
+ - active_support
768
+ - powerpack
769
+ - unindent
770
+
771
+ Layout/IndentationConsistency:
772
+ Description: 'Keep indentation straight.'
773
+ StyleGuide: '#spaces-indentation'
774
+ Enabled: true
775
+ VersionAdded: '0.49'
776
+ # The difference between `rails` and `normal` is that the `rails` style
777
+ # prescribes that in classes and modules the `protected` and `private`
778
+ # modifier keywords shall be indented the same as public methods and that
779
+ # protected and private members shall be indented one step more than the
780
+ # modifiers. Other than that, both styles mean that entities on the same
781
+ # logical depth shall have the same indentation.
782
+ EnforcedStyle: normal
783
+ SupportedStyles:
784
+ - normal
785
+ - rails
786
+
787
+ Layout/IndentationWidth:
788
+ Description: 'Use 2 spaces for indentation.'
789
+ StyleGuide: '#spaces-indentation'
790
+ Enabled: true
791
+ VersionAdded: '0.49'
792
+ # Number of spaces for each indentation level.
793
+ Width: 2
794
+ IgnoredPatterns: []
795
+
796
+ Layout/InitialIndentation:
797
+ Description: >-
798
+ Checks the indentation of the first non-blank non-comment line in a file.
799
+ Enabled: true
800
+ VersionAdded: '0.49'
801
+
802
+ Layout/LeadingBlankLines:
803
+ Description: Check for unnecessary blank lines at the beginning of a file.
804
+ Enabled: true
805
+ VersionAdded: '0.57'
806
+
807
+ Layout/LeadingCommentSpace:
808
+ Description: 'Comments should start with a space.'
809
+ StyleGuide: '#hash-space'
810
+ Enabled: true
811
+ VersionAdded: '0.49'
812
+
813
+ Layout/MultilineArrayBraceLayout:
814
+ Description: >-
815
+ Checks that the closing brace in an array literal is
816
+ either on the same line as the last array element, or
817
+ a new line.
818
+ Enabled: true
819
+ VersionAdded: '0.49'
820
+ EnforcedStyle: symmetrical
821
+ SupportedStyles:
822
+ # symmetrical: closing brace is positioned in same way as opening brace
823
+ # new_line: closing brace is always on a new line
824
+ # same_line: closing brace is always on the same line as last element
825
+ - symmetrical
826
+ - new_line
827
+ - same_line
828
+
829
+ Layout/MultilineArrayLineBreaks:
830
+ Description: >-
831
+ Checks that each item in a multi-line array literal
832
+ starts on a separate line.
833
+ Enabled: false
834
+ VersionAdded: '0.67'
835
+
836
+ Layout/MultilineAssignmentLayout:
837
+ Description: 'Check for a newline after the assignment operator in multi-line assignments.'
838
+ StyleGuide: '#indent-conditional-assignment'
839
+ Enabled: false
840
+ VersionAdded: '0.49'
841
+ # The types of assignments which are subject to this rule.
842
+ SupportedTypes:
843
+ - block
844
+ - case
845
+ - class
846
+ - if
847
+ - kwbegin
848
+ - module
849
+ EnforcedStyle: new_line
850
+ SupportedStyles:
851
+ # Ensures that the assignment operator and the rhs are on the same line for
852
+ # the set of supported types.
853
+ - same_line
854
+ # Ensures that the assignment operator and the rhs are on separate lines
855
+ # for the set of supported types.
856
+ - new_line
857
+
858
+ Layout/MultilineBlockLayout:
859
+ Description: 'Ensures newlines after multiline block do statements.'
860
+ Enabled: true
861
+ VersionAdded: '0.49'
862
+
863
+ Layout/MultilineHashBraceLayout:
864
+ Description: >-
865
+ Checks that the closing brace in a hash literal is
866
+ either on the same line as the last hash element, or
867
+ a new line.
868
+ Enabled: true
869
+ VersionAdded: '0.49'
870
+ EnforcedStyle: symmetrical
871
+ SupportedStyles:
872
+ # symmetrical: closing brace is positioned in same way as opening brace
873
+ # new_line: closing brace is always on a new line
874
+ # same_line: closing brace is always on same line as last element
875
+ - symmetrical
876
+ - new_line
877
+ - same_line
878
+
879
+ Layout/MultilineHashKeyLineBreaks:
880
+ Description: >-
881
+ Checks that each item in a multi-line hash literal
882
+ starts on a separate line.
883
+ Enabled: false
884
+ VersionAdded: '0.67'
885
+
886
+ Layout/MultilineMethodArgumentLineBreaks:
887
+ Description: >-
888
+ Checks that each argument in a multi-line method call
889
+ starts on a separate line.
890
+ Enabled: false
891
+ VersionAdded: '0.67'
892
+
893
+ Layout/MultilineMethodCallBraceLayout:
894
+ Description: >-
895
+ Checks that the closing brace in a method call is
896
+ either on the same line as the last method argument, or
897
+ a new line.
898
+ Enabled: true
899
+ VersionAdded: '0.49'
900
+ EnforcedStyle: symmetrical
901
+ SupportedStyles:
902
+ # symmetrical: closing brace is positioned in same way as opening brace
903
+ # new_line: closing brace is always on a new line
904
+ # same_line: closing brace is always on the same line as last argument
905
+ - symmetrical
906
+ - new_line
907
+ - same_line
908
+
909
+ Layout/MultilineMethodCallIndentation:
910
+ Description: >-
911
+ Checks indentation of method calls with the dot operator
912
+ that span more than one line.
913
+ Enabled: true
914
+ VersionAdded: '0.49'
915
+ EnforcedStyle: aligned
916
+ SupportedStyles:
917
+ - aligned
918
+ - indented
919
+ - indented_relative_to_receiver
920
+ # By default, the indentation width from Layout/IndentationWidth is used
921
+ # But it can be overridden by setting this parameter
922
+ IndentationWidth: ~
923
+
924
+ Layout/MultilineMethodDefinitionBraceLayout:
925
+ Description: >-
926
+ Checks that the closing brace in a method definition is
927
+ either on the same line as the last method parameter, or
928
+ a new line.
929
+ Enabled: true
930
+ VersionAdded: '0.49'
931
+ EnforcedStyle: symmetrical
932
+ SupportedStyles:
933
+ # symmetrical: closing brace is positioned in same way as opening brace
934
+ # new_line: closing brace is always on a new line
935
+ # same_line: closing brace is always on the same line as last parameter
936
+ - symmetrical
937
+ - new_line
938
+ - same_line
939
+
940
+ Layout/MultilineOperationIndentation:
941
+ Description: >-
942
+ Checks indentation of binary operations that span more than
943
+ one line.
944
+ Enabled: true
945
+ VersionAdded: '0.49'
946
+ EnforcedStyle: aligned
947
+ SupportedStyles:
948
+ - aligned
949
+ - indented
950
+ # By default, the indentation width from `Layout/IndentationWidth` is used
951
+ # But it can be overridden by setting this parameter
952
+ IndentationWidth: ~
953
+
954
+ Layout/RescueEnsureAlignment:
955
+ Description: 'Align rescues and ensures correctly.'
956
+ Enabled: true
957
+ VersionAdded: '0.49'
958
+
959
+ Layout/SpaceAfterColon:
960
+ Description: 'Use spaces after colons.'
961
+ StyleGuide: '#spaces-operators'
962
+ Enabled: true
963
+ VersionAdded: '0.49'
964
+
965
+ Layout/SpaceAfterComma:
966
+ Description: 'Use spaces after commas.'
967
+ StyleGuide: '#spaces-operators'
968
+ Enabled: true
969
+ VersionAdded: '0.49'
970
+
971
+ Layout/SpaceAfterMethodName:
972
+ Description: >-
973
+ Do not put a space between a method name and the opening
974
+ parenthesis in a method definition.
975
+ StyleGuide: '#parens-no-spaces'
976
+ Enabled: true
977
+ VersionAdded: '0.49'
978
+
979
+ Layout/SpaceAfterNot:
980
+ Description: Tracks redundant space after the ! operator.
981
+ StyleGuide: '#no-space-bang'
982
+ Enabled: true
983
+ VersionAdded: '0.49'
984
+
985
+ Layout/SpaceAfterSemicolon:
986
+ Description: 'Use spaces after semicolons.'
987
+ StyleGuide: '#spaces-operators'
988
+ Enabled: true
989
+ VersionAdded: '0.49'
990
+
991
+ Layout/SpaceAroundBlockParameters:
992
+ Description: 'Checks the spacing inside and after block parameters pipes.'
993
+ Enabled: true
994
+ VersionAdded: '0.49'
995
+ EnforcedStyleInsidePipes: no_space
996
+ SupportedStylesInsidePipes:
997
+ - space
998
+ - no_space
999
+
1000
+ Layout/SpaceAroundEqualsInParameterDefault:
1001
+ Description: >-
1002
+ Checks that the equals signs in parameter default assignments
1003
+ have or don't have surrounding space depending on
1004
+ configuration.
1005
+ StyleGuide: '#spaces-around-equals'
1006
+ Enabled: true
1007
+ VersionAdded: '0.49'
1008
+ EnforcedStyle: space
1009
+ SupportedStyles:
1010
+ - space
1011
+ - no_space
1012
+
1013
+ Layout/SpaceAroundKeyword:
1014
+ Description: 'Use a space around keywords if appropriate.'
1015
+ Enabled: true
1016
+ VersionAdded: '0.49'
1017
+
1018
+ Layout/SpaceAroundOperators:
1019
+ Description: 'Use a single space around operators.'
1020
+ StyleGuide: '#spaces-operators'
1021
+ Enabled: true
1022
+ VersionAdded: '0.49'
1023
+ # When `true`, allows most uses of extra spacing if the intent is to align
1024
+ # with an operator on the previous or next line, not counting empty lines
1025
+ # or comment lines.
1026
+ AllowForAlignment: true
1027
+
1028
+ Layout/SpaceBeforeBlockBraces:
1029
+ Description: >-
1030
+ Checks that the left block brace has or doesn't have space
1031
+ before it.
1032
+ Enabled: true
1033
+ VersionAdded: '0.49'
1034
+ EnforcedStyle: space
1035
+ SupportedStyles:
1036
+ - space
1037
+ - no_space
1038
+ EnforcedStyleForEmptyBraces: space
1039
+ SupportedStylesForEmptyBraces:
1040
+ - space
1041
+ - no_space
1042
+ VersionChanged: '0.52.1'
1043
+
1044
+ Layout/SpaceBeforeComma:
1045
+ Description: 'No spaces before commas.'
1046
+ Enabled: true
1047
+ VersionAdded: '0.49'
1048
+
1049
+ Layout/SpaceBeforeComment:
1050
+ Description: >-
1051
+ Checks for missing space between code and a comment on the
1052
+ same line.
1053
+ Enabled: true
1054
+ VersionAdded: '0.49'
1055
+
1056
+ Layout/SpaceBeforeFirstArg:
1057
+ Description: >-
1058
+ Checks that exactly one space is used between a method name
1059
+ and the first argument for method calls without parentheses.
1060
+ Enabled: true
1061
+ VersionAdded: '0.49'
1062
+ # When `true`, allows most uses of extra spacing if the intent is to align
1063
+ # things with the previous or next line, not counting empty lines or comment
1064
+ # lines.
1065
+ AllowForAlignment: true
1066
+
1067
+ Layout/SpaceBeforeSemicolon:
1068
+ Description: 'No spaces before semicolons.'
1069
+ Enabled: true
1070
+ VersionAdded: '0.49'
1071
+
1072
+ Layout/SpaceInLambdaLiteral:
1073
+ Description: 'Checks for spaces in lambda literals.'
1074
+ Enabled: true
1075
+ VersionAdded: '0.49'
1076
+ EnforcedStyle: require_no_space
1077
+ SupportedStyles:
1078
+ - require_no_space
1079
+ - require_space
1080
+
1081
+ Layout/SpaceInsideArrayLiteralBrackets:
1082
+ Description: 'Checks the spacing inside array literal brackets.'
1083
+ Enabled: true
1084
+ VersionAdded: '0.52'
1085
+ EnforcedStyle: no_space
1086
+ SupportedStyles:
1087
+ - space
1088
+ - no_space
1089
+ # 'compact' normally requires a space inside the brackets, with the exception
1090
+ # that successive left brackets or right brackets are collapsed together
1091
+ - compact
1092
+ EnforcedStyleForEmptyBrackets: no_space
1093
+ SupportedStylesForEmptyBrackets:
1094
+ - space
1095
+ - no_space
1096
+
1097
+ Layout/SpaceInsideArrayPercentLiteral:
1098
+ Description: 'No unnecessary additional spaces between elements in %i/%w literals.'
1099
+ Enabled: true
1100
+ VersionAdded: '0.49'
1101
+
1102
+ Layout/SpaceInsideBlockBraces:
1103
+ Description: >-
1104
+ Checks that block braces have or don't have surrounding space.
1105
+ For blocks taking parameters, checks that the left brace has
1106
+ or doesn't have trailing space.
1107
+ Enabled: true
1108
+ VersionAdded: '0.49'
1109
+ EnforcedStyle: space
1110
+ SupportedStyles:
1111
+ - space
1112
+ - no_space
1113
+ EnforcedStyleForEmptyBraces: no_space
1114
+ SupportedStylesForEmptyBraces:
1115
+ - space
1116
+ - no_space
1117
+ # Space between `{` and `|`. Overrides `EnforcedStyle` if there is a conflict.
1118
+ SpaceBeforeBlockParameters: true
1119
+
1120
+ Layout/SpaceInsideHashLiteralBraces:
1121
+ Description: "Use spaces inside hash literal braces - or don't."
1122
+ StyleGuide: '#spaces-operators'
1123
+ Enabled: true
1124
+ VersionAdded: '0.49'
1125
+ EnforcedStyle: space
1126
+ SupportedStyles:
1127
+ - space
1128
+ - no_space
1129
+ # 'compact' normally requires a space inside hash braces, with the exception
1130
+ # that successive left braces or right braces are collapsed together
1131
+ - compact
1132
+ EnforcedStyleForEmptyBraces: no_space
1133
+ SupportedStylesForEmptyBraces:
1134
+ - space
1135
+ - no_space
1136
+
1137
+
1138
+ Layout/SpaceInsideParens:
1139
+ Description: 'No spaces after ( or before ).'
1140
+ StyleGuide: '#spaces-braces'
1141
+ Enabled: true
1142
+ VersionAdded: '0.49'
1143
+ VersionChanged: '0.55'
1144
+ EnforcedStyle: no_space
1145
+ SupportedStyles:
1146
+ - space
1147
+ - no_space
1148
+
1149
+ Layout/SpaceInsidePercentLiteralDelimiters:
1150
+ Description: 'No unnecessary spaces inside delimiters of %i/%w/%x literals.'
1151
+ Enabled: true
1152
+ VersionAdded: '0.49'
1153
+
1154
+ Layout/SpaceInsideRangeLiteral:
1155
+ Description: 'No spaces inside range literals.'
1156
+ StyleGuide: '#no-space-inside-range-literals'
1157
+ Enabled: true
1158
+ VersionAdded: '0.49'
1159
+
1160
+ Layout/SpaceInsideReferenceBrackets:
1161
+ Description: 'Checks the spacing inside referential brackets.'
1162
+ Enabled: true
1163
+ VersionAdded: '0.52'
1164
+ VersionChanged: '0.53'
1165
+ EnforcedStyle: no_space
1166
+ SupportedStyles:
1167
+ - space
1168
+ - no_space
1169
+ EnforcedStyleForEmptyBrackets: no_space
1170
+ SupportedStylesForEmptyBrackets:
1171
+ - space
1172
+ - no_space
1173
+
1174
+ Layout/SpaceInsideStringInterpolation:
1175
+ Description: 'Checks for padding/surrounding spaces inside string interpolation.'
1176
+ StyleGuide: '#string-interpolation'
1177
+ Enabled: true
1178
+ VersionAdded: '0.49'
1179
+ EnforcedStyle: no_space
1180
+ SupportedStyles:
1181
+ - space
1182
+ - no_space
1183
+
1184
+ Layout/Tab:
1185
+ Description: 'No hard tabs.'
1186
+ StyleGuide: '#spaces-indentation'
1187
+ Enabled: true
1188
+ VersionAdded: '0.49'
1189
+ VersionChanged: '0.51'
1190
+ # By default, the indentation width from Layout/IndentationWidth is used
1191
+ # But it can be overridden by setting this parameter
1192
+ # It is used during auto-correction to determine how many spaces should
1193
+ # replace each tab.
1194
+ IndentationWidth: ~
1195
+
1196
+ Layout/TrailingBlankLines:
1197
+ Description: 'Checks trailing blank lines and final newline.'
1198
+ StyleGuide: '#newline-eof'
1199
+ Enabled: true
1200
+ VersionAdded: '0.49'
1201
+ EnforcedStyle: final_newline
1202
+ SupportedStyles:
1203
+ - final_newline
1204
+ - final_blank_line
1205
+
1206
+ Layout/TrailingWhitespace:
1207
+ Description: 'Avoid trailing whitespace.'
1208
+ StyleGuide: '#no-trailing-whitespace'
1209
+ Enabled: true
1210
+ VersionAdded: '0.49'
1211
+ VersionChanged: '0.55'
1212
+ AllowInHeredoc: false
1213
+
1214
+ #################### Lint ##################################
1215
+ ### Warnings
1216
+
1217
+ Lint/AmbiguousBlockAssociation:
1218
+ Description: >-
1219
+ Checks for ambiguous block association with method when param passed without
1220
+ parentheses.
1221
+ StyleGuide: '#syntax'
1222
+ Enabled: true
1223
+ VersionAdded: '0.48'
1224
+
1225
+ Lint/AmbiguousOperator:
1226
+ Description: >-
1227
+ Checks for ambiguous operators in the first argument of a
1228
+ method invocation without parentheses.
1229
+ StyleGuide: '#method-invocation-parens'
1230
+ Enabled: true
1231
+ VersionAdded: '0.17'
1232
+
1233
+ Lint/AmbiguousRegexpLiteral:
1234
+ Description: >-
1235
+ Checks for ambiguous regexp literals in the first argument of
1236
+ a method invocation without parentheses.
1237
+ Enabled: true
1238
+ VersionAdded: '0.17'
1239
+
1240
+ Lint/AssignmentInCondition:
1241
+ Description: "Don't use assignment in conditions."
1242
+ StyleGuide: '#safe-assignment-in-condition'
1243
+ Enabled: true
1244
+ VersionAdded: '0.9'
1245
+ AllowSafeAssignment: true
1246
+
1247
+ Lint/BigDecimalNew:
1248
+ Description: '`BigDecimal.new()` is deprecated. Use `BigDecimal()` instead.'
1249
+ Enabled: true
1250
+ VersionAdded: '0.53'
1251
+
1252
+ Lint/BooleanSymbol:
1253
+ Description: 'Check for `:true` and `:false` symbols.'
1254
+ Enabled: true
1255
+ VersionAdded: '0.50'
1256
+
1257
+ Lint/CircularArgumentReference:
1258
+ Description: "Default values in optional keyword arguments and optional ordinal arguments should not refer back to the name of the argument."
1259
+ Enabled: true
1260
+ VersionAdded: '0.33'
1261
+
1262
+ Lint/Debugger:
1263
+ Description: 'Check for debugger calls.'
1264
+ Enabled: true
1265
+ VersionAdded: '0.14'
1266
+ VersionChanged: '0.49'
1267
+
1268
+ Lint/DeprecatedClassMethods:
1269
+ Description: 'Check for deprecated class method calls.'
1270
+ Enabled: true
1271
+ VersionAdded: '0.19'
1272
+
1273
+ Lint/DisjunctiveAssignmentInConstructor:
1274
+ Description: 'In constructor, plain assignment is preferred over disjunctive.'
1275
+ Enabled: true
1276
+ Safe: false
1277
+ VersionAdded: '0.62'
1278
+
1279
+ Lint/DuplicateCaseCondition:
1280
+ Description: 'Do not repeat values in case conditionals.'
1281
+ Enabled: true
1282
+ VersionAdded: '0.45'
1283
+
1284
+ Lint/DuplicateMethods:
1285
+ Description: 'Check for duplicate method definitions.'
1286
+ Enabled: true
1287
+ VersionAdded: '0.29'
1288
+
1289
+ Lint/DuplicatedKey:
1290
+ Description: 'Check for duplicate keys in hash literals.'
1291
+ Enabled: true
1292
+ VersionAdded: '0.34'
1293
+
1294
+ Lint/EachWithObjectArgument:
1295
+ Description: 'Check for immutable argument given to each_with_object.'
1296
+ Enabled: true
1297
+ VersionAdded: '0.31'
1298
+
1299
+ Lint/ElseLayout:
1300
+ Description: 'Check for odd code arrangement in an else block.'
1301
+ Enabled: true
1302
+ VersionAdded: '0.17'
1303
+
1304
+ Lint/EmptyEnsure:
1305
+ Description: 'Checks for empty ensure block.'
1306
+ Enabled: true
1307
+ VersionAdded: '0.10'
1308
+ VersionChanged: '0.48'
1309
+ AutoCorrect: false
1310
+
1311
+ Lint/EmptyExpression:
1312
+ Description: 'Checks for empty expressions.'
1313
+ Enabled: true
1314
+ VersionAdded: '0.45'
1315
+
1316
+ Lint/EmptyInterpolation:
1317
+ Description: 'Checks for empty string interpolation.'
1318
+ Enabled: true
1319
+ VersionAdded: '0.20'
1320
+ VersionChanged: '0.45'
1321
+
1322
+ Lint/EmptyWhen:
1323
+ Description: 'Checks for `when` branches with empty bodies.'
1324
+ Enabled: true
1325
+ VersionAdded: '0.45'
1326
+
1327
+ Lint/EndInMethod:
1328
+ Description: 'END blocks should not be placed inside method definitions.'
1329
+ Enabled: true
1330
+ VersionAdded: '0.9'
1331
+
1332
+ Lint/EnsureReturn:
1333
+ Description: 'Do not use return in an ensure block.'
1334
+ StyleGuide: '#no-return-ensure'
1335
+ Enabled: true
1336
+ VersionAdded: '0.9'
1337
+
1338
+ Lint/ErbNewArguments:
1339
+ Description: 'Use `:trim_mode` and `:eoutvar` keyword arguments to `ERB.new`.'
1340
+ Enabled: true
1341
+ VersionAdded: '0.56'
1342
+
1343
+ Lint/FlipFlop:
1344
+ Description: 'Checks for flip-flops'
1345
+ StyleGuide: '#no-flip-flops'
1346
+ Enabled: true
1347
+ VersionAdded: '0.16'
1348
+
1349
+ Lint/FloatOutOfRange:
1350
+ Description: >-
1351
+ Catches floating-point literals too large or small for Ruby to
1352
+ represent.
1353
+ Enabled: true
1354
+ VersionAdded: '0.36'
1355
+
1356
+ Lint/FormatParameterMismatch:
1357
+ Description: 'The number of parameters to format/sprint must match the fields.'
1358
+ Enabled: true
1359
+ VersionAdded: '0.33'
1360
+
1361
+ Lint/HandleExceptions:
1362
+ Description: "Don't suppress exception."
1363
+ StyleGuide: '#dont-hide-exceptions'
1364
+ Enabled: true
1365
+ VersionAdded: '0.9'
1366
+
1367
+ Lint/HeredocMethodCallPosition:
1368
+ Description: >-
1369
+ Checks for the ordering of a method call where
1370
+ the receiver of the call is a HEREDOC.
1371
+ Enabled: false
1372
+ StyleGuide: '#heredoc-method-calls'
1373
+ VersionAdded: '0.68'
1374
+
1375
+ Lint/ImplicitStringConcatenation:
1376
+ Description: >-
1377
+ Checks for adjacent string literals on the same line, which
1378
+ could better be represented as a single string literal.
1379
+ Enabled: true
1380
+ VersionAdded: '0.36'
1381
+
1382
+ Lint/IneffectiveAccessModifier:
1383
+ Description: >-
1384
+ Checks for attempts to use `private` or `protected` to set
1385
+ the visibility of a class method, which does not work.
1386
+ Enabled: true
1387
+ VersionAdded: '0.36'
1388
+
1389
+ Lint/InheritException:
1390
+ Description: 'Avoid inheriting from the `Exception` class.'
1391
+ Enabled: true
1392
+ VersionAdded: '0.41'
1393
+ # The default base class in favour of `Exception`.
1394
+ EnforcedStyle: runtime_error
1395
+ SupportedStyles:
1396
+ - runtime_error
1397
+ - standard_error
1398
+
1399
+ Lint/InterpolationCheck:
1400
+ Description: 'Raise warning for interpolation in single q strs'
1401
+ Enabled: true
1402
+ VersionAdded: '0.50'
1403
+
1404
+ Lint/LiteralAsCondition:
1405
+ Description: 'Checks of literals used in conditions.'
1406
+ Enabled: true
1407
+ VersionAdded: '0.51'
1408
+
1409
+ Lint/LiteralInInterpolation:
1410
+ Description: 'Checks for literals used in interpolation.'
1411
+ Enabled: true
1412
+ VersionAdded: '0.19'
1413
+ VersionChanged: '0.32'
1414
+
1415
+ Lint/Loop:
1416
+ Description: >-
1417
+ Use Kernel#loop with break rather than begin/end/until or
1418
+ begin/end/while for post-loop tests.
1419
+ StyleGuide: '#loop-with-break'
1420
+ Enabled: true
1421
+ VersionAdded: '0.9'
1422
+
1423
+ Lint/MissingCopEnableDirective:
1424
+ Description: 'Checks for a `# rubocop:enable` after `# rubocop:disable`'
1425
+ Enabled: true
1426
+ VersionAdded: '0.52'
1427
+ # Maximum number of consecutive lines the cop can be disabled for.
1428
+ # 0 allows only single-line disables
1429
+ # 1 would mean the maximum allowed is the following:
1430
+ # # rubocop:disable SomeCop
1431
+ # a = 1
1432
+ # # rubocop:enable SomeCop
1433
+ # .inf for any size
1434
+ MaximumRangeSize: .inf
1435
+
1436
+ Lint/MultipleCompare:
1437
+ Description: "Use `&&` operator to compare multiple value."
1438
+ Enabled: true
1439
+ VersionAdded: '0.47'
1440
+
1441
+ Lint/NestedMethodDefinition:
1442
+ Description: 'Do not use nested method definitions.'
1443
+ StyleGuide: '#no-nested-methods'
1444
+ Enabled: true
1445
+ VersionAdded: '0.32'
1446
+
1447
+ Lint/NestedPercentLiteral:
1448
+ Description: 'Checks for nested percent literals.'
1449
+ Enabled: true
1450
+ VersionAdded: '0.52'
1451
+
1452
+ Lint/NextWithoutAccumulator:
1453
+ Description: >-
1454
+ Do not omit the accumulator when calling `next`
1455
+ in a `reduce`/`inject` block.
1456
+ Enabled: true
1457
+ VersionAdded: '0.36'
1458
+
1459
+ Lint/NonLocalExitFromIterator:
1460
+ Description: 'Do not use return in iterator to cause non-local exit.'
1461
+ Enabled: true
1462
+ VersionAdded: '0.30'
1463
+
1464
+ Lint/NumberConversion:
1465
+ Description: 'Checks unsafe usage of number conversion methods.'
1466
+ Enabled: false
1467
+ VersionAdded: '0.53'
1468
+
1469
+ Lint/OrderedMagicComments:
1470
+ Description: 'Checks the proper ordering of magic comments and whether a magic comment is not placed before a shebang.'
1471
+ Enabled: true
1472
+ VersionAdded: '0.53'
1473
+
1474
+ Lint/ParenthesesAsGroupedExpression:
1475
+ Description: >-
1476
+ Checks for method calls with a space before the opening
1477
+ parenthesis.
1478
+ StyleGuide: '#parens-no-spaces'
1479
+ Enabled: true
1480
+ VersionAdded: '0.12'
1481
+
1482
+ Lint/PercentStringArray:
1483
+ Description: >-
1484
+ Checks for unwanted commas and quotes in %w/%W literals.
1485
+ Enabled: true
1486
+ VersionAdded: '0.41'
1487
+
1488
+ Lint/PercentSymbolArray:
1489
+ Description: >-
1490
+ Checks for unwanted commas and colons in %i/%I literals.
1491
+ Enabled: true
1492
+ VersionAdded: '0.41'
1493
+
1494
+ Lint/RandOne:
1495
+ Description: >-
1496
+ Checks for `rand(1)` calls. Such calls always return `0`
1497
+ and most likely a mistake.
1498
+ Enabled: true
1499
+ VersionAdded: '0.36'
1500
+
1501
+ Lint/RedundantWithIndex:
1502
+ Description: 'Checks for redundant `with_index`.'
1503
+ Enabled: true
1504
+ VersionAdded: '0.50'
1505
+
1506
+ Lint/RedundantWithObject:
1507
+ Description: 'Checks for redundant `with_object`.'
1508
+ Enabled: true
1509
+ VersionAdded: '0.51'
1510
+
1511
+ Lint/RegexpAsCondition:
1512
+ Description: >-
1513
+ Do not use regexp literal as a condition.
1514
+ The regexp literal matches `$_` implicitly.
1515
+ Enabled: true
1516
+ VersionAdded: '0.51'
1517
+
1518
+ Lint/RequireParentheses:
1519
+ Description: >-
1520
+ Use parentheses in the method call to avoid confusion
1521
+ about precedence.
1522
+ Enabled: true
1523
+ VersionAdded: '0.18'
1524
+
1525
+ Lint/RescueException:
1526
+ Description: 'Avoid rescuing the Exception class.'
1527
+ StyleGuide: '#no-blind-rescues'
1528
+ Enabled: true
1529
+ VersionAdded: '0.9'
1530
+ VersionChanged: '0.27.1'
1531
+
1532
+ Lint/RescueType:
1533
+ Description: 'Avoid rescuing from non constants that could result in a `TypeError`.'
1534
+ Enabled: true
1535
+ VersionAdded: '0.49'
1536
+
1537
+ Lint/ReturnInVoidContext:
1538
+ Description: 'Checks for return in void context.'
1539
+ Enabled: true
1540
+ VersionAdded: '0.50'
1541
+
1542
+ Lint/SafeNavigationChain:
1543
+ Description: 'Do not chain ordinary method call after safe navigation operator.'
1544
+ Enabled: true
1545
+ VersionAdded: '0.47'
1546
+ VersionChanged: '0.56'
1547
+ Whitelist:
1548
+ - present?
1549
+ - blank?
1550
+ - presence
1551
+ - try
1552
+ - try!
1553
+
1554
+ Lint/SafeNavigationConsistency:
1555
+ Description: >-
1556
+ Check to make sure that if safe navigation is used for a method
1557
+ call in an `&&` or `||` condition that safe navigation is used
1558
+ for all method calls on that same object.
1559
+ Enabled: true
1560
+ VersionAdded: '0.55'
1561
+ Whitelist:
1562
+ - present?
1563
+ - blank?
1564
+ - presence
1565
+ - try
1566
+ - try!
1567
+
1568
+
1569
+ Lint/SafeNavigationWithEmpty:
1570
+ Description: 'Avoid `foo&.empty?` in conditionals.'
1571
+ Enabled: true
1572
+ VersionAdded: '0.62'
1573
+
1574
+ Lint/ScriptPermission:
1575
+ Description: 'Grant script file execute permission.'
1576
+ Enabled: true
1577
+ VersionAdded: '0.49'
1578
+ VersionChanged: '0.50'
1579
+
1580
+ Lint/ShadowedArgument:
1581
+ Description: 'Avoid reassigning arguments before they were used.'
1582
+ Enabled: true
1583
+ VersionAdded: '0.52'
1584
+ IgnoreImplicitReferences: false
1585
+
1586
+
1587
+ Lint/ShadowedException:
1588
+ Description: >-
1589
+ Avoid rescuing a higher level exception
1590
+ before a lower level exception.
1591
+ Enabled: true
1592
+ VersionAdded: '0.41'
1593
+
1594
+ Lint/ShadowingOuterLocalVariable:
1595
+ Description: >-
1596
+ Do not use the same name as outer local variable
1597
+ for block arguments or block local variables.
1598
+ Enabled: true
1599
+ VersionAdded: '0.9'
1600
+
1601
+ Lint/StringConversionInInterpolation:
1602
+ Description: 'Checks for Object#to_s usage in string interpolation.'
1603
+ StyleGuide: '#no-to-s'
1604
+ Enabled: true
1605
+ VersionAdded: '0.19'
1606
+ VersionChanged: '0.20'
1607
+
1608
+ Lint/Syntax:
1609
+ Description: 'Checks syntax error'
1610
+ Enabled: true
1611
+ VersionAdded: '0.9'
1612
+
1613
+
1614
+ Lint/ToJSON:
1615
+ Description: 'Ensure #to_json includes an optional argument.'
1616
+ Enabled: true
1617
+
1618
+ Lint/UnderscorePrefixedVariableName:
1619
+ Description: 'Do not use prefix `_` for a variable that is used.'
1620
+ Enabled: true
1621
+ VersionAdded: '0.21'
1622
+ AllowKeywordBlockArguments: false
1623
+
1624
+ Lint/UnifiedInteger:
1625
+ Description: 'Use Integer instead of Fixnum or Bignum'
1626
+ Enabled: true
1627
+ VersionAdded: '0.43'
1628
+
1629
+ Lint/UnneededCopDisableDirective:
1630
+ Description: >-
1631
+ Checks for rubocop:disable comments that can be removed.
1632
+ Note: this cop is not disabled when disabling all cops.
1633
+ It must be explicitly disabled.
1634
+ Enabled: true
1635
+ VersionAdded: '0.53'
1636
+
1637
+ Lint/UnneededCopEnableDirective:
1638
+ Description: Checks for rubocop:enable comments that can be removed.
1639
+ Enabled: true
1640
+ VersionAdded: '0.53'
1641
+
1642
+ Lint/UnneededRequireStatement:
1643
+ Description: 'Checks for unnecessary `require` statement.'
1644
+ Enabled: true
1645
+ VersionAdded: '0.51'
1646
+
1647
+ Lint/UnneededSplatExpansion:
1648
+ Description: 'Checks for splat unnecessarily being called on literals'
1649
+ Enabled: true
1650
+ VersionAdded: '0.43'
1651
+
1652
+ Lint/UnreachableCode:
1653
+ Description: 'Unreachable code.'
1654
+ Enabled: true
1655
+ VersionAdded: '0.9'
1656
+
1657
+ Lint/UnusedBlockArgument:
1658
+ Description: 'Checks for unused block arguments.'
1659
+ StyleGuide: '#underscore-unused-vars'
1660
+ Enabled: true
1661
+ VersionAdded: '0.21'
1662
+ VersionChanged: '0.22'
1663
+ IgnoreEmptyBlocks: true
1664
+ AllowUnusedKeywordArguments: false
1665
+
1666
+ Lint/UnusedMethodArgument:
1667
+ Description: 'Checks for unused method arguments.'
1668
+ StyleGuide: '#underscore-unused-vars'
1669
+ Enabled: true
1670
+ VersionAdded: '0.21'
1671
+ VersionChanged: '0.35'
1672
+ AllowUnusedKeywordArguments: false
1673
+ IgnoreEmptyMethods: true
1674
+
1675
+ Lint/UriEscapeUnescape:
1676
+ Description: >-
1677
+ `URI.escape` method is obsolete and should not be used. Instead, use
1678
+ `CGI.escape`, `URI.encode_www_form` or `URI.encode_www_form_component`
1679
+ depending on your specific use case.
1680
+ Also `URI.unescape` method is obsolete and should not be used. Instead, use
1681
+ `CGI.unescape`, `URI.decode_www_form` or `URI.decode_www_form_component`
1682
+ depending on your specific use case.
1683
+ Enabled: true
1684
+ VersionAdded: '0.50'
1685
+
1686
+ Lint/UriRegexp:
1687
+ Description: 'Use `URI::DEFAULT_PARSER.make_regexp` instead of `URI.regexp`.'
1688
+ Enabled: true
1689
+ VersionAdded: '0.50'
1690
+
1691
+ Lint/UselessAccessModifier:
1692
+ Description: 'Checks for useless access modifiers.'
1693
+ Enabled: true
1694
+ VersionAdded: '0.20'
1695
+ VersionChanged: '0.47'
1696
+ ContextCreatingMethods: []
1697
+ MethodCreatingMethods: []
1698
+
1699
+ Lint/UselessAssignment:
1700
+ Description: 'Checks for useless assignment to a local variable.'
1701
+ StyleGuide: '#underscore-unused-vars'
1702
+ Enabled: true
1703
+ VersionAdded: '0.11'
1704
+
1705
+ Lint/UselessComparison:
1706
+ Description: 'Checks for comparison of something with itself.'
1707
+ Enabled: true
1708
+ VersionAdded: '0.11'
1709
+
1710
+ Lint/UselessElseWithoutRescue:
1711
+ Description: 'Checks for useless `else` in `begin..end` without `rescue`.'
1712
+ Enabled: true
1713
+ VersionAdded: '0.17'
1714
+
1715
+ Lint/UselessSetterCall:
1716
+ Description: 'Checks for useless setter call to a local variable.'
1717
+ Enabled: true
1718
+ VersionAdded: '0.13'
1719
+
1720
+ Lint/Void:
1721
+ Description: 'Possible use of operator/literal/variable in void context.'
1722
+ Enabled: true
1723
+ VersionAdded: '0.9'
1724
+ CheckForMethodsWithNoSideEffects: false
1725
+
1726
+ #################### Metrics ###############################
1727
+
1728
+ Metrics/AbcSize:
1729
+ Description: >-
1730
+ A calculated magnitude based on number of assignments,
1731
+ branches, and conditions.
1732
+ Reference:
1733
+ - http://c2.com/cgi/wiki?AbcMetric
1734
+ - https://en.wikipedia.org/wiki/ABC_Software_Metric'
1735
+ Enabled: true
1736
+ VersionAdded: '0.27'
1737
+ VersionChanged: '0.66'
1738
+ # The ABC size is a calculated magnitude, so this number can be an Integer or
1739
+ # a Float.
1740
+ Max: 15
1741
+
1742
+ Metrics/BlockLength:
1743
+ Description: 'Avoid long blocks with many lines.'
1744
+ Enabled: true
1745
+ VersionAdded: '0.44'
1746
+ VersionChanged: '0.66'
1747
+ CountComments: false # count full line comments?
1748
+ Max: 25
1749
+ ExcludedMethods:
1750
+ # By default, exclude the `#refine` method, as it tends to have larger
1751
+ # associated blocks.
1752
+ - refine
1753
+ Exclude:
1754
+ - '**/*.gemspec'
1755
+
1756
+ Metrics/BlockNesting:
1757
+ Description: 'Avoid excessive block nesting'
1758
+ StyleGuide: '#three-is-the-number-thou-shalt-count'
1759
+ Enabled: true
1760
+ VersionAdded: '0.25'
1761
+ VersionChanged: '0.47'
1762
+ CountBlocks: false
1763
+ Max: 3
1764
+
1765
+ Metrics/ClassLength:
1766
+ Description: 'Avoid classes longer than 100 lines of code.'
1767
+ Enabled: true
1768
+ VersionAdded: '0.25'
1769
+ CountComments: false # count full line comments?
1770
+ Max: 100
1771
+
1772
+ # Avoid complex methods.
1773
+ Metrics/CyclomaticComplexity:
1774
+ Description: >-
1775
+ A complexity metric that is strongly correlated to the number
1776
+ of test cases needed to validate a method.
1777
+ Enabled: true
1778
+ VersionAdded: '0.25'
1779
+ Max: 6
1780
+
1781
+ Metrics/LineLength:
1782
+ Description: 'Limit lines to 80 characters.'
1783
+ StyleGuide: '#80-character-limits'
1784
+ Enabled: true
1785
+ VersionAdded: '0.25'
1786
+ VersionChanged: '0.68'
1787
+ AutoCorrect: false
1788
+ Max: 80
1789
+ # To make it possible to copy or click on URIs in the code, we allow lines
1790
+ # containing a URI to be longer than Max.
1791
+ AllowHeredoc: true
1792
+ AllowURI: true
1793
+ URISchemes:
1794
+ - http
1795
+ - https
1796
+ # The IgnoreCopDirectives option causes the LineLength rule to ignore cop
1797
+ # directives like '# rubocop: enable ...' when calculating a line's length.
1798
+ IgnoreCopDirectives: false
1799
+ # The IgnoredPatterns option is a list of !ruby/regexp and/or string
1800
+ # elements. Strings will be converted to Regexp objects. A line that matches
1801
+ # any regular expression listed in this option will be ignored by LineLength.
1802
+ IgnoredPatterns: []
1803
+
1804
+ Metrics/MethodLength:
1805
+ Description: 'Avoid methods longer than 10 lines of code.'
1806
+ StyleGuide: '#short-methods'
1807
+ Enabled: true
1808
+ VersionAdded: '0.25'
1809
+ VersionChanged: '0.59.2'
1810
+ CountComments: false # count full line comments?
1811
+ Max: 10
1812
+ ExcludedMethods: []
1813
+
1814
+ Metrics/ModuleLength:
1815
+ Description: 'Avoid modules longer than 100 lines of code.'
1816
+ Enabled: true
1817
+ VersionAdded: '0.31'
1818
+ CountComments: false # count full line comments?
1819
+ Max: 100
1820
+
1821
+ Metrics/ParameterLists:
1822
+ Description: 'Avoid parameter lists longer than three or four parameters.'
1823
+ StyleGuide: '#too-many-params'
1824
+ Enabled: true
1825
+ VersionAdded: '0.25'
1826
+ Max: 5
1827
+ CountKeywordArgs: true
1828
+
1829
+ Metrics/PerceivedComplexity:
1830
+ Description: >-
1831
+ A complexity metric geared towards measuring complexity for a
1832
+ human reader.
1833
+ Enabled: true
1834
+ VersionAdded: '0.25'
1835
+ Max: 7
1836
+
1837
+ #################### Naming ##############################
1838
+
1839
+ Naming/AccessorMethodName:
1840
+ Description: Check the naming of accessor methods for get_/set_.
1841
+ StyleGuide: '#accessor_mutator_method_names'
1842
+ Enabled: true
1843
+ VersionAdded: '0.50'
1844
+
1845
+ Naming/AsciiIdentifiers:
1846
+ Description: 'Use only ascii symbols in identifiers.'
1847
+ StyleGuide: '#english-identifiers'
1848
+ Enabled: true
1849
+ VersionAdded: '0.50'
1850
+
1851
+ Naming/BinaryOperatorParameterName:
1852
+ Description: 'When defining binary operators, name the argument other.'
1853
+ StyleGuide: '#other-arg'
1854
+ Enabled: true
1855
+ VersionAdded: '0.50'
1856
+
1857
+ Naming/ClassAndModuleCamelCase:
1858
+ Description: 'Use CamelCase for classes and modules.'
1859
+ StyleGuide: '#camelcase-classes'
1860
+ Enabled: true
1861
+ VersionAdded: '0.50'
1862
+
1863
+ Naming/ConstantName:
1864
+ Description: 'Constants should use SCREAMING_SNAKE_CASE.'
1865
+ StyleGuide: '#screaming-snake-case'
1866
+ Enabled: true
1867
+ VersionAdded: '0.50'
1868
+
1869
+ Naming/FileName:
1870
+ Description: 'Use snake_case for source file names.'
1871
+ StyleGuide: '#snake-case-files'
1872
+ Enabled: true
1873
+ VersionAdded: '0.50'
1874
+ # Camel case file names listed in `AllCops:Include` and all file names listed
1875
+ # in `AllCops:Exclude` are excluded by default. Add extra excludes here.
1876
+ Exclude: []
1877
+ # When `true`, requires that each source file should define a class or module
1878
+ # with a name which matches the file name (converted to ... case).
1879
+ # It further expects it to be nested inside modules which match the names
1880
+ # of subdirectories in its path.
1881
+ ExpectMatchingDefinition: false
1882
+ # If non-`nil`, expect all source file names to match the following regex.
1883
+ # Only the file name itself is matched, not the entire file path.
1884
+ # Use anchors as necessary if you want to match the entire name rather than
1885
+ # just a part of it.
1886
+ Regex: ~
1887
+ # With `IgnoreExecutableScripts` set to `true`, this cop does not
1888
+ # report offending filenames for executable scripts (i.e. source
1889
+ # files with a shebang in the first line).
1890
+ IgnoreExecutableScripts: true
1891
+ AllowedAcronyms:
1892
+ - CLI
1893
+ - DSL
1894
+ - ACL
1895
+ - API
1896
+ - ASCII
1897
+ - CPU
1898
+ - CSS
1899
+ - DNS
1900
+ - EOF
1901
+ - GUID
1902
+ - HTML
1903
+ - HTTP
1904
+ - HTTPS
1905
+ - ID
1906
+ - IP
1907
+ - JSON
1908
+ - LHS
1909
+ - QPS
1910
+ - RAM
1911
+ - RHS
1912
+ - RPC
1913
+ - SLA
1914
+ - SMTP
1915
+ - SQL
1916
+ - SSH
1917
+ - TCP
1918
+ - TLS
1919
+ - TTL
1920
+ - UDP
1921
+ - UI
1922
+ - UID
1923
+ - UUID
1924
+ - URI
1925
+ - URL
1926
+ - UTF8
1927
+ - VM
1928
+ - XML
1929
+ - XMPP
1930
+ - XSRF
1931
+ - XSS
1932
+
1933
+ Naming/HeredocDelimiterCase:
1934
+ Description: 'Use configured case for heredoc delimiters.'
1935
+ StyleGuide: '#heredoc-delimiters'
1936
+ Enabled: true
1937
+ VersionAdded: '0.50'
1938
+ EnforcedStyle: uppercase
1939
+ SupportedStyles:
1940
+ - lowercase
1941
+ - uppercase
1942
+
1943
+ Naming/HeredocDelimiterNaming:
1944
+ Description: 'Use descriptive heredoc delimiters.'
1945
+ StyleGuide: '#heredoc-delimiters'
1946
+ Enabled: true
1947
+ VersionAdded: '0.50'
1948
+ Blacklist:
1949
+ - !ruby/regexp '/(^|\s)(EO[A-Z]{1}|END)(\s|$)/'
1950
+
1951
+ Naming/MemoizedInstanceVariableName:
1952
+ Description: >-
1953
+ Memoized method name should match memo instance variable name.
1954
+ Enabled: true
1955
+ VersionAdded: '0.53'
1956
+ VersionChanged: '0.58'
1957
+ EnforcedStyleForLeadingUnderscores: disallowed
1958
+ SupportedStylesForLeadingUnderscores:
1959
+ - disallowed
1960
+ - required
1961
+ - optional
1962
+
1963
+ Naming/MethodName:
1964
+ Description: 'Use the configured style when naming methods.'
1965
+ StyleGuide: '#snake-case-symbols-methods-vars'
1966
+ Enabled: true
1967
+ VersionAdded: '0.50'
1968
+ EnforcedStyle: snake_case
1969
+ SupportedStyles:
1970
+ - snake_case
1971
+ - camelCase
1972
+
1973
+ Naming/PredicateName:
1974
+ Description: 'Check the names of predicate methods.'
1975
+ StyleGuide: '#bool-methods-qmark'
1976
+ Enabled: true
1977
+ VersionAdded: '0.50'
1978
+ VersionChanged: '0.51'
1979
+ # Predicate name prefixes.
1980
+ NamePrefix:
1981
+ - is_
1982
+ - has_
1983
+ - have_
1984
+ # Predicate name prefixes that should be removed.
1985
+ NamePrefixBlacklist:
1986
+ - is_
1987
+ - has_
1988
+ - have_
1989
+ # Predicate names which, despite having a blacklisted prefix, or no `?`,
1990
+ # should still be accepted
1991
+ NameWhitelist:
1992
+ - is_a?
1993
+ # Method definition macros for dynamically generated methods.
1994
+ MethodDefinitionMacros:
1995
+ - define_method
1996
+ - define_singleton_method
1997
+ # Exclude Rspec specs because there is a strong convention to write spec
1998
+ # helpers in the form of `have_something` or `be_something`.
1999
+ Exclude:
2000
+ - 'spec/**/*'
2001
+
2002
+ Naming/RescuedExceptionsVariableName:
2003
+ Description: 'Use consistent rescued exceptions variables naming.'
2004
+ Enabled: true
2005
+ VersionAdded: '0.67'
2006
+ VersionChanged: '0.68'
2007
+ PreferredName: e
2008
+
2009
+ Naming/UncommunicativeBlockParamName:
2010
+ Description: >-
2011
+ Checks for block parameter names that contain capital letters,
2012
+ end in numbers, or do not meet a minimal length.
2013
+ Enabled: true
2014
+ VersionAdded: '0.53'
2015
+ # Parameter names may be equal to or greater than this value
2016
+ MinNameLength: 1
2017
+ AllowNamesEndingInNumbers: true
2018
+ # Whitelisted names that will not register an offense
2019
+ AllowedNames: []
2020
+ # Blacklisted names that will register an offense
2021
+ ForbiddenNames: []
2022
+
2023
+ Naming/UncommunicativeMethodParamName:
2024
+ Description: >-
2025
+ Checks for method parameter names that contain capital letters,
2026
+ end in numbers, or do not meet a minimal length.
2027
+ Enabled: true
2028
+ VersionAdded: '0.53'
2029
+ VersionChanged: '0.59'
2030
+ # Parameter names may be equal to or greater than this value
2031
+ MinNameLength: 3
2032
+ AllowNamesEndingInNumbers: true
2033
+ # Whitelisted names that will not register an offense
2034
+ AllowedNames:
2035
+ - io
2036
+ - id
2037
+ - to
2038
+ - by
2039
+ - 'on'
2040
+ - in
2041
+ - at
2042
+ - ip
2043
+ - db
2044
+ # Blacklisted names that will register an offense
2045
+ ForbiddenNames: []
2046
+
2047
+
2048
+ Naming/VariableName:
2049
+ Description: 'Use the configured style when naming variables.'
2050
+ StyleGuide: '#snake-case-symbols-methods-vars'
2051
+ Enabled: true
2052
+ VersionAdded: '0.50'
2053
+ EnforcedStyle: snake_case
2054
+ SupportedStyles:
2055
+ - snake_case
2056
+ - camelCase
2057
+
2058
+ Naming/VariableNumber:
2059
+ Description: 'Use the configured style when numbering variables.'
2060
+ Enabled: true
2061
+ VersionAdded: '0.50'
2062
+ EnforcedStyle: normalcase
2063
+ SupportedStyles:
2064
+ - snake_case
2065
+ - normalcase
2066
+ - non_integer
2067
+
2068
+ #################### Rails #################################
2069
+
2070
+ # By default, the rails cops are not run. Override in project or home
2071
+ # directory .rubocop.yml files, or by giving the -R/--rails option.
2072
+ Rails:
2073
+ Enabled: false
2074
+
2075
+ Rails/ActionFilter:
2076
+ Description: 'Enforces consistent use of action filter methods.'
2077
+ Enabled: true
2078
+ VersionAdded: '0.19'
2079
+ EnforcedStyle: action
2080
+ SupportedStyles:
2081
+ - action
2082
+ - filter
2083
+ Include:
2084
+ - app/controllers/**/*.rb
2085
+
2086
+ Rails/ActiveRecordAliases:
2087
+ Description: >-
2088
+ Avoid Active Record aliases:
2089
+ Use `update` instead of `update_attributes`.
2090
+ Use `update!` instead of `update_attributes!`.
2091
+ Enabled: true
2092
+ VersionAdded: '0.53'
2093
+
2094
+ Rails/ActiveRecordOverride:
2095
+ Description: >-
2096
+ Check for overriding Active Record methods instead of using
2097
+ callbacks.
2098
+ Enabled: true
2099
+ VersionAdded: '0.67'
2100
+ Include:
2101
+ - app/models/**/*.rb
2102
+
2103
+ Rails/ActiveSupportAliases:
2104
+ Description: >-
2105
+ Avoid ActiveSupport aliases of standard ruby methods:
2106
+ `String#starts_with?`, `String#ends_with?`,
2107
+ `Array#append`, `Array#prepend`.
2108
+ Enabled: true
2109
+ VersionAdded: '0.48'
2110
+
2111
+ Rails/ApplicationJob:
2112
+ Description: 'Check that jobs subclass ApplicationJob.'
2113
+ Enabled: true
2114
+ VersionAdded: '0.49'
2115
+
2116
+ Rails/ApplicationRecord:
2117
+ Description: 'Check that models subclass ApplicationRecord.'
2118
+ Enabled: true
2119
+ VersionAdded: '0.49'
2120
+
2121
+ Rails/AssertNot:
2122
+ Description: 'Use `assert_not` instead of `assert !`.'
2123
+ Enabled: true
2124
+ VersionAdded: '0.56'
2125
+ Include:
2126
+ - '**/test/**/*'
2127
+
2128
+ Rails/BelongsTo:
2129
+ Description: >-
2130
+ Use `optional: true` instead of `required: false` for
2131
+ `belongs_to` relations'
2132
+ Enabled: true
2133
+ VersionAdded: '0.62'
2134
+
2135
+ Rails/Blank:
2136
+ Description: 'Enforces use of `blank?`.'
2137
+ Enabled: true
2138
+ VersionAdded: '0.48'
2139
+ VersionChanged: '0.67'
2140
+ # Convert usages of `nil? || empty?` to `blank?`
2141
+ NilOrEmpty: true
2142
+ # Convert usages of `!present?` to `blank?`
2143
+ NotPresent: true
2144
+ # Convert usages of `unless present?` to `if blank?`
2145
+ UnlessPresent: true
2146
+
2147
+ Rails/BulkChangeTable:
2148
+ Description: 'Check whether alter queries are combinable.'
2149
+ Enabled: true
2150
+ VersionAdded: '0.57'
2151
+ Database: null
2152
+ SupportedDatabases:
2153
+ - mysql
2154
+ - postgresql
2155
+ Include:
2156
+ - db/migrate/*.rb
2157
+
2158
+ Rails/CreateTableWithTimestamps:
2159
+ Description: >-
2160
+ Checks the migration for which timestamps are not included
2161
+ when creating a new table.
2162
+ Enabled: true
2163
+ VersionAdded: '0.52'
2164
+ Include:
2165
+ - db/migrate/*.rb
2166
+
2167
+ Rails/Date:
2168
+ Description: >-
2169
+ Checks the correct usage of date aware methods,
2170
+ such as Date.today, Date.current etc.
2171
+ Enabled: true
2172
+ VersionAdded: '0.30'
2173
+ VersionChanged: '0.33'
2174
+ # The value `strict` disallows usage of `Date.today`, `Date.current`,
2175
+ # `Date#to_time` etc.
2176
+ # The value `flexible` allows usage of `Date.current`, `Date.yesterday`, etc
2177
+ # (but not `Date.today`) which are overridden by ActiveSupport to handle current
2178
+ # time zone.
2179
+ EnforcedStyle: flexible
2180
+ SupportedStyles:
2181
+ - strict
2182
+ - flexible
2183
+
2184
+ Rails/Delegate:
2185
+ Description: 'Prefer delegate method for delegations.'
2186
+ Enabled: true
2187
+ VersionAdded: '0.21'
2188
+ VersionChanged: '0.50'
2189
+ # When set to true, using the target object as a prefix of the
2190
+ # method name without using the `delegate` method will be a
2191
+ # violation. When set to false, this case is legal.
2192
+ EnforceForPrefixed: true
2193
+
2194
+ Rails/DelegateAllowBlank:
2195
+ Description: 'Do not use allow_blank as an option to delegate.'
2196
+ Enabled: true
2197
+ VersionAdded: '0.44'
2198
+
2199
+ Rails/DynamicFindBy:
2200
+ Description: 'Use `find_by` instead of dynamic `find_by_*`.'
2201
+ StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#find_by'
2202
+ Enabled: true
2203
+ VersionAdded: '0.44'
2204
+ Whitelist:
2205
+ - find_by_sql
2206
+
2207
+ Rails/EnumUniqueness:
2208
+ Description: 'Avoid duplicate integers in hash-syntax `enum` declaration.'
2209
+ Enabled: true
2210
+ VersionAdded: '0.46'
2211
+ Include:
2212
+ - app/models/**/*.rb
2213
+
2214
+ Rails/EnvironmentComparison:
2215
+ Description: "Favor `Rails.env.production?` over `Rails.env == 'production'`"
2216
+ Enabled: true
2217
+ VersionAdded: '0.52'
2218
+
2219
+ Rails/Exit:
2220
+ Description: >-
2221
+ Favor `fail`, `break`, `return`, etc. over `exit` in
2222
+ application or library code outside of Rake files to avoid
2223
+ exits during unit testing or running in production.
2224
+ Enabled: true
2225
+ VersionAdded: '0.41'
2226
+ Include:
2227
+ - app/**/*.rb
2228
+ - config/**/*.rb
2229
+ - lib/**/*.rb
2230
+ Exclude:
2231
+ - lib/**/*.rake
2232
+
2233
+ Rails/FilePath:
2234
+ Description: 'Use `Rails.root.join` for file path joining.'
2235
+ Enabled: true
2236
+ VersionAdded: '0.47'
2237
+ VersionChanged: '0.57'
2238
+ EnforcedStyle: arguments
2239
+ SupportedStyles:
2240
+ - slashes
2241
+ - arguments
2242
+
2243
+ Rails/FindBy:
2244
+ Description: 'Prefer find_by over where.first.'
2245
+ StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#find_by'
2246
+ Enabled: true
2247
+ VersionAdded: '0.30'
2248
+ Include:
2249
+ - app/models/**/*.rb
2250
+
2251
+ Rails/FindEach:
2252
+ Description: 'Prefer all.find_each over all.find.'
2253
+ StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#find-each'
2254
+ Enabled: true
2255
+ VersionAdded: '0.30'
2256
+ Include:
2257
+ - app/models/**/*.rb
2258
+
2259
+ Rails/HasAndBelongsToMany:
2260
+ Description: 'Prefer has_many :through to has_and_belongs_to_many.'
2261
+ StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#has-many-through'
2262
+ Enabled: true
2263
+ VersionAdded: '0.12'
2264
+ Include:
2265
+ - app/models/**/*.rb
2266
+
2267
+ Rails/HasManyOrHasOneDependent:
2268
+ Description: 'Define the dependent option to the has_many and has_one associations.'
2269
+ StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#has_many-has_one-dependent-option'
2270
+ Enabled: true
2271
+ VersionAdded: '0.50'
2272
+ Include:
2273
+ - app/models/**/*.rb
2274
+
2275
+ Rails/HttpPositionalArguments:
2276
+ Description: 'Use keyword arguments instead of positional arguments in http method calls.'
2277
+ Enabled: true
2278
+ VersionAdded: '0.44'
2279
+ Include:
2280
+ - 'spec/**/*'
2281
+ - 'test/**/*'
2282
+
2283
+ Rails/HttpStatus:
2284
+ Description: 'Enforces use of symbolic or numeric value to define HTTP status.'
2285
+ Enabled: true
2286
+ VersionAdded: '0.54'
2287
+ EnforcedStyle: symbolic
2288
+ SupportedStyles:
2289
+ - numeric
2290
+ - symbolic
2291
+
2292
+ Rails/IgnoredSkipActionFilterOption:
2293
+ Description: 'Checks that `if` and `only` (or `except`) are not used together as options of `skip_*` action filter.'
2294
+ Reference: 'https://api.rubyonrails.org/classes/AbstractController/Callbacks/ClassMethods.html#method-i-_normalize_callback_options'
2295
+ Enabled: true
2296
+ VersionAdded: '0.63'
2297
+ Include:
2298
+ - app/controllers/**/*.rb
2299
+
2300
+ Rails/InverseOf:
2301
+ Description: 'Checks for associations where the inverse cannot be determined automatically.'
2302
+ Enabled: true
2303
+ VersionAdded: '0.52'
2304
+ Include:
2305
+ - app/models/**/*.rb
2306
+
2307
+ Rails/LexicallyScopedActionFilter:
2308
+ Description: "Checks that methods specified in the filter's `only` or `except` options are explicitly defined in the controller."
2309
+ StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#lexically-scoped-action-filter'
2310
+ Enabled: true
2311
+ Safe: false
2312
+ VersionAdded: '0.52'
2313
+ Include:
2314
+ - app/controllers/**/*.rb
2315
+
2316
+ Rails/LinkToBlank:
2317
+ Description: 'Checks that `link_to` with a `target: "_blank"` have a `rel: "noopener"` option passed to them.'
2318
+ Reference: https://mathiasbynens.github.io/rel-noopener/
2319
+ Enabled: true
2320
+ VersionAdded: '0.62'
2321
+
2322
+ Rails/NotNullColumn:
2323
+ Description: 'Do not add a NOT NULL column without a default value'
2324
+ Enabled: true
2325
+ VersionAdded: '0.43'
2326
+ Include:
2327
+ - db/migrate/*.rb
2328
+
2329
+ Rails/Output:
2330
+ Description: 'Checks for calls to puts, print, etc.'
2331
+ Enabled: true
2332
+ VersionAdded: '0.15'
2333
+ VersionChanged: '0.19'
2334
+ Include:
2335
+ - app/**/*.rb
2336
+ - config/**/*.rb
2337
+ - db/**/*.rb
2338
+ - lib/**/*.rb
2339
+
2340
+ Rails/OutputSafety:
2341
+ Description: 'The use of `html_safe` or `raw` may be a security risk.'
2342
+ Enabled: true
2343
+ VersionAdded: '0.41'
2344
+
2345
+ Rails/PluralizationGrammar:
2346
+ Description: 'Checks for incorrect grammar when using methods like `3.day.ago`.'
2347
+ Enabled: true
2348
+ VersionAdded: '0.35'
2349
+
2350
+ Rails/Presence:
2351
+ Description: 'Checks code that can be written more easily using `Object#presence` defined by Active Support.'
2352
+ Enabled: true
2353
+ VersionAdded: '0.52'
2354
+
2355
+ Rails/Present:
2356
+ Description: 'Enforces use of `present?`.'
2357
+ Enabled: true
2358
+ VersionAdded: '0.48'
2359
+ VersionChanged: '0.67'
2360
+ # Convert usages of `!nil? && !empty?` to `present?`
2361
+ NotNilAndNotEmpty: true
2362
+ # Convert usages of `!blank?` to `present?`
2363
+ NotBlank: true
2364
+ # Convert usages of `unless blank?` to `if present?`
2365
+ UnlessBlank: true
2366
+
2367
+ Rails/ReadWriteAttribute:
2368
+ Description: >-
2369
+ Checks for read_attribute(:attr) and
2370
+ write_attribute(:attr, val).
2371
+ StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#read-attribute'
2372
+ Enabled: true
2373
+ VersionAdded: '0.20'
2374
+ VersionChanged: '0.29'
2375
+ Include:
2376
+ - app/models/**/*.rb
2377
+
2378
+ Rails/RedundantAllowNil:
2379
+ Description: >-
2380
+ Finds redundant use of `allow_nil` when `allow_blank` is set to
2381
+ certain values in model validations.
2382
+ Enabled: true
2383
+ VersionAdded: '0.67'
2384
+ Include:
2385
+ - app/models/**/*.rb
2386
+
2387
+ Rails/RedundantReceiverInWithOptions:
2388
+ Description: 'Checks for redundant receiver in `with_options`.'
2389
+ Enabled: true
2390
+ VersionAdded: '0.52'
2391
+
2392
+ Rails/ReflectionClassName:
2393
+ Description: 'Use a string for `class_name` option value in the definition of a reflection.'
2394
+ Enabled: true
2395
+ VersionAdded: '0.64'
2396
+
2397
+ Rails/RefuteMethods:
2398
+ Description: 'Use `assert_not` methods instead of `refute` methods.'
2399
+ Enabled: true
2400
+ VersionAdded: '0.56'
2401
+ Include:
2402
+ - '**/test/**/*'
2403
+
2404
+ Rails/RelativeDateConstant:
2405
+ Description: 'Do not assign relative date to constants.'
2406
+ Enabled: true
2407
+ VersionAdded: '0.48'
2408
+ VersionChanged: '0.59'
2409
+ AutoCorrect: false
2410
+
2411
+ Rails/RequestReferer:
2412
+ Description: 'Use consistent syntax for request.referer.'
2413
+ Enabled: true
2414
+ VersionAdded: '0.41'
2415
+ EnforcedStyle: referer
2416
+ SupportedStyles:
2417
+ - referer
2418
+ - referrer
2419
+
2420
+ Rails/ReversibleMigration:
2421
+ Description: 'Checks whether the change method of the migration file is reversible.'
2422
+ StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#reversible-migration'
2423
+ Reference: 'https://api.rubyonrails.org/classes/ActiveRecord/Migration/CommandRecorder.html'
2424
+ Enabled: true
2425
+ VersionAdded: '0.47'
2426
+ Include:
2427
+ - db/migrate/*.rb
2428
+
2429
+ Rails/SafeNavigation:
2430
+ Description: "Use Ruby's safe navigation operator (`&.`) instead of `try!`"
2431
+ Enabled: true
2432
+ VersionAdded: '0.43'
2433
+ # This will convert usages of `try` to use safe navigation as well as `try!`.
2434
+ # `try` and `try!` work slightly differently. `try!` and safe navigation will
2435
+ # both raise a `NoMethodError` if the receiver of the method call does not
2436
+ # implement the intended method. `try` will not raise an exception for this.
2437
+ ConvertTry: false
2438
+
2439
+ Rails/SaveBang:
2440
+ Description: 'Identifies possible cases where Active Record save! or related should be used.'
2441
+ StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#save-bang'
2442
+ Enabled: false
2443
+ VersionAdded: '0.42'
2444
+ VersionChanged: '0.59'
2445
+ AllowImplicitReturn: true
2446
+ AllowedReceivers: []
2447
+
2448
+ Rails/ScopeArgs:
2449
+ Description: 'Checks the arguments of ActiveRecord scopes.'
2450
+ Enabled: true
2451
+ VersionAdded: '0.19'
2452
+ Include:
2453
+ - app/models/**/*.rb
2454
+
2455
+ Rails/SkipsModelValidations:
2456
+ Description: >-
2457
+ Use methods that skips model validations with caution.
2458
+ See reference for more information.
2459
+ Reference: 'https://guides.rubyonrails.org/active_record_validations.html#skipping-validations'
2460
+ Enabled: true
2461
+ VersionAdded: '0.47'
2462
+ VersionChanged: '0.60'
2463
+ Blacklist:
2464
+ - decrement!
2465
+ - decrement_counter
2466
+ - increment!
2467
+ - increment_counter
2468
+ - toggle!
2469
+ - touch
2470
+ - update_all
2471
+ - update_attribute
2472
+ - update_column
2473
+ - update_columns
2474
+ - update_counters
2475
+ Whitelist: []
2476
+
2477
+ Rails/TimeZone:
2478
+ Description: 'Checks the correct usage of time zone aware methods.'
2479
+ StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#time'
2480
+ Reference: 'http://danilenko.org/2012/7/6/rails_timezones'
2481
+ Enabled: true
2482
+ Safe: false
2483
+ VersionAdded: '0.30'
2484
+ VersionChanged: '0.68'
2485
+ # The value `strict` means that `Time` should be used with `zone`.
2486
+ # The value `flexible` allows usage of `in_time_zone` instead of `zone`.
2487
+ EnforcedStyle: flexible
2488
+ SupportedStyles:
2489
+ - strict
2490
+ - flexible
2491
+
2492
+ Rails/UniqBeforePluck:
2493
+ Description: 'Prefer the use of uniq or distinct before pluck.'
2494
+ Enabled: true
2495
+ VersionAdded: '0.40'
2496
+ VersionChanged: '0.47'
2497
+ EnforcedStyle: conservative
2498
+ SupportedStyles:
2499
+ - conservative
2500
+ - aggressive
2501
+ AutoCorrect: false
2502
+
2503
+ Rails/UnknownEnv:
2504
+ Description: 'Use correct environment name.'
2505
+ Enabled: true
2506
+ VersionAdded: '0.51'
2507
+ Environments:
2508
+ - development
2509
+ - test
2510
+ - production
2511
+
2512
+ Rails/Validation:
2513
+ Description: 'Use validates :attribute, hash of validations.'
2514
+ Enabled: true
2515
+ VersionAdded: '0.9'
2516
+ VersionChanged: '0.41'
2517
+ Include:
2518
+ - app/models/**/*.rb
2519
+
2520
+ #################### Security ##############################
2521
+
2522
+ Security/Eval:
2523
+ Description: 'The use of eval represents a serious security risk.'
2524
+ Enabled: true
2525
+ VersionAdded: '0.47'
2526
+
2527
+ Security/JSONLoad:
2528
+ Description: >-
2529
+ Prefer usage of `JSON.parse` over `JSON.load` due to potential
2530
+ security issues. See reference for more information.
2531
+ Reference: 'https://ruby-doc.org/stdlib-2.3.0/libdoc/json/rdoc/JSON.html#method-i-load'
2532
+ Enabled: true
2533
+ VersionAdded: '0.43'
2534
+ VersionChanged: '0.44'
2535
+ # Autocorrect here will change to a method that may cause crashes depending
2536
+ # on the value of the argument.
2537
+ AutoCorrect: false
2538
+ SafeAutoCorrect: false
2539
+
2540
+ Security/MarshalLoad:
2541
+ Description: >-
2542
+ Avoid using of `Marshal.load` or `Marshal.restore` due to potential
2543
+ security issues. See reference for more information.
2544
+ Reference: 'https://ruby-doc.org/core-2.3.3/Marshal.html#module-Marshal-label-Security+considerations'
2545
+ Enabled: true
2546
+ VersionAdded: '0.47'
2547
+
2548
+ Security/Open:
2549
+ Description: 'The use of Kernel#open represents a serious security risk.'
2550
+ Enabled: true
2551
+ VersionAdded: '0.53'
2552
+ Safe: false
2553
+
2554
+ Security/YAMLLoad:
2555
+ Description: >-
2556
+ Prefer usage of `YAML.safe_load` over `YAML.load` due to potential
2557
+ security issues. See reference for more information.
2558
+ Reference: 'https://ruby-doc.org/stdlib-2.3.3/libdoc/yaml/rdoc/YAML.html#module-YAML-label-Security'
2559
+ Enabled: true
2560
+ VersionAdded: '0.47'
2561
+ SafeAutoCorrect: false
2562
+
2563
+ #################### Style ###############################
2564
+
2565
+ Style/AccessModifierDeclarations:
2566
+ Description: 'Checks style of how access modifiers are used.'
2567
+ Enabled: true
2568
+ VersionAdded: '0.57'
2569
+ EnforcedStyle: group
2570
+ SupportedStyles:
2571
+ - inline
2572
+ - group
2573
+
2574
+ Style/Alias:
2575
+ Description: 'Use alias instead of alias_method.'
2576
+ StyleGuide: '#alias-method'
2577
+ Enabled: true
2578
+ VersionAdded: '0.9'
2579
+ VersionChanged: '0.36'
2580
+ EnforcedStyle: prefer_alias
2581
+ SupportedStyles:
2582
+ - prefer_alias
2583
+ - prefer_alias_method
2584
+
2585
+ Style/AndOr:
2586
+ Description: 'Use &&/|| instead of and/or.'
2587
+ StyleGuide: '#no-and-or-or'
2588
+ Enabled: true
2589
+ VersionAdded: '0.9'
2590
+ VersionChanged: '0.25'
2591
+ # Whether `and` and `or` are banned only in conditionals (conditionals)
2592
+ # or completely (always).
2593
+ EnforcedStyle: always
2594
+ SupportedStyles:
2595
+ - always
2596
+ - conditionals
2597
+
2598
+ Style/ArrayJoin:
2599
+ Description: 'Use Array#join instead of Array#*.'
2600
+ StyleGuide: '#array-join'
2601
+ Enabled: true
2602
+ VersionAdded: '0.20'
2603
+ VersionChanged: '0.31'
2604
+
2605
+ Style/AsciiComments:
2606
+ Description: 'Use only ascii symbols in comments.'
2607
+ StyleGuide: '#english-comments'
2608
+ Enabled: true
2609
+ VersionAdded: '0.9'
2610
+ VersionChanged: '0.52'
2611
+ AllowedChars: []
2612
+
2613
+ Style/Attr:
2614
+ Description: 'Checks for uses of Module#attr.'
2615
+ StyleGuide: '#attr'
2616
+ Enabled: true
2617
+ VersionAdded: '0.9'
2618
+ VersionChanged: '0.12'
2619
+
2620
+ Style/AutoResourceCleanup:
2621
+ Description: 'Suggests the usage of an auto resource cleanup version of a method (if available).'
2622
+ Enabled: false
2623
+ VersionAdded: '0.30'
2624
+
2625
+ Style/BarePercentLiterals:
2626
+ Description: 'Checks if usage of %() or %Q() matches configuration.'
2627
+ StyleGuide: '#percent-q-shorthand'
2628
+ Enabled: true
2629
+ VersionAdded: '0.25'
2630
+ EnforcedStyle: bare_percent
2631
+ SupportedStyles:
2632
+ - percent_q
2633
+ - bare_percent
2634
+
2635
+ Style/BeginBlock:
2636
+ Description: 'Avoid the use of BEGIN blocks.'
2637
+ StyleGuide: '#no-BEGIN-blocks'
2638
+ Enabled: true
2639
+ VersionAdded: '0.9'
2640
+
2641
+ Style/BlockComments:
2642
+ Description: 'Do not use block comments.'
2643
+ StyleGuide: '#no-block-comments'
2644
+ Enabled: true
2645
+ VersionAdded: '0.9'
2646
+ VersionChanged: '0.23'
2647
+
2648
+ Style/BlockDelimiters:
2649
+ Description: >-
2650
+ Avoid using {...} for multi-line blocks (multiline chaining is
2651
+ always ugly).
2652
+ Prefer {...} over do...end for single-line blocks.
2653
+ StyleGuide: '#single-line-blocks'
2654
+ Enabled: true
2655
+ VersionAdded: '0.30'
2656
+ VersionChanged: '0.35'
2657
+ EnforcedStyle: line_count_based
2658
+ SupportedStyles:
2659
+ # The `line_count_based` style enforces braces around single line blocks and
2660
+ # do..end around multi-line blocks.
2661
+ - line_count_based
2662
+ # The `semantic` style enforces braces around functional blocks, where the
2663
+ # primary purpose of the block is to return a value and do..end for
2664
+ # multi-line procedural blocks, where the primary purpose of the block is
2665
+ # its side-effects. Single-line procedural blocks may only use do-end,
2666
+ # unless AllowBracesOnProceduralOneLiners has a truthy value (see below).
2667
+ #
2668
+ # This looks at the usage of a block's method to determine its type (e.g. is
2669
+ # the result of a `map` assigned to a variable or passed to another
2670
+ # method) but exceptions are permitted in the `ProceduralMethods`,
2671
+ # `FunctionalMethods` and `IgnoredMethods` sections below.
2672
+ - semantic
2673
+ # The `braces_for_chaining` style enforces braces around single line blocks
2674
+ # and do..end around multi-line blocks, except for multi-line blocks whose
2675
+ # return value is being chained with another method (in which case braces
2676
+ # are enforced).
2677
+ - braces_for_chaining
2678
+ # The `always_braces` style always enforces braces.
2679
+ - always_braces
2680
+ ProceduralMethods:
2681
+ # Methods that are known to be procedural in nature but look functional from
2682
+ # their usage, e.g.
2683
+ #
2684
+ # time = Benchmark.realtime do
2685
+ # foo.bar
2686
+ # end
2687
+ #
2688
+ # Here, the return value of the block is discarded but the return value of
2689
+ # `Benchmark.realtime` is used.
2690
+ - benchmark
2691
+ - bm
2692
+ - bmbm
2693
+ - create
2694
+ - each_with_object
2695
+ - measure
2696
+ - new
2697
+ - realtime
2698
+ - tap
2699
+ - with_object
2700
+ FunctionalMethods:
2701
+ # Methods that are known to be functional in nature but look procedural from
2702
+ # their usage, e.g.
2703
+ #
2704
+ # let(:foo) { Foo.new }
2705
+ #
2706
+ # Here, the return value of `Foo.new` is used to define a `foo` helper but
2707
+ # doesn't appear to be used from the return value of `let`.
2708
+ - let
2709
+ - let!
2710
+ - subject
2711
+ - watch
2712
+ IgnoredMethods:
2713
+ # Methods that can be either procedural or functional and cannot be
2714
+ # categorised from their usage alone, e.g.
2715
+ #
2716
+ # foo = lambda do |x|
2717
+ # puts "Hello, #{x}"
2718
+ # end
2719
+ #
2720
+ # foo = lambda do |x|
2721
+ # x * 100
2722
+ # end
2723
+ #
2724
+ # Here, it is impossible to tell from the return value of `lambda` whether
2725
+ # the inner block's return value is significant.
2726
+ - lambda
2727
+ - proc
2728
+ - it
2729
+ # The AllowBracesOnProceduralOneLiners option is ignored unless the
2730
+ # EnforcedStyle is set to `semantic`. If so:
2731
+ #
2732
+ # If AllowBracesOnProceduralOneLiners is unspecified, or set to any
2733
+ # falsey value, then semantic purity is maintained, so one-line
2734
+ # procedural blocks must use do-end, not braces.
2735
+ #
2736
+ # # bad
2737
+ # collection.each { |element| puts element }
2738
+ #
2739
+ # # good
2740
+ # collection.each do |element| puts element end
2741
+ #
2742
+ # If AllowBracesOnProceduralOneLiners is set to any truthy value,
2743
+ # then one-line procedural blocks may use either style.
2744
+ #
2745
+ # # good
2746
+ # collection.each { |element| puts element }
2747
+ #
2748
+ # # also good
2749
+ # collection.each do |element| puts element end
2750
+ AllowBracesOnProceduralOneLiners: false
2751
+
2752
+ Style/BracesAroundHashParameters:
2753
+ Description: 'Enforce braces style around hash parameters.'
2754
+ Enabled: true
2755
+ VersionAdded: '0.14.1'
2756
+ VersionChanged: '0.28'
2757
+ EnforcedStyle: no_braces
2758
+ SupportedStyles:
2759
+ # The `braces` style enforces braces around all method parameters that are
2760
+ # hashes.
2761
+ - braces
2762
+ # The `no_braces` style checks that the last parameter doesn't have braces
2763
+ # around it.
2764
+ - no_braces
2765
+ # The `context_dependent` style checks that the last parameter doesn't have
2766
+ # braces around it, but requires braces if the second to last parameter is
2767
+ # also a hash literal.
2768
+ - context_dependent
2769
+
2770
+ Style/CaseEquality:
2771
+ Description: 'Avoid explicit use of the case equality operator(===).'
2772
+ StyleGuide: '#no-case-equality'
2773
+ Enabled: true
2774
+ VersionAdded: '0.9'
2775
+
2776
+ Style/CharacterLiteral:
2777
+ Description: 'Checks for uses of character literals.'
2778
+ StyleGuide: '#no-character-literals'
2779
+ Enabled: true
2780
+ VersionAdded: '0.9'
2781
+
2782
+ Style/ClassAndModuleChildren:
2783
+ Description: 'Checks style of children classes and modules.'
2784
+ StyleGuide: '#namespace-definition'
2785
+ # Moving from compact to nested children requires knowledge of whether the
2786
+ # outer parent is a module or a class. Moving from nested to compact requires
2787
+ # verification that the outer parent is defined elsewhere. Rubocop does not
2788
+ # have the knowledge to perform either operation safely and thus requires
2789
+ # manual oversight.
2790
+ SafeAutoCorrect: false
2791
+ AutoCorrect: false
2792
+ Enabled: true
2793
+ VersionAdded: '0.19'
2794
+ #
2795
+ # Basically there are two different styles:
2796
+ #
2797
+ # `nested` - have each child on a separate line
2798
+ # class Foo
2799
+ # class Bar
2800
+ # end
2801
+ # end
2802
+ #
2803
+ # `compact` - combine definitions as much as possible
2804
+ # class Foo::Bar
2805
+ # end
2806
+ #
2807
+ # The compact style is only forced, for classes or modules with one child.
2808
+ EnforcedStyle: nested
2809
+ SupportedStyles:
2810
+ - nested
2811
+ - compact
2812
+
2813
+ Style/ClassCheck:
2814
+ Description: 'Enforces consistent use of `Object#is_a?` or `Object#kind_of?`.'
2815
+ Enabled: true
2816
+ VersionAdded: '0.24'
2817
+ EnforcedStyle: is_a?
2818
+ SupportedStyles:
2819
+ - is_a?
2820
+ - kind_of?
2821
+
2822
+ Style/ClassMethods:
2823
+ Description: 'Use self when defining module/class methods.'
2824
+ StyleGuide: '#def-self-class-methods'
2825
+ Enabled: true
2826
+ VersionAdded: '0.9'
2827
+ VersionChanged: '0.20'
2828
+
2829
+ Style/ClassVars:
2830
+ Description: 'Avoid the use of class variables.'
2831
+ StyleGuide: '#no-class-vars'
2832
+ Enabled: true
2833
+ VersionAdded: '0.13'
2834
+
2835
+ # Align with the style guide.
2836
+ Style/CollectionMethods:
2837
+ Description: 'Preferred collection methods.'
2838
+ StyleGuide: '#map-find-select-reduce-size'
2839
+ Enabled: false
2840
+ VersionAdded: '0.9'
2841
+ VersionChanged: '0.27'
2842
+ Safe: false
2843
+ # Mapping from undesired method to desired method
2844
+ # e.g. to use `detect` over `find`:
2845
+ #
2846
+ # Style/CollectionMethods:
2847
+ # PreferredMethods:
2848
+ # find: detect
2849
+ PreferredMethods:
2850
+ collect: 'map'
2851
+ collect!: 'map!'
2852
+ inject: 'reduce'
2853
+ detect: 'find'
2854
+ find_all: 'select'
2855
+
2856
+ Style/ColonMethodCall:
2857
+ Description: 'Do not use :: for method call.'
2858
+ StyleGuide: '#double-colons'
2859
+ Enabled: true
2860
+ VersionAdded: '0.9'
2861
+
2862
+ Style/ColonMethodDefinition:
2863
+ Description: 'Do not use :: for defining class methods.'
2864
+ StyleGuide: '#colon-method-definition'
2865
+ Enabled: true
2866
+ VersionAdded: '0.52'
2867
+
2868
+ Style/CommandLiteral:
2869
+ Description: 'Use `` or %x around command literals.'
2870
+ StyleGuide: '#percent-x'
2871
+ Enabled: true
2872
+ VersionAdded: '0.30'
2873
+ EnforcedStyle: backticks
2874
+ # backticks: Always use backticks.
2875
+ # percent_x: Always use `%x`.
2876
+ # mixed: Use backticks on single-line commands, and `%x` on multi-line commands.
2877
+ SupportedStyles:
2878
+ - backticks
2879
+ - percent_x
2880
+ - mixed
2881
+ # If `false`, the cop will always recommend using `%x` if one or more backticks
2882
+ # are found in the command string.
2883
+ AllowInnerBackticks: false
2884
+
2885
+ # Checks formatting of special comments
2886
+ Style/CommentAnnotation:
2887
+ Description: >-
2888
+ Checks formatting of special comments
2889
+ (TODO, FIXME, OPTIMIZE, HACK, REVIEW).
2890
+ StyleGuide: '#annotate-keywords'
2891
+ Enabled: true
2892
+ VersionAdded: '0.10'
2893
+ VersionChanged: '0.31'
2894
+ Keywords:
2895
+ - TODO
2896
+ - FIXME
2897
+ - OPTIMIZE
2898
+ - HACK
2899
+ - REVIEW
2900
+
2901
+ Style/CommentedKeyword:
2902
+ Description: 'Do not place comments on the same line as certain keywords.'
2903
+ Enabled: true
2904
+ VersionAdded: '0.51'
2905
+
2906
+ Style/ConditionalAssignment:
2907
+ Description: >-
2908
+ Use the return value of `if` and `case` statements for
2909
+ assignment to a variable and variable comparison instead
2910
+ of assigning that variable inside of each branch.
2911
+ Enabled: true
2912
+ VersionAdded: '0.36'
2913
+ VersionChanged: '0.47'
2914
+ EnforcedStyle: assign_to_condition
2915
+ SupportedStyles:
2916
+ - assign_to_condition
2917
+ - assign_inside_condition
2918
+ # When configured to `assign_to_condition`, `SingleLineConditionsOnly`
2919
+ # will only register an offense when all branches of a condition are
2920
+ # a single line.
2921
+ # When configured to `assign_inside_condition`, `SingleLineConditionsOnly`
2922
+ # will only register an offense for assignment to a condition that has
2923
+ # at least one multiline branch.
2924
+ SingleLineConditionsOnly: true
2925
+ IncludeTernaryExpressions: true
2926
+
2927
+ # Checks that you have put a copyright in a comment before any code.
2928
+ #
2929
+ # You can override the default Notice in your .rubocop.yml file.
2930
+ #
2931
+ # In order to use autocorrect, you must supply a value for the
2932
+ # `AutocorrectNotice` key that matches the regexp Notice. A blank
2933
+ # `AutocorrectNotice` will cause an error during autocorrect.
2934
+ #
2935
+ # Autocorrect will add a copyright notice in a comment at the top
2936
+ # of the file immediately after any shebang or encoding comments.
2937
+ #
2938
+ # Example rubocop.yml:
2939
+ #
2940
+ # Style/Copyright:
2941
+ # Enabled: true
2942
+ # Notice: 'Copyright (\(c\) )?2015 Yahoo! Inc'
2943
+ # AutocorrectNotice: '# Copyright (c) 2015 Yahoo! Inc.'
2944
+ #
2945
+ Style/ConstantVisibility:
2946
+ Description: >-
2947
+ Check that class- and module constants have
2948
+ visibility declarations.
2949
+ Enabled: false
2950
+ VersionAdded: '0.66'
2951
+
2952
+ Style/Copyright:
2953
+ Description: 'Include a copyright notice in each file before any code.'
2954
+ Enabled: false
2955
+ VersionAdded: '0.30'
2956
+ Notice: '^Copyright (\(c\) )?2[0-9]{3} .+'
2957
+ AutocorrectNotice: ''
2958
+
2959
+ Style/DateTime:
2960
+ Description: 'Use Time over DateTime.'
2961
+ StyleGuide: '#date--time'
2962
+ Enabled: false
2963
+ VersionAdded: '0.51'
2964
+ VersionChanged: '0.59'
2965
+ AllowCoercion: false
2966
+
2967
+ Style/DefWithParentheses:
2968
+ Description: 'Use def with parentheses when there are arguments.'
2969
+ StyleGuide: '#method-parens'
2970
+ Enabled: true
2971
+ VersionAdded: '0.9'
2972
+ VersionChanged: '0.12'
2973
+
2974
+ Style/Dir:
2975
+ Description: >-
2976
+ Use the `__dir__` method to retrieve the canonicalized
2977
+ absolute path to the current file.
2978
+ Enabled: true
2979
+ VersionAdded: '0.50'
2980
+
2981
+ Style/Documentation:
2982
+ Description: 'Document classes and non-namespace modules.'
2983
+ Enabled: true
2984
+ VersionAdded: '0.9'
2985
+ Exclude:
2986
+ - 'spec/**/*'
2987
+ - 'test/**/*'
2988
+
2989
+ Style/DocumentationMethod:
2990
+ Description: 'Checks for missing documentation comment for public methods.'
2991
+ Enabled: false
2992
+ VersionAdded: '0.43'
2993
+ Exclude:
2994
+ - 'spec/**/*'
2995
+ - 'test/**/*'
2996
+ RequireForNonPublicMethods: false
2997
+
2998
+ Style/DoubleNegation:
2999
+ Description: 'Checks for uses of double negation (!!).'
3000
+ StyleGuide: '#no-bang-bang'
3001
+ Enabled: true
3002
+ VersionAdded: '0.19'
3003
+
3004
+ Style/EachForSimpleLoop:
3005
+ Description: >-
3006
+ Use `Integer#times` for a simple loop which iterates a fixed
3007
+ number of times.
3008
+ Enabled: true
3009
+ VersionAdded: '0.41'
3010
+
3011
+ Style/EachWithObject:
3012
+ Description: 'Prefer `each_with_object` over `inject` or `reduce`.'
3013
+ Enabled: true
3014
+ VersionAdded: '0.22'
3015
+ VersionChanged: '0.42'
3016
+
3017
+ Style/EmptyBlockParameter:
3018
+ Description: 'Omit pipes for empty block parameters.'
3019
+ Enabled: true
3020
+ VersionAdded: '0.52'
3021
+
3022
+ Style/EmptyCaseCondition:
3023
+ Description: 'Avoid empty condition in case statements.'
3024
+ Enabled: true
3025
+ VersionAdded: '0.40'
3026
+
3027
+ Style/EmptyElse:
3028
+ Description: 'Avoid empty else-clauses.'
3029
+ Enabled: true
3030
+ VersionAdded: '0.28'
3031
+ VersionChanged: '0.32'
3032
+ EnforcedStyle: both
3033
+ # empty - warn only on empty `else`
3034
+ # nil - warn on `else` with nil in it
3035
+ # both - warn on empty `else` and `else` with `nil` in it
3036
+ SupportedStyles:
3037
+ - empty
3038
+ - nil
3039
+ - both
3040
+
3041
+ Style/EmptyLambdaParameter:
3042
+ Description: 'Omit parens for empty lambda parameters.'
3043
+ Enabled: true
3044
+ VersionAdded: '0.52'
3045
+
3046
+ Style/EmptyLiteral:
3047
+ Description: 'Prefer literals to Array.new/Hash.new/String.new.'
3048
+ StyleGuide: '#literal-array-hash'
3049
+ Enabled: true
3050
+ VersionAdded: '0.9'
3051
+ VersionChanged: '0.12'
3052
+
3053
+ Style/EmptyMethod:
3054
+ Description: 'Checks the formatting of empty method definitions.'
3055
+ StyleGuide: '#no-single-line-methods'
3056
+ Enabled: true
3057
+ VersionAdded: '0.46'
3058
+ EnforcedStyle: compact
3059
+ SupportedStyles:
3060
+ - compact
3061
+ - expanded
3062
+
3063
+ Style/Encoding:
3064
+ Description: 'Use UTF-8 as the source file encoding.'
3065
+ StyleGuide: '#utf-8'
3066
+ Enabled: true
3067
+ VersionAdded: '0.9'
3068
+ VersionChanged: '0.50'
3069
+
3070
+ Style/EndBlock:
3071
+ Description: 'Avoid the use of END blocks.'
3072
+ StyleGuide: '#no-END-blocks'
3073
+ Enabled: true
3074
+ VersionAdded: '0.9'
3075
+
3076
+ Style/EvalWithLocation:
3077
+ Description: 'Pass `__FILE__` and `__LINE__` to `eval` method, as they are used by backtraces.'
3078
+ Enabled: true
3079
+ VersionAdded: '0.52'
3080
+
3081
+ Style/EvenOdd:
3082
+ Description: 'Favor the use of Integer#even? && Integer#odd?'
3083
+ StyleGuide: '#predicate-methods'
3084
+ Enabled: true
3085
+ VersionAdded: '0.12'
3086
+ VersionChanged: '0.29'
3087
+
3088
+ Style/ExpandPathArguments:
3089
+ Description: "Use `expand_path(__dir__)` instead of `expand_path('..', __FILE__)`."
3090
+ Enabled: true
3091
+ VersionAdded: '0.53'
3092
+
3093
+ Style/For:
3094
+ Description: 'Checks use of for or each in multiline loops.'
3095
+ StyleGuide: '#no-for-loops'
3096
+ Enabled: true
3097
+ VersionAdded: '0.13'
3098
+ VersionChanged: '0.59'
3099
+ EnforcedStyle: each
3100
+ SupportedStyles:
3101
+ - each
3102
+ - for
3103
+
3104
+ Style/FormatString:
3105
+ Description: 'Enforce the use of Kernel#sprintf, Kernel#format or String#%.'
3106
+ StyleGuide: '#sprintf'
3107
+ Enabled: true
3108
+ VersionAdded: '0.19'
3109
+ VersionChanged: '0.49'
3110
+ EnforcedStyle: format
3111
+ SupportedStyles:
3112
+ - format
3113
+ - sprintf
3114
+ - percent
3115
+
3116
+ Style/FormatStringToken:
3117
+ Description: 'Use a consistent style for format string tokens.'
3118
+ Enabled: true
3119
+ EnforcedStyle: annotated
3120
+ SupportedStyles:
3121
+ # Prefer tokens which contain a sprintf like type annotation like
3122
+ # `%<name>s`, `%<age>d`, `%<score>f`
3123
+ - annotated
3124
+ # Prefer simple looking "template" style tokens like `%{name}`, `%{age}`
3125
+ - template
3126
+ - unannotated
3127
+ VersionAdded: '0.49'
3128
+ VersionChanged: '0.52'
3129
+
3130
+ Style/FrozenStringLiteralComment:
3131
+ Description: >-
3132
+ Add the frozen_string_literal comment to the top of files
3133
+ to help transition to frozen string literals by default.
3134
+ Enabled: true
3135
+ VersionAdded: '0.36'
3136
+ VersionChanged: '0.47'
3137
+ EnforcedStyle: when_needed
3138
+ SupportedStyles:
3139
+ # `when_needed` will add the frozen string literal comment to files
3140
+ # only when the `TargetRubyVersion` is set to 2.3+.
3141
+ - when_needed
3142
+ # `always` will always add the frozen string literal comment to a file
3143
+ # regardless of the Ruby version or if `freeze` or `<<` are called on a
3144
+ # string literal. If you run code against multiple versions of Ruby, it is
3145
+ # possible that this will create errors in Ruby 2.3.0+.
3146
+ - always
3147
+ # `never` will enforce that the frozen string literal comment does not
3148
+ # exist in a file.
3149
+ - never
3150
+
3151
+ Style/GlobalVars:
3152
+ Description: 'Do not introduce global variables.'
3153
+ StyleGuide: '#instance-vars'
3154
+ Reference: 'https://www.zenspider.com/ruby/quickref.html'
3155
+ Enabled: true
3156
+ VersionAdded: '0.13'
3157
+ # Built-in global variables are allowed by default.
3158
+ AllowedVariables: []
3159
+
3160
+ Style/GuardClause:
3161
+ Description: 'Check for conditionals that can be replaced with guard clauses'
3162
+ StyleGuide: '#no-nested-conditionals'
3163
+ Enabled: true
3164
+ VersionAdded: '0.20'
3165
+ VersionChanged: '0.22'
3166
+ # `MinBodyLength` defines the number of lines of the a body of an `if` or `unless`
3167
+ # needs to have to trigger this cop
3168
+ MinBodyLength: 1
3169
+
3170
+ Style/HashSyntax:
3171
+ Description: >-
3172
+ Prefer Ruby 1.9 hash syntax { a: 1, b: 2 } over 1.8 syntax
3173
+ { :a => 1, :b => 2 }.
3174
+ StyleGuide: '#hash-literals'
3175
+ Enabled: true
3176
+ VersionAdded: '0.9'
3177
+ VersionChanged: '0.43'
3178
+ EnforcedStyle: ruby19
3179
+ SupportedStyles:
3180
+ # checks for 1.9 syntax (e.g. {a: 1}) for all symbol keys
3181
+ - ruby19
3182
+ # checks for hash rocket syntax for all hashes
3183
+ - hash_rockets
3184
+ # forbids mixed key syntaxes (e.g. {a: 1, :b => 2})
3185
+ - no_mixed_keys
3186
+ # enforces both ruby19 and no_mixed_keys styles
3187
+ - ruby19_no_mixed_keys
3188
+ # Force hashes that have a symbol value to use hash rockets
3189
+ UseHashRocketsWithSymbolValues: false
3190
+ # Do not suggest { a?: 1 } over { :a? => 1 } in ruby19 style
3191
+ PreferHashRocketsForNonAlnumEndingSymbols: false
3192
+
3193
+ Style/IdenticalConditionalBranches:
3194
+ Description: >-
3195
+ Checks that conditional statements do not have an identical
3196
+ line at the end of each branch, which can validly be moved
3197
+ out of the conditional.
3198
+ Enabled: true
3199
+ VersionAdded: '0.36'
3200
+
3201
+ Style/IfInsideElse:
3202
+ Description: 'Finds if nodes inside else, which can be converted to elsif.'
3203
+ Enabled: true
3204
+ VersionAdded: '0.36'
3205
+
3206
+ Style/IfUnlessModifier:
3207
+ Description: >-
3208
+ Favor modifier if/unless usage when you have a
3209
+ single-line body.
3210
+ StyleGuide: '#if-as-a-modifier'
3211
+ Enabled: true
3212
+ VersionAdded: '0.9'
3213
+ VersionChanged: '0.30'
3214
+
3215
+ Style/IfUnlessModifierOfIfUnless:
3216
+ Description: >-
3217
+ Avoid modifier if/unless usage on conditionals.
3218
+ Enabled: true
3219
+ VersionAdded: '0.39'
3220
+
3221
+ Style/IfWithSemicolon:
3222
+ Description: 'Do not use if x; .... Use the ternary operator instead.'
3223
+ StyleGuide: '#no-semicolon-ifs'
3224
+ Enabled: true
3225
+ VersionAdded: '0.9'
3226
+
3227
+ Style/ImplicitRuntimeError:
3228
+ Description: >-
3229
+ Use `raise` or `fail` with an explicit exception class and
3230
+ message, rather than just a message.
3231
+ Enabled: false
3232
+ VersionAdded: '0.41'
3233
+
3234
+ Style/InfiniteLoop:
3235
+ Description: 'Use Kernel#loop for infinite loops.'
3236
+ StyleGuide: '#infinite-loop'
3237
+ Enabled: true
3238
+ VersionAdded: '0.26'
3239
+ VersionChanged: '0.61'
3240
+ SafeAutoCorrect: true
3241
+
3242
+ Style/InlineComment:
3243
+ Description: 'Avoid trailing inline comments.'
3244
+ Enabled: false
3245
+ VersionAdded: '0.23'
3246
+
3247
+ Style/InverseMethods:
3248
+ Description: >-
3249
+ Use the inverse method instead of `!.method`
3250
+ if an inverse method is defined.
3251
+ Enabled: true
3252
+ Safe: false
3253
+ VersionAdded: '0.48'
3254
+ # `InverseMethods` are methods that can be inverted by a not (`not` or `!`)
3255
+ # The relationship of inverse methods only needs to be defined in one direction.
3256
+ # Keys and values both need to be defined as symbols.
3257
+ InverseMethods:
3258
+ :any?: :none?
3259
+ :even?: :odd?
3260
+ :==: :!=
3261
+ :=~: :!~
3262
+ :<: :>=
3263
+ :>: :<=
3264
+ # `ActiveSupport` defines some common inverse methods. They are listed below,
3265
+ # and not enabled by default.
3266
+ #:present?: :blank?,
3267
+ #:include?: :exclude?
3268
+ # `InverseBlocks` are methods that are inverted by inverting the return
3269
+ # of the block that is passed to the method
3270
+ InverseBlocks:
3271
+ :select: :reject
3272
+ :select!: :reject!
3273
+
3274
+ Style/IpAddresses:
3275
+ Description: "Don't include literal IP addresses in code."
3276
+ Enabled: false
3277
+ VersionAdded: '0.58'
3278
+ # Allow strings to be whitelisted
3279
+ Whitelist:
3280
+ - "::"
3281
+ # :: is a valid IPv6 address, but could potentially be legitimately in code
3282
+
3283
+ Style/Lambda:
3284
+ Description: 'Use the new lambda literal syntax for single-line blocks.'
3285
+ StyleGuide: '#lambda-multi-line'
3286
+ Enabled: true
3287
+ VersionAdded: '0.9'
3288
+ VersionChanged: '0.40'
3289
+ EnforcedStyle: line_count_dependent
3290
+ SupportedStyles:
3291
+ - line_count_dependent
3292
+ - lambda
3293
+ - literal
3294
+
3295
+ Style/LambdaCall:
3296
+ Description: 'Use lambda.call(...) instead of lambda.(...).'
3297
+ StyleGuide: '#proc-call'
3298
+ Enabled: true
3299
+ VersionAdded: '0.13.1'
3300
+ VersionChanged: '0.14'
3301
+ EnforcedStyle: call
3302
+ SupportedStyles:
3303
+ - call
3304
+ - braces
3305
+
3306
+ Style/LineEndConcatenation:
3307
+ Description: >-
3308
+ Use \ instead of + or << to concatenate two string literals at
3309
+ line end.
3310
+ Enabled: true
3311
+ SafeAutoCorrect: false
3312
+ VersionAdded: '0.18'
3313
+ VersionChanged: '0.64'
3314
+
3315
+ Style/MethodCallWithArgsParentheses:
3316
+ Description: 'Use parentheses for method calls with arguments.'
3317
+ StyleGuide: '#method-invocation-parens'
3318
+ Enabled: false
3319
+ VersionAdded: '0.47'
3320
+ VersionChanged: '0.61'
3321
+ IgnoreMacros: true
3322
+ IgnoredMethods: []
3323
+ IncludedMacros: []
3324
+ AllowParenthesesInMultilineCall: false
3325
+ AllowParenthesesInChaining: false
3326
+ AllowParenthesesInCamelCaseMethod: false
3327
+ EnforcedStyle: require_parentheses
3328
+ SupportedStyles:
3329
+ - require_parentheses
3330
+ - omit_parentheses
3331
+
3332
+ Style/MethodCallWithoutArgsParentheses:
3333
+ Description: 'Do not use parentheses for method calls with no arguments.'
3334
+ StyleGuide: '#method-invocation-parens'
3335
+ Enabled: true
3336
+ IgnoredMethods: []
3337
+ VersionAdded: '0.47'
3338
+ VersionChanged: '0.55'
3339
+
3340
+ Style/MethodCalledOnDoEndBlock:
3341
+ Description: 'Avoid chaining a method call on a do...end block.'
3342
+ StyleGuide: '#single-line-blocks'
3343
+ Enabled: false
3344
+ VersionAdded: '0.14'
3345
+
3346
+ Style/MethodDefParentheses:
3347
+ Description: >-
3348
+ Checks if the method definitions have or don't have
3349
+ parentheses.
3350
+ StyleGuide: '#method-parens'
3351
+ Enabled: true
3352
+ VersionAdded: '0.16'
3353
+ VersionChanged: '0.35'
3354
+ EnforcedStyle: require_parentheses
3355
+ SupportedStyles:
3356
+ - require_parentheses
3357
+ - require_no_parentheses
3358
+ - require_no_parentheses_except_multiline
3359
+
3360
+ Style/MethodMissingSuper:
3361
+ Description: Checks for `method_missing` to call `super`.
3362
+ StyleGuide: '#no-method-missing'
3363
+ Enabled: true
3364
+ VersionAdded: '0.56'
3365
+
3366
+ Style/MinMax:
3367
+ Description: >-
3368
+ Use `Enumerable#minmax` instead of `Enumerable#min`
3369
+ and `Enumerable#max` in conjunction.'
3370
+ Enabled: true
3371
+ VersionAdded: '0.50'
3372
+
3373
+ Style/MissingElse:
3374
+ Description: >-
3375
+ Require if/case expressions to have an else branches.
3376
+ If enabled, it is recommended that
3377
+ Style/UnlessElse and Style/EmptyElse be enabled.
3378
+ This will conflict with Style/EmptyElse if
3379
+ Style/EmptyElse is configured to style "both"
3380
+ Enabled: false
3381
+ VersionAdded: '0.30'
3382
+ VersionChanged: '0.38'
3383
+ EnforcedStyle: both
3384
+ SupportedStyles:
3385
+ # if - warn when an if expression is missing an else branch
3386
+ # case - warn when a case expression is missing an else branch
3387
+ # both - warn when an if or case expression is missing an else branch
3388
+ - if
3389
+ - case
3390
+ - both
3391
+
3392
+ Style/MissingRespondToMissing:
3393
+ Description: >-
3394
+ Checks if `method_missing` is implemented
3395
+ without implementing `respond_to_missing`.
3396
+ StyleGuide: '#no-method-missing'
3397
+ Enabled: true
3398
+ VersionAdded: '0.56'
3399
+
3400
+ Style/MixinGrouping:
3401
+ Description: 'Checks for grouping of mixins in `class` and `module` bodies.'
3402
+ StyleGuide: '#mixin-grouping'
3403
+ Enabled: true
3404
+ VersionAdded: '0.48'
3405
+ VersionChanged: '0.49'
3406
+ EnforcedStyle: separated
3407
+ SupportedStyles:
3408
+ # separated: each mixed in module goes in a separate statement.
3409
+ # grouped: mixed in modules are grouped into a single statement.
3410
+ - separated
3411
+ - grouped
3412
+
3413
+ Style/MixinUsage:
3414
+ Description: 'Checks that `include`, `extend` and `prepend` exists at the top level.'
3415
+ Enabled: true
3416
+ VersionAdded: '0.51'
3417
+
3418
+ Style/ModuleFunction:
3419
+ Description: 'Checks for usage of `extend self` in modules.'
3420
+ StyleGuide: '#module-function'
3421
+ Enabled: true
3422
+ VersionAdded: '0.11'
3423
+ VersionChanged: '0.65'
3424
+ EnforcedStyle: module_function
3425
+ SupportedStyles:
3426
+ - module_function
3427
+ - extend_self
3428
+ Autocorrect: false
3429
+ SafeAutoCorrect: false
3430
+
3431
+ Style/MultilineBlockChain:
3432
+ Description: 'Avoid multi-line chains of blocks.'
3433
+ StyleGuide: '#single-line-blocks'
3434
+ Enabled: true
3435
+ VersionAdded: '0.13'
3436
+
3437
+ Style/MultilineIfModifier:
3438
+ Description: 'Only use if/unless modifiers on single line statements.'
3439
+ StyleGuide: '#no-multiline-if-modifiers'
3440
+ Enabled: true
3441
+ VersionAdded: '0.45'
3442
+
3443
+ Style/MultilineIfThen:
3444
+ Description: 'Do not use then for multi-line if/unless.'
3445
+ StyleGuide: '#no-then'
3446
+ Enabled: true
3447
+ VersionAdded: '0.9'
3448
+ VersionChanged: '0.26'
3449
+
3450
+ Style/MultilineMemoization:
3451
+ Description: 'Wrap multiline memoizations in a `begin` and `end` block.'
3452
+ Enabled: true
3453
+ VersionAdded: '0.44'
3454
+ VersionChanged: '0.48'
3455
+ EnforcedStyle: keyword
3456
+ SupportedStyles:
3457
+ - keyword
3458
+ - braces
3459
+
3460
+ Style/MultilineMethodSignature:
3461
+ Description: 'Avoid multi-line method signatures.'
3462
+ Enabled: false
3463
+ VersionAdded: '0.59'
3464
+
3465
+ Style/MultilineTernaryOperator:
3466
+ Description: >-
3467
+ Avoid multi-line ?: (the ternary operator);
3468
+ use if/unless instead.
3469
+ StyleGuide: '#no-multiline-ternary'
3470
+ Enabled: true
3471
+ VersionAdded: '0.9'
3472
+
3473
+ Style/MultipleComparison:
3474
+ Description: >-
3475
+ Avoid comparing a variable with multiple items in a conditional,
3476
+ use Array#include? instead.
3477
+ Enabled: true
3478
+ VersionAdded: '0.49'
3479
+
3480
+ Style/MutableConstant:
3481
+ Description: 'Do not assign mutable objects to constants.'
3482
+ Enabled: true
3483
+ VersionAdded: '0.34'
3484
+ VersionChanged: '0.65'
3485
+ EnforcedStyle: literals
3486
+ SupportedStyles:
3487
+ # literals: freeze literals assigned to constants
3488
+ # strict: freeze all constants
3489
+ # Strict mode is considered an experimental feature. It has not been updated
3490
+ # with an exhaustive list of all methods that will produce frozen objects so
3491
+ # there is a decent chance of getting some false positives. Luckily, there is
3492
+ # no harm in freezing an already frozen object.
3493
+ - literals
3494
+ - strict
3495
+
3496
+ Style/NegatedIf:
3497
+ Description: >-
3498
+ Favor unless over if for negative conditions
3499
+ (or control flow or).
3500
+ StyleGuide: '#unless-for-negatives'
3501
+ Enabled: true
3502
+ VersionAdded: '0.20'
3503
+ VersionChanged: '0.48'
3504
+ EnforcedStyle: both
3505
+ SupportedStyles:
3506
+ # both: prefix and postfix negated `if` should both use `unless`
3507
+ # prefix: only use `unless` for negated `if` statements positioned before the body of the statement
3508
+ # postfix: only use `unless` for negated `if` statements positioned after the body of the statement
3509
+ - both
3510
+ - prefix
3511
+ - postfix
3512
+
3513
+ Style/NegatedWhile:
3514
+ Description: 'Favor until over while for negative conditions.'
3515
+ StyleGuide: '#until-for-negatives'
3516
+ Enabled: true
3517
+ VersionAdded: '0.20'
3518
+
3519
+ Style/NestedModifier:
3520
+ Description: 'Avoid using nested modifiers.'
3521
+ StyleGuide: '#no-nested-modifiers'
3522
+ Enabled: true
3523
+ VersionAdded: '0.35'
3524
+
3525
+ Style/NestedParenthesizedCalls:
3526
+ Description: >-
3527
+ Parenthesize method calls which are nested inside the
3528
+ argument list of another parenthesized method call.
3529
+ Enabled: true
3530
+ VersionAdded: '0.36'
3531
+ VersionChanged: '0.50'
3532
+ Whitelist:
3533
+ - be
3534
+ - be_a
3535
+ - be_an
3536
+ - be_between
3537
+ - be_falsey
3538
+ - be_kind_of
3539
+ - be_instance_of
3540
+ - be_truthy
3541
+ - be_within
3542
+ - eq
3543
+ - eql
3544
+ - end_with
3545
+ - include
3546
+ - match
3547
+ - raise_error
3548
+ - respond_to
3549
+ - start_with
3550
+
3551
+ Style/NestedTernaryOperator:
3552
+ Description: 'Use one expression per branch in a ternary operator.'
3553
+ StyleGuide: '#no-nested-ternary'
3554
+ Enabled: true
3555
+ VersionAdded: '0.9'
3556
+
3557
+ Style/Next:
3558
+ Description: 'Use `next` to skip iteration instead of a condition at the end.'
3559
+ StyleGuide: '#no-nested-conditionals'
3560
+ Enabled: true
3561
+ VersionAdded: '0.22'
3562
+ VersionChanged: '0.35'
3563
+ # With `always` all conditions at the end of an iteration needs to be
3564
+ # replaced by next - with `skip_modifier_ifs` the modifier if like this one
3565
+ # are ignored: [1, 2].each { |a| return 'yes' if a == 1 }
3566
+ EnforcedStyle: skip_modifier_ifs
3567
+ # `MinBodyLength` defines the number of lines of the a body of an `if` or `unless`
3568
+ # needs to have to trigger this cop
3569
+ MinBodyLength: 3
3570
+ SupportedStyles:
3571
+ - skip_modifier_ifs
3572
+ - always
3573
+
3574
+ Style/NilComparison:
3575
+ Description: 'Prefer x.nil? to x == nil.'
3576
+ StyleGuide: '#predicate-methods'
3577
+ Enabled: true
3578
+ VersionAdded: '0.12'
3579
+ VersionChanged: '0.59'
3580
+ EnforcedStyle: predicate
3581
+ SupportedStyles:
3582
+ - predicate
3583
+ - comparison
3584
+
3585
+ Style/NonNilCheck:
3586
+ Description: 'Checks for redundant nil checks.'
3587
+ StyleGuide: '#no-non-nil-checks'
3588
+ Enabled: true
3589
+ VersionAdded: '0.20'
3590
+ VersionChanged: '0.22'
3591
+ # With `IncludeSemanticChanges` set to `true`, this cop reports offenses for
3592
+ # `!x.nil?` and autocorrects that and `x != nil` to solely `x`, which is
3593
+ # **usually** OK, but might change behavior.
3594
+ #
3595
+ # With `IncludeSemanticChanges` set to `false`, this cop does not report
3596
+ # offenses for `!x.nil?` and does no changes that might change behavior.
3597
+ IncludeSemanticChanges: false
3598
+
3599
+ Style/Not:
3600
+ Description: 'Use ! instead of not.'
3601
+ StyleGuide: '#bang-not-not'
3602
+ Enabled: true
3603
+ VersionAdded: '0.9'
3604
+ VersionChanged: '0.20'
3605
+
3606
+ Style/NumericLiteralPrefix:
3607
+ Description: 'Use smallcase prefixes for numeric literals.'
3608
+ StyleGuide: '#numeric-literal-prefixes'
3609
+ Enabled: true
3610
+ VersionAdded: '0.41'
3611
+ EnforcedOctalStyle: zero_with_o
3612
+ SupportedOctalStyles:
3613
+ - zero_with_o
3614
+ - zero_only
3615
+
3616
+
3617
+ Style/NumericLiterals:
3618
+ Description: >-
3619
+ Add underscores to large numeric literals to improve their
3620
+ readability.
3621
+ StyleGuide: '#underscores-in-numerics'
3622
+ Enabled: true
3623
+ VersionAdded: '0.9'
3624
+ VersionChanged: '0.48'
3625
+ MinDigits: 5
3626
+ Strict: false
3627
+
3628
+ Style/NumericPredicate:
3629
+ Description: >-
3630
+ Checks for the use of predicate- or comparison methods for
3631
+ numeric comparisons.
3632
+ StyleGuide: '#predicate-methods'
3633
+ Safe: false
3634
+ # This will change to a new method call which isn't guaranteed to be on the
3635
+ # object. Switching these methods has to be done with knowledge of the types
3636
+ # of the variables which rubocop doesn't have.
3637
+ SafeAutoCorrect: false
3638
+ AutoCorrect: false
3639
+ Enabled: true
3640
+ VersionAdded: '0.42'
3641
+ VersionChanged: '0.59'
3642
+ EnforcedStyle: predicate
3643
+ SupportedStyles:
3644
+ - predicate
3645
+ - comparison
3646
+ IgnoredMethods: []
3647
+ # Exclude RSpec specs because assertions like `expect(1).to be > 0` cause
3648
+ # false positives.
3649
+ Exclude:
3650
+ - 'spec/**/*'
3651
+
3652
+ Style/OneLineConditional:
3653
+ Description: >-
3654
+ Favor the ternary operator(?:) over
3655
+ if/then/else/end constructs.
3656
+ StyleGuide: '#ternary-operator'
3657
+ Enabled: true
3658
+ VersionAdded: '0.9'
3659
+ VersionChanged: '0.38'
3660
+
3661
+ Style/OptionHash:
3662
+ Description: "Don't use option hashes when you can use keyword arguments."
3663
+ Enabled: false
3664
+ VersionAdded: '0.33'
3665
+ VersionChanged: '0.34'
3666
+ # A list of parameter names that will be flagged by this cop.
3667
+ SuspiciousParamNames:
3668
+ - options
3669
+ - opts
3670
+ - args
3671
+ - params
3672
+ - parameters
3673
+
3674
+ Style/OptionalArguments:
3675
+ Description: >-
3676
+ Checks for optional arguments that do not appear at the end
3677
+ of the argument list
3678
+ StyleGuide: '#optional-arguments'
3679
+ Enabled: true
3680
+ VersionAdded: '0.33'
3681
+
3682
+ Style/OrAssignment:
3683
+ Description: 'Recommend usage of double pipe equals (||=) where applicable.'
3684
+ StyleGuide: '#double-pipe-for-uninit'
3685
+ Enabled: true
3686
+ VersionAdded: '0.50'
3687
+
3688
+ Style/ParallelAssignment:
3689
+ Description: >-
3690
+ Check for simple usages of parallel assignment.
3691
+ It will only warn when the number of variables
3692
+ matches on both sides of the assignment.
3693
+ StyleGuide: '#parallel-assignment'
3694
+ Enabled: true
3695
+ VersionAdded: '0.32'
3696
+
3697
+ Style/ParenthesesAroundCondition:
3698
+ Description: >-
3699
+ Don't use parentheses around the condition of an
3700
+ if/unless/while.
3701
+ StyleGuide: '#no-parens-around-condition'
3702
+ Enabled: true
3703
+ VersionAdded: '0.9'
3704
+ VersionChanged: '0.56'
3705
+ AllowSafeAssignment: true
3706
+ AllowInMultilineConditions: false
3707
+
3708
+ Style/PercentLiteralDelimiters:
3709
+ Description: 'Use `%`-literal delimiters consistently'
3710
+ StyleGuide: '#percent-literal-braces'
3711
+ Enabled: true
3712
+ VersionAdded: '0.19'
3713
+ # Specify the default preferred delimiter for all types with the 'default' key
3714
+ # Override individual delimiters (even with default specified) by specifying
3715
+ # an individual key
3716
+ PreferredDelimiters:
3717
+ default: ()
3718
+ '%i': '[]'
3719
+ '%I': '[]'
3720
+ '%r': '{}'
3721
+ '%w': '[]'
3722
+ '%W': '[]'
3723
+ VersionChanged: '0.48.1'
3724
+
3725
+ Style/PercentQLiterals:
3726
+ Description: 'Checks if uses of %Q/%q match the configured preference.'
3727
+ Enabled: true
3728
+ VersionAdded: '0.25'
3729
+ EnforcedStyle: lower_case_q
3730
+ SupportedStyles:
3731
+ - lower_case_q # Use `%q` when possible, `%Q` when necessary
3732
+ - upper_case_q # Always use `%Q`
3733
+
3734
+ Style/PerlBackrefs:
3735
+ Description: 'Avoid Perl-style regex back references.'
3736
+ StyleGuide: '#no-perl-regexp-last-matchers'
3737
+ Enabled: true
3738
+ VersionAdded: '0.13'
3739
+
3740
+ Style/PreferredHashMethods:
3741
+ Description: 'Checks use of `has_key?` and `has_value?` Hash methods.'
3742
+ StyleGuide: '#hash-key'
3743
+ Enabled: true
3744
+ VersionAdded: '0.41'
3745
+ VersionChanged: '0.44'
3746
+ EnforcedStyle: short
3747
+ SupportedStyles:
3748
+ - short
3749
+ - verbose
3750
+
3751
+ Style/Proc:
3752
+ Description: 'Use proc instead of Proc.new.'
3753
+ StyleGuide: '#proc'
3754
+ Enabled: true
3755
+ VersionAdded: '0.9'
3756
+ VersionChanged: '0.18'
3757
+
3758
+ Style/RaiseArgs:
3759
+ Description: 'Checks the arguments passed to raise/fail.'
3760
+ StyleGuide: '#exception-class-messages'
3761
+ Enabled: true
3762
+ VersionAdded: '0.14'
3763
+ VersionChanged: '0.40'
3764
+ EnforcedStyle: exploded
3765
+ SupportedStyles:
3766
+ - compact # raise Exception.new(msg)
3767
+ - exploded # raise Exception, msg
3768
+
3769
+ Style/RandomWithOffset:
3770
+ Description: >-
3771
+ Prefer to use ranges when generating random numbers instead of
3772
+ integers with offsets.
3773
+ StyleGuide: '#random-numbers'
3774
+ Enabled: true
3775
+ VersionAdded: '0.52'
3776
+
3777
+ Style/RedundantBegin:
3778
+ Description: "Don't use begin blocks when they are not needed."
3779
+ StyleGuide: '#begin-implicit'
3780
+ Enabled: true
3781
+ VersionAdded: '0.10'
3782
+ VersionChanged: '0.21'
3783
+
3784
+ Style/RedundantConditional:
3785
+ Description: "Don't return true/false from a conditional."
3786
+ Enabled: true
3787
+ VersionAdded: '0.50'
3788
+
3789
+ Style/RedundantException:
3790
+ Description: "Checks for an obsolete RuntimeException argument in raise/fail."
3791
+ StyleGuide: '#no-explicit-runtimeerror'
3792
+ Enabled: true
3793
+ VersionAdded: '0.14'
3794
+ VersionChanged: '0.29'
3795
+
3796
+ Style/RedundantFreeze:
3797
+ Description: "Checks usages of Object#freeze on immutable objects."
3798
+ Enabled: true
3799
+ VersionAdded: '0.34'
3800
+ VersionChanged: '0.66'
3801
+
3802
+ Style/RedundantParentheses:
3803
+ Description: "Checks for parentheses that seem not to serve any purpose."
3804
+ Enabled: true
3805
+ VersionAdded: '0.36'
3806
+
3807
+ Style/RedundantReturn:
3808
+ Description: "Don't use return where it's not required."
3809
+ StyleGuide: '#no-explicit-return'
3810
+ Enabled: true
3811
+ VersionAdded: '0.10'
3812
+ VersionChanged: '0.14'
3813
+ # When `true` allows code like `return x, y`.
3814
+ AllowMultipleReturnValues: false
3815
+
3816
+ Style/RedundantSelf:
3817
+ Description: "Don't use self where it's not needed."
3818
+ StyleGuide: '#no-self-unless-required'
3819
+ Enabled: true
3820
+ VersionAdded: '0.10'
3821
+ VersionChanged: '0.13'
3822
+
3823
+ Style/RedundantSortBy:
3824
+ Description: 'Use `sort` instead of `sort_by { |x| x }`.'
3825
+ Enabled: true
3826
+ VersionAdded: '0.36'
3827
+
3828
+ Style/RegexpLiteral:
3829
+ Description: 'Use / or %r around regular expressions.'
3830
+ StyleGuide: '#percent-r'
3831
+ Enabled: true
3832
+ VersionAdded: '0.9'
3833
+ VersionChanged: '0.30'
3834
+ EnforcedStyle: slashes
3835
+ # slashes: Always use slashes.
3836
+ # percent_r: Always use `%r`.
3837
+ # mixed: Use slashes on single-line regexes, and `%r` on multi-line regexes.
3838
+ SupportedStyles:
3839
+ - slashes
3840
+ - percent_r
3841
+ - mixed
3842
+ # If `false`, the cop will always recommend using `%r` if one or more slashes
3843
+ # are found in the regexp string.
3844
+ AllowInnerSlashes: false
3845
+
3846
+ Style/RescueModifier:
3847
+ Description: 'Avoid using rescue in its modifier form.'
3848
+ StyleGuide: '#no-rescue-modifiers'
3849
+ Enabled: true
3850
+ VersionAdded: '0.9'
3851
+ VersionChanged: '0.34'
3852
+
3853
+ Style/RescueStandardError:
3854
+ Description: 'Avoid rescuing without specifying an error class.'
3855
+ Enabled: true
3856
+ VersionAdded: '0.52'
3857
+ EnforcedStyle: explicit
3858
+ # implicit: Do not include the error class, `rescue`
3859
+ # explicit: Require an error class `rescue StandardError`
3860
+ SupportedStyles:
3861
+ - implicit
3862
+ - explicit
3863
+
3864
+ Style/ReturnNil:
3865
+ Description: 'Use return instead of return nil.'
3866
+ Enabled: false
3867
+ EnforcedStyle: return
3868
+ SupportedStyles:
3869
+ - return
3870
+ - return_nil
3871
+ VersionAdded: '0.50'
3872
+
3873
+ Style/SafeNavigation:
3874
+ Description: >-
3875
+ This cop transforms usages of a method call safeguarded by
3876
+ a check for the existence of the object to
3877
+ safe navigation (`&.`).
3878
+ Enabled: true
3879
+ VersionAdded: '0.43'
3880
+ VersionChanged: '0.56'
3881
+ # Safe navigation may cause a statement to start returning `nil` in addition
3882
+ # to whatever it used to return.
3883
+ ConvertCodeThatCanStartToReturnNil: false
3884
+ Whitelist:
3885
+ - present?
3886
+ - blank?
3887
+ - presence
3888
+ - try
3889
+ - try!
3890
+
3891
+ Style/Sample:
3892
+ Description: >-
3893
+ Use `sample` instead of `shuffle.first`,
3894
+ `shuffle.last`, and `shuffle[Integer]`.
3895
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#arrayshufflefirst-vs-arraysample-code'
3896
+ Enabled: true
3897
+ VersionAdded: '0.30'
3898
+
3899
+ Style/SelfAssignment:
3900
+ Description: >-
3901
+ Checks for places where self-assignment shorthand should have
3902
+ been used.
3903
+ StyleGuide: '#self-assignment'
3904
+ Enabled: true
3905
+ VersionAdded: '0.19'
3906
+ VersionChanged: '0.29'
3907
+
3908
+ Style/Semicolon:
3909
+ Description: "Don't use semicolons to terminate expressions."
3910
+ StyleGuide: '#no-semicolon'
3911
+ Enabled: true
3912
+ VersionAdded: '0.9'
3913
+ VersionChanged: '0.19'
3914
+ # Allow `;` to separate several expressions on the same line.
3915
+ AllowAsExpressionSeparator: false
3916
+
3917
+ Style/Send:
3918
+ Description: 'Prefer `Object#__send__` or `Object#public_send` to `send`, as `send` may overlap with existing methods.'
3919
+ StyleGuide: '#prefer-public-send'
3920
+ Enabled: false
3921
+ VersionAdded: '0.33'
3922
+
3923
+ Style/SignalException:
3924
+ Description: 'Checks for proper usage of fail and raise.'
3925
+ StyleGuide: '#prefer-raise-over-fail'
3926
+ Enabled: true
3927
+ VersionAdded: '0.11'
3928
+ VersionChanged: '0.37'
3929
+ EnforcedStyle: only_raise
3930
+ SupportedStyles:
3931
+ - only_raise
3932
+ - only_fail
3933
+ - semantic
3934
+
3935
+ Style/SingleLineBlockParams:
3936
+ Description: 'Enforces the names of some block params.'
3937
+ Enabled: false
3938
+ VersionAdded: '0.16'
3939
+ VersionChanged: '0.47'
3940
+ Methods:
3941
+ - reduce:
3942
+ - acc
3943
+ - elem
3944
+ - inject:
3945
+ - acc
3946
+ - elem
3947
+
3948
+ Style/SingleLineMethods:
3949
+ Description: 'Avoid single-line methods.'
3950
+ StyleGuide: '#no-single-line-methods'
3951
+ Enabled: true
3952
+ VersionAdded: '0.9'
3953
+ VersionChanged: '0.19'
3954
+ AllowIfMethodIsEmpty: true
3955
+
3956
+ Style/SpecialGlobalVars:
3957
+ Description: 'Avoid Perl-style global variables.'
3958
+ StyleGuide: '#no-cryptic-perlisms'
3959
+ Enabled: true
3960
+ VersionAdded: '0.13'
3961
+ VersionChanged: '0.36'
3962
+ SafeAutoCorrect: false
3963
+ EnforcedStyle: use_english_names
3964
+ SupportedStyles:
3965
+ - use_perl_names
3966
+ - use_english_names
3967
+
3968
+ Style/StabbyLambdaParentheses:
3969
+ Description: 'Check for the usage of parentheses around stabby lambda arguments.'
3970
+ StyleGuide: '#stabby-lambda-with-args'
3971
+ Enabled: true
3972
+ VersionAdded: '0.35'
3973
+ EnforcedStyle: require_parentheses
3974
+ SupportedStyles:
3975
+ - require_parentheses
3976
+ - require_no_parentheses
3977
+
3978
+ Style/StderrPuts:
3979
+ Description: 'Use `warn` instead of `$stderr.puts`.'
3980
+ StyleGuide: '#warn'
3981
+ Enabled: true
3982
+ VersionAdded: '0.51'
3983
+
3984
+ Style/StringHashKeys:
3985
+ Description: 'Prefer symbols instead of strings as hash keys.'
3986
+ StyleGuide: '#symbols-as-keys'
3987
+ Enabled: false
3988
+ VersionAdded: '0.52'
3989
+
3990
+ Style/StringLiterals:
3991
+ Description: 'Checks if uses of quotes match the configured preference.'
3992
+ StyleGuide: '#consistent-string-literals'
3993
+ Enabled: true
3994
+ VersionAdded: '0.9'
3995
+ VersionChanged: '0.36'
3996
+ EnforcedStyle: single_quotes
3997
+ SupportedStyles:
3998
+ - single_quotes
3999
+ - double_quotes
4000
+ # If `true`, strings which span multiple lines using `\` for continuation must
4001
+ # use the same type of quotes on each line.
4002
+ ConsistentQuotesInMultiline: false
4003
+
4004
+ Style/StringLiteralsInInterpolation:
4005
+ Description: >-
4006
+ Checks if uses of quotes inside expressions in interpolated
4007
+ strings match the configured preference.
4008
+ Enabled: true
4009
+ VersionAdded: '0.27'
4010
+ EnforcedStyle: single_quotes
4011
+ SupportedStyles:
4012
+ - single_quotes
4013
+ - double_quotes
4014
+
4015
+ Style/StringMethods:
4016
+ Description: 'Checks if configured preferred methods are used over non-preferred.'
4017
+ Enabled: false
4018
+ VersionAdded: '0.34'
4019
+ VersionChanged: '0.34.2'
4020
+ # Mapping from undesired method to desired_method
4021
+ # e.g. to use `to_sym` over `intern`:
4022
+ #
4023
+ # StringMethods:
4024
+ # PreferredMethods:
4025
+ # intern: to_sym
4026
+ PreferredMethods:
4027
+ intern: to_sym
4028
+
4029
+ Style/Strip:
4030
+ Description: 'Use `strip` instead of `lstrip.rstrip`.'
4031
+ Enabled: true
4032
+ VersionAdded: '0.36'
4033
+
4034
+ Style/StructInheritance:
4035
+ Description: 'Checks for inheritance from Struct.new.'
4036
+ StyleGuide: '#no-extend-struct-new'
4037
+ Enabled: true
4038
+ VersionAdded: '0.29'
4039
+
4040
+ Style/SymbolArray:
4041
+ Description: 'Use %i or %I for arrays of symbols.'
4042
+ StyleGuide: '#percent-i'
4043
+ Enabled: true
4044
+ VersionAdded: '0.9'
4045
+ VersionChanged: '0.49'
4046
+ EnforcedStyle: percent
4047
+ MinSize: 2
4048
+ SupportedStyles:
4049
+ - percent
4050
+ - brackets
4051
+
4052
+ Style/SymbolLiteral:
4053
+ Description: 'Use plain symbols instead of string symbols when possible.'
4054
+ Enabled: true
4055
+ VersionAdded: '0.30'
4056
+
4057
+ Style/SymbolProc:
4058
+ Description: 'Use symbols as procs instead of blocks when possible.'
4059
+ Enabled: true
4060
+ SafeAutoCorrect: false
4061
+ VersionAdded: '0.26'
4062
+ VersionChanged: '0.64'
4063
+ # A list of method names to be ignored by the check.
4064
+ # The names should be fairly unique, otherwise you'll end up ignoring lots of code.
4065
+ IgnoredMethods:
4066
+ - respond_to
4067
+ - define_method
4068
+
4069
+ Style/TernaryParentheses:
4070
+ Description: 'Checks for use of parentheses around ternary conditions.'
4071
+ Enabled: true
4072
+ VersionAdded: '0.42'
4073
+ VersionChanged: '0.46'
4074
+ EnforcedStyle: require_no_parentheses
4075
+ SupportedStyles:
4076
+ - require_parentheses
4077
+ - require_no_parentheses
4078
+ - require_parentheses_when_complex
4079
+ AllowSafeAssignment: true
4080
+
4081
+ Style/TrailingBodyOnClass:
4082
+ Description: 'Class body goes below class statement.'
4083
+ Enabled: true
4084
+ VersionAdded: '0.53'
4085
+
4086
+ Style/TrailingBodyOnMethodDefinition:
4087
+ Description: 'Method body goes below definition.'
4088
+ Enabled: true
4089
+ VersionAdded: '0.52'
4090
+
4091
+ Style/TrailingBodyOnModule:
4092
+ Description: 'Module body goes below module statement.'
4093
+ Enabled: true
4094
+ VersionAdded: '0.53'
4095
+
4096
+ Style/TrailingCommaInArguments:
4097
+ Description: 'Checks for trailing comma in argument lists.'
4098
+ StyleGuide: '#no-trailing-params-comma'
4099
+ Enabled: true
4100
+ VersionAdded: '0.36'
4101
+ # If `comma`, the cop requires a comma after the last argument, but only for
4102
+ # parenthesized method calls where each argument is on its own line.
4103
+ # If `consistent_comma`, the cop requires a comma after the last argument,
4104
+ # for all parenthesized method calls with arguments.
4105
+ EnforcedStyleForMultiline: no_comma
4106
+ SupportedStylesForMultiline:
4107
+ - comma
4108
+ - consistent_comma
4109
+ - no_comma
4110
+
4111
+ Style/TrailingCommaInArrayLiteral:
4112
+ Description: 'Checks for trailing comma in array literals.'
4113
+ StyleGuide: '#no-trailing-array-commas'
4114
+ Enabled: true
4115
+ VersionAdded: '0.53'
4116
+ # but only when each item is on its own line.
4117
+ # If `consistent_comma`, the cop requires a comma after the last item of all
4118
+ # non-empty array literals.
4119
+ EnforcedStyleForMultiline: no_comma
4120
+ SupportedStylesForMultiline:
4121
+ - comma
4122
+ - consistent_comma
4123
+ - no_comma
4124
+
4125
+ Style/TrailingCommaInHashLiteral:
4126
+ Description: 'Checks for trailing comma in hash literals.'
4127
+ Enabled: true
4128
+ # If `comma`, the cop requires a comma after the last item in a hash,
4129
+ # but only when each item is on its own line.
4130
+ # If `consistent_comma`, the cop requires a comma after the last item of all
4131
+ # non-empty hash literals.
4132
+ EnforcedStyleForMultiline: no_comma
4133
+ SupportedStylesForMultiline:
4134
+ - comma
4135
+ - consistent_comma
4136
+ - no_comma
4137
+ VersionAdded: '0.53'
4138
+
4139
+ Style/TrailingMethodEndStatement:
4140
+ Description: 'Checks for trailing end statement on line of method body.'
4141
+ Enabled: true
4142
+ VersionAdded: '0.52'
4143
+
4144
+ Style/TrailingUnderscoreVariable:
4145
+ Description: >-
4146
+ Checks for the usage of unneeded trailing underscores at the
4147
+ end of parallel variable assignment.
4148
+ AllowNamedUnderscoreVariables: true
4149
+ Enabled: true
4150
+ VersionAdded: '0.31'
4151
+ VersionChanged: '0.35'
4152
+
4153
+ # `TrivialAccessors` requires exact name matches and doesn't allow
4154
+ # predicated methods by default.
4155
+ Style/TrivialAccessors:
4156
+ Description: 'Prefer attr_* methods to trivial readers/writers.'
4157
+ StyleGuide: '#attr_family'
4158
+ Enabled: true
4159
+ VersionAdded: '0.9'
4160
+ VersionChanged: '0.38'
4161
+ # When set to `false` the cop will suggest the use of accessor methods
4162
+ # in situations like:
4163
+ #
4164
+ # def name
4165
+ # @other_name
4166
+ # end
4167
+ #
4168
+ # This way you can uncover "hidden" attributes in your code.
4169
+ ExactNameMatch: true
4170
+ AllowPredicates: true
4171
+ # Allows trivial writers that don't end in an equal sign. e.g.
4172
+ #
4173
+ # def on_exception(action)
4174
+ # @on_exception=action
4175
+ # end
4176
+ # on_exception :restart
4177
+ #
4178
+ # Commonly used in DSLs
4179
+ AllowDSLWriters: false
4180
+ IgnoreClassMethods: false
4181
+ Whitelist:
4182
+ - to_ary
4183
+ - to_a
4184
+ - to_c
4185
+ - to_enum
4186
+ - to_h
4187
+ - to_hash
4188
+ - to_i
4189
+ - to_int
4190
+ - to_io
4191
+ - to_open
4192
+ - to_path
4193
+ - to_proc
4194
+ - to_r
4195
+ - to_regexp
4196
+ - to_str
4197
+ - to_s
4198
+ - to_sym
4199
+
4200
+ Style/UnlessElse:
4201
+ Description: >-
4202
+ Do not use unless with else. Rewrite these with the positive
4203
+ case first.
4204
+ StyleGuide: '#no-else-with-unless'
4205
+ Enabled: true
4206
+ VersionAdded: '0.9'
4207
+
4208
+ Style/UnneededCapitalW:
4209
+ Description: 'Checks for %W when interpolation is not needed.'
4210
+ Enabled: true
4211
+ VersionAdded: '0.21'
4212
+ VersionChanged: '0.24'
4213
+
4214
+ Style/UnneededCondition:
4215
+ Description: 'Checks for unnecessary conditional expressions.'
4216
+ Enabled: true
4217
+ VersionAdded: '0.57'
4218
+
4219
+ Style/UnneededInterpolation:
4220
+ Description: 'Checks for strings that are just an interpolated expression.'
4221
+ Enabled: true
4222
+ VersionAdded: '0.36'
4223
+
4224
+ Style/UnneededPercentQ:
4225
+ Description: 'Checks for %q/%Q when single quotes or double quotes would do.'
4226
+ StyleGuide: '#percent-q'
4227
+ Enabled: true
4228
+ VersionAdded: '0.24'
4229
+
4230
+ Style/UnneededSort:
4231
+ Description: >-
4232
+ Use `min` instead of `sort.first`,
4233
+ `max_by` instead of `sort_by...last`, etc.
4234
+ Enabled: true
4235
+ VersionAdded: '0.55'
4236
+
4237
+ Style/UnpackFirst:
4238
+ Description: >-
4239
+ Checks for accessing the first element of `String#unpack`
4240
+ instead of using `unpack1`
4241
+ Enabled: true
4242
+ VersionAdded: '0.54'
4243
+
4244
+ Style/VariableInterpolation:
4245
+ Description: >-
4246
+ Don't interpolate global, instance and class variables
4247
+ directly in strings.
4248
+ StyleGuide: '#curlies-interpolate'
4249
+ Enabled: true
4250
+ VersionAdded: '0.9'
4251
+ VersionChanged: '0.20'
4252
+
4253
+ Style/WhenThen:
4254
+ Description: 'Use when x then ... for one-line cases.'
4255
+ StyleGuide: '#one-line-cases'
4256
+ Enabled: true
4257
+ VersionAdded: '0.9'
4258
+
4259
+ Style/WhileUntilDo:
4260
+ Description: 'Checks for redundant do after while or until.'
4261
+ StyleGuide: '#no-multiline-while-do'
4262
+ Enabled: true
4263
+ VersionAdded: '0.9'
4264
+
4265
+ Style/WhileUntilModifier:
4266
+ Description: >-
4267
+ Favor modifier while/until usage when you have a
4268
+ single-line body.
4269
+ StyleGuide: '#while-as-a-modifier'
4270
+ Enabled: true
4271
+ VersionAdded: '0.9'
4272
+ VersionChanged: '0.30'
4273
+
4274
+ Style/WordArray:
4275
+ Description: 'Use %w or %W for arrays of words.'
4276
+ StyleGuide: '#percent-w'
4277
+ Enabled: true
4278
+ VersionAdded: '0.9'
4279
+ VersionChanged: '0.36'
4280
+ EnforcedStyle: percent
4281
+ SupportedStyles:
4282
+ # percent style: %w(word1 word2)
4283
+ - percent
4284
+ # bracket style: ['word1', 'word2']
4285
+ - brackets
4286
+ # The `MinSize` option causes the `WordArray` rule to be ignored for arrays
4287
+ # smaller than a certain size. The rule is only applied to arrays
4288
+ # whose element count is greater than or equal to `MinSize`.
4289
+ MinSize: 2
4290
+ # The regular expression `WordRegex` decides what is considered a word.
4291
+ WordRegex: !ruby/regexp '/\A[\p{Word}\n\t]+\z/'
4292
+
4293
+ Style/YodaCondition:
4294
+ Description: 'Forbid or enforce yoda conditions.'
4295
+ Reference: 'https://en.wikipedia.org/wiki/Yoda_conditions'
4296
+ Enabled: true
4297
+ EnforcedStyle: forbid_for_all_comparison_operators
4298
+ SupportedStyles:
4299
+ # check all comparison operators
4300
+ - forbid_for_all_comparison_operators
4301
+ # check only equality operators: `!=` and `==`
4302
+ - forbid_for_equality_operators_only
4303
+ # enforce yoda for all comparison operators
4304
+ - require_for_all_comparison_operators
4305
+ # enforce yoda only for equality operators: `!=` and `==`
4306
+ - require_for_equality_operators_only
4307
+ VersionAdded: '0.49'
4308
+ VersionChanged: '0.63'
4309
+
4310
+ Style/ZeroLengthPredicate:
4311
+ Description: 'Use #empty? when testing for objects of length 0.'
4312
+ Enabled: true
4313
+ Safe: false
4314
+ VersionAdded: '0.37'
4315
+ VersionChanged: '0.39'