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