zt 0.1.1

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