talkie 0.3.4 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +3119 -0
- data/Gemfile.lock +98 -101
- data/lib/generators/talkie/views_generator.rb +7 -2
- data/lib/talkie/controller.rb +3 -1
- data/lib/talkie/engine.rb +1 -1
- data/lib/talkie/renderer_helper.rb +3 -1
- data/lib/talkie/version.rb +1 -1
- data/talkie.gemspec +27 -27
- metadata +35 -34
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 456d92927831d9a2d31907fd8e398a843fe25be01d469477a50cc571be07914e
|
4
|
+
data.tar.gz: 522c0ede58e706bd7bdfabd841c0107c98c003e9ae96e463ae1a1eda6b5ac723
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2fcfdfda256c6d206e38e2365c0f1d59d6b62d65f43e846ddc6a4a8b6af205a2f14936961cc044304a51879a39e1abecf1609fc8086c984231a2b54caaa85fbe
|
7
|
+
data.tar.gz: b839258069ceb2bf87b0736e5c45294c9e584fbd9fe463f17061062f9b0f02ecf005c69dc2b350371379dd408e199bfd3030c1d33a5893999d29ea0445962768
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,3119 @@
|
|
1
|
+
require: rubocop-rspec
|
2
|
+
|
3
|
+
# Common configuration.
|
4
|
+
AllCops:
|
5
|
+
# Include common Ruby source files.
|
6
|
+
Include:
|
7
|
+
- '**/*.arb'
|
8
|
+
- '**/*.axlsx'
|
9
|
+
- '**/*.builder'
|
10
|
+
- '**/*.fcgi'
|
11
|
+
- '**/*.gemfile'
|
12
|
+
- '**/*.gemspec'
|
13
|
+
- '**/*.god'
|
14
|
+
- '**/*.jb'
|
15
|
+
- '**/*.jbuilder'
|
16
|
+
- '**/*.mspec'
|
17
|
+
- '**/*.opal'
|
18
|
+
- '**/*.pluginspec'
|
19
|
+
- '**/*.podspec'
|
20
|
+
- '**/*.rabl'
|
21
|
+
- '**/*.rake'
|
22
|
+
- '**/*.rbuild'
|
23
|
+
- '**/*.rbw'
|
24
|
+
- '**/*.rbx'
|
25
|
+
- '**/*.ru'
|
26
|
+
- '**/*.ruby'
|
27
|
+
- '**/*.spec'
|
28
|
+
- '**/*.thor'
|
29
|
+
- '**/*.watchr'
|
30
|
+
- '**/.irbrc'
|
31
|
+
- '**/.pryrc'
|
32
|
+
- '**/buildfile'
|
33
|
+
- '**/config.ru'
|
34
|
+
- '**/Appraisals'
|
35
|
+
- '**/Berksfile'
|
36
|
+
- '**/Brewfile'
|
37
|
+
- '**/Buildfile'
|
38
|
+
- '**/Capfile'
|
39
|
+
- '**/Cheffile'
|
40
|
+
- '**/Dangerfile'
|
41
|
+
- '**/Deliverfile'
|
42
|
+
- '**/Fastfile'
|
43
|
+
- '**/*Fastfile'
|
44
|
+
- '**/Gemfile'
|
45
|
+
- '**/Guardfile'
|
46
|
+
- '**/Jarfile'
|
47
|
+
- '**/Mavenfile'
|
48
|
+
- '**/Podfile'
|
49
|
+
- '**/Puppetfile'
|
50
|
+
- '**/Rakefile'
|
51
|
+
- '**/Snapfile'
|
52
|
+
- '**/Thorfile'
|
53
|
+
- '**/Vagabondfile'
|
54
|
+
- '**/Vagrantfile'
|
55
|
+
Exclude:
|
56
|
+
- 'node_modules/**/*'
|
57
|
+
- 'vendor/**/*'
|
58
|
+
- '.git/**/*'
|
59
|
+
# Default formatter will be used if no `-f/--format` option is given.
|
60
|
+
DefaultFormatter: progress
|
61
|
+
# Cop names are displayed in offense messages by default. Change behavior
|
62
|
+
# by overriding DisplayCopNames, or by giving the `--no-display-cop-names`
|
63
|
+
# option.
|
64
|
+
DisplayCopNames: true
|
65
|
+
# Style guide URLs are not displayed in offense messages by default. Change
|
66
|
+
# behavior by overriding `DisplayStyleGuide`, or by giving the
|
67
|
+
# `-S/--display-style-guide` option.
|
68
|
+
DisplayStyleGuide: false
|
69
|
+
# When specifying style guide URLs, any paths and/or fragments will be
|
70
|
+
# evaluated relative to the base URL.
|
71
|
+
StyleGuideBaseURL: https://github.com/bbatsov/ruby-style-guide
|
72
|
+
# Extra details are not displayed in offense messages by default. Change
|
73
|
+
# behavior by overriding ExtraDetails, or by giving the
|
74
|
+
# `-E/--extra-details` option.
|
75
|
+
ExtraDetails: false
|
76
|
+
# Additional cops that do not reference a style guide rule may be enabled by
|
77
|
+
# default. Change behavior by overriding `StyleGuideCopsOnly`, or by giving
|
78
|
+
# the `--only-guide-cops` option.
|
79
|
+
StyleGuideCopsOnly: false
|
80
|
+
# All cops except the ones in disabled.yml are enabled by default. Change
|
81
|
+
# this behavior by overriding either `DisabledByDefault` or `EnabledByDefault`.
|
82
|
+
# When `DisabledByDefault` is `true`, all cops in the default configuration
|
83
|
+
# are disabled, and only cops in user configuration are enabled. This makes
|
84
|
+
# cops opt-in instead of opt-out. Note that when `DisabledByDefault` is `true`,
|
85
|
+
# cops in user configuration will be enabled even if they don't set the
|
86
|
+
# Enabled parameter.
|
87
|
+
# When `EnabledByDefault` is `true`, all cops, even those in disabled.yml,
|
88
|
+
# are enabled by default. Cops can still be disabled in user configuration.
|
89
|
+
# Note that it is invalid to set both EnabledByDefault and DisabledByDefault
|
90
|
+
# to true in the same configuration.
|
91
|
+
EnabledByDefault: false
|
92
|
+
DisabledByDefault: false
|
93
|
+
# Enables the result cache if `true`. Can be overridden by the `--cache` command
|
94
|
+
# line option.
|
95
|
+
UseCache: true
|
96
|
+
# Threshold for how many files can be stored in the result cache before some
|
97
|
+
# of the files are automatically removed.
|
98
|
+
MaxFilesInCache: 20000
|
99
|
+
# The cache will be stored in "rubocop_cache" under this directory. If
|
100
|
+
# CacheRootDirectory is ~ (nil), which it is by default, the root will be
|
101
|
+
# taken from the environment variable `$XDG_CACHE_HOME` if it is set, or if
|
102
|
+
# `$XDG_CACHE_HOME` is not set, it will be `$HOME/.cache/`.
|
103
|
+
CacheRootDirectory: ~
|
104
|
+
# It is possible for a malicious user to know the location of RuboCop's cache
|
105
|
+
# directory by looking at CacheRootDirectory, and create a symlink in its
|
106
|
+
# place that could cause RuboCop to overwrite unintended files, or read
|
107
|
+
# malicious input. If you are certain that your cache location is secure from
|
108
|
+
# this kind of attack, and wish to use a symlinked cache location, set this
|
109
|
+
# value to "true".
|
110
|
+
AllowSymlinksInCacheRootDirectory: false
|
111
|
+
# What MRI version of the Ruby interpreter is the inspected code intended to
|
112
|
+
# run on? (If there is more than one, set this to the lowest version.)
|
113
|
+
# If a value is specified for TargetRubyVersion then it is used. Acceptable
|
114
|
+
# values are specificed as a float (i.e. 2.5); the teeny version of Ruby
|
115
|
+
# should not be included. If the project specifies a Ruby version in the
|
116
|
+
# .ruby-version file, Gemfile or gems.rb file, RuboCop will try to determine
|
117
|
+
# the desired version of Ruby by inspecting the .ruby-version file first,
|
118
|
+
# followed by the Gemfile.lock or gems.locked file. (Although the Ruby version
|
119
|
+
# is specified in the Gemfile or gems.rb file, RuboCop reads the final value
|
120
|
+
# from the lock file.) If the Ruby version is still unresolved, RuboCop will
|
121
|
+
# use the oldest officially supported Ruby version (currently Ruby 2.1).
|
122
|
+
TargetRubyVersion: ~
|
123
|
+
# What version of Rails is the inspected code using? If a value is specified
|
124
|
+
# for TargetRailsVersion then it is used. Acceptable values are specificed
|
125
|
+
# as a float (i.e. 5.1); the patch version of Rails should not be included.
|
126
|
+
# If TargetRailsVersion is not set, RuboCop will parse the Gemfile.lock or
|
127
|
+
# gems.locked file to find the version of Rails that has been bound to the
|
128
|
+
# application. If neither of those files exist, RuboCop will use Rails 5.0
|
129
|
+
# as the default.
|
130
|
+
TargetRailsVersion: ~
|
131
|
+
|
132
|
+
#################### Layout ###########################
|
133
|
+
|
134
|
+
# Indent private/protected/public as deep as method definitions
|
135
|
+
Layout/AccessModifierIndentation:
|
136
|
+
Description: Check indentation of private/protected visibility modifiers.
|
137
|
+
StyleGuide: "#indent-public-private-protected"
|
138
|
+
Enabled: true
|
139
|
+
EnforcedStyle: indent
|
140
|
+
SupportedStyles:
|
141
|
+
- outdent
|
142
|
+
- indent
|
143
|
+
# By default, the indentation width from Layout/IndentationWidth is used
|
144
|
+
# But it can be overridden by setting this parameter
|
145
|
+
IndentationWidth: ~
|
146
|
+
|
147
|
+
# Align the elements of a hash literal if they span more than one line.
|
148
|
+
Layout/AlignHash:
|
149
|
+
Description: Align the elements of a hash literal if they span more than one line.
|
150
|
+
Enabled: true
|
151
|
+
# Alignment of entries using hash rocket as separator. Valid values are:
|
152
|
+
#
|
153
|
+
# key - left alignment of keys
|
154
|
+
# 'a' => 2
|
155
|
+
# 'bb' => 3
|
156
|
+
# separator - alignment of hash rockets, keys are right aligned
|
157
|
+
# 'a' => 2
|
158
|
+
# 'bb' => 3
|
159
|
+
# table - left alignment of keys, hash rockets, and values
|
160
|
+
# 'a' => 2
|
161
|
+
# 'bb' => 3
|
162
|
+
EnforcedHashRocketStyle: key
|
163
|
+
SupportedHashRocketStyles:
|
164
|
+
- key
|
165
|
+
- separator
|
166
|
+
- table
|
167
|
+
# Alignment of entries using colon as separator. Valid values are:
|
168
|
+
#
|
169
|
+
# key - left alignment of keys
|
170
|
+
# a: 0
|
171
|
+
# bb: 1
|
172
|
+
# separator - alignment of colons, keys are right aligned
|
173
|
+
# a: 0
|
174
|
+
# bb: 1
|
175
|
+
# table - left alignment of keys and values
|
176
|
+
# a: 0
|
177
|
+
# bb: 1
|
178
|
+
EnforcedColonStyle: key
|
179
|
+
SupportedColonStyles:
|
180
|
+
- key
|
181
|
+
- separator
|
182
|
+
- table
|
183
|
+
# Select whether hashes that are the last argument in a method call should be
|
184
|
+
# inspected? Valid values are:
|
185
|
+
#
|
186
|
+
# always_inspect - Inspect both implicit and explicit hashes.
|
187
|
+
# Registers an offense for:
|
188
|
+
# function(a: 1,
|
189
|
+
# b: 2)
|
190
|
+
# Registers an offense for:
|
191
|
+
# function({a: 1,
|
192
|
+
# b: 2})
|
193
|
+
# always_ignore - Ignore both implicit and explicit hashes.
|
194
|
+
# Accepts:
|
195
|
+
# function(a: 1,
|
196
|
+
# b: 2)
|
197
|
+
# Accepts:
|
198
|
+
# function({a: 1,
|
199
|
+
# b: 2})
|
200
|
+
# ignore_implicit - Ignore only implicit hashes.
|
201
|
+
# Accepts:
|
202
|
+
# function(a: 1,
|
203
|
+
# b: 2)
|
204
|
+
# Registers an offense for:
|
205
|
+
# function({a: 1,
|
206
|
+
# b: 2})
|
207
|
+
# ignore_explicit - Ignore only explicit hashes.
|
208
|
+
# Accepts:
|
209
|
+
# function({a: 1,
|
210
|
+
# b: 2})
|
211
|
+
# Registers an offense for:
|
212
|
+
# function(a: 1,
|
213
|
+
# b: 2)
|
214
|
+
EnforcedLastArgumentHashStyle: always_inspect
|
215
|
+
SupportedLastArgumentHashStyles:
|
216
|
+
- always_inspect
|
217
|
+
- always_ignore
|
218
|
+
- ignore_implicit
|
219
|
+
- ignore_explicit
|
220
|
+
|
221
|
+
Layout/AlignParameters:
|
222
|
+
Description: Align the parameters of a method call if they span more than one line.
|
223
|
+
StyleGuide: "#no-double-indent"
|
224
|
+
Enabled: true
|
225
|
+
# Alignment of parameters in multi-line method calls.
|
226
|
+
#
|
227
|
+
# The `with_first_parameter` style aligns the following lines along the same
|
228
|
+
# column as the first parameter.
|
229
|
+
#
|
230
|
+
# method_call(a,
|
231
|
+
# b)
|
232
|
+
#
|
233
|
+
# The `with_fixed_indentation` style aligns the following lines with one
|
234
|
+
# level of indentation relative to the start of the line with the method call.
|
235
|
+
#
|
236
|
+
# method_call(a,
|
237
|
+
# b)
|
238
|
+
EnforcedStyle: with_first_parameter
|
239
|
+
SupportedStyles:
|
240
|
+
- with_first_parameter
|
241
|
+
- with_fixed_indentation
|
242
|
+
# By default, the indentation width from Layout/IndentationWidth is used
|
243
|
+
# But it can be overridden by setting this parameter
|
244
|
+
IndentationWidth: ~
|
245
|
+
|
246
|
+
# checks whether the end keywords are aligned properly for `do` `end` blocks.
|
247
|
+
Layout/BlockAlignment:
|
248
|
+
Description: Align block ends correctly.
|
249
|
+
Enabled: true
|
250
|
+
# The value `start_of_block` means that the `end` should be aligned with line
|
251
|
+
# where the `do` keyword appears.
|
252
|
+
# The value `start_of_line` means it should be aligned with the whole
|
253
|
+
# expression's starting line.
|
254
|
+
# The value `either` means both are allowed.
|
255
|
+
EnforcedStyleAlignWith: either
|
256
|
+
SupportedStylesAlignWith:
|
257
|
+
- either
|
258
|
+
- start_of_block
|
259
|
+
- start_of_line
|
260
|
+
|
261
|
+
# Indentation of `when`.
|
262
|
+
Layout/CaseIndentation:
|
263
|
+
Description: Indentation of when in a case/when/[else/]end.
|
264
|
+
StyleGuide: "#indent-when-to-case"
|
265
|
+
Enabled: true
|
266
|
+
EnforcedStyle: case
|
267
|
+
SupportedStyles:
|
268
|
+
- case
|
269
|
+
- end
|
270
|
+
IndentOneStep: false
|
271
|
+
# By default, the indentation width from `Layout/IndentationWidth` is used.
|
272
|
+
# But it can be overridden by setting this parameter.
|
273
|
+
# This only matters if `IndentOneStep` is `true`
|
274
|
+
IndentationWidth: ~
|
275
|
+
|
276
|
+
Layout/ClassStructure:
|
277
|
+
Description: Enforces a configured order of definitions within a class body.
|
278
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#consistent-classes
|
279
|
+
Enabled: false
|
280
|
+
Categories:
|
281
|
+
module_inclusion:
|
282
|
+
- include
|
283
|
+
- prepend
|
284
|
+
- extend
|
285
|
+
ExpectedOrder:
|
286
|
+
- module_inclusion
|
287
|
+
- constants
|
288
|
+
- public_class_methods
|
289
|
+
- initializer
|
290
|
+
- public_methods
|
291
|
+
- protected_methods
|
292
|
+
- private_methods
|
293
|
+
|
294
|
+
Layout/DefEndAlignment:
|
295
|
+
Description: Align ends corresponding to defs correctly.
|
296
|
+
Enabled: true
|
297
|
+
# The value `def` means that `end` should be aligned with the def keyword.
|
298
|
+
# The value `start_of_line` means that `end` should be aligned with method
|
299
|
+
# calls like `private`, `public`, etc, if present in front of the `def`
|
300
|
+
# keyword on the same line.
|
301
|
+
EnforcedStyleAlignWith: start_of_line
|
302
|
+
SupportedStylesAlignWith:
|
303
|
+
- start_of_line
|
304
|
+
- def
|
305
|
+
AutoCorrect: false
|
306
|
+
Severity: warning
|
307
|
+
|
308
|
+
# Multi-line method chaining should be done with leading dots.
|
309
|
+
Layout/DotPosition:
|
310
|
+
Description: Checks the position of the dot in multi-line method calls.
|
311
|
+
StyleGuide: "#consistent-multi-line-chains"
|
312
|
+
Enabled: true
|
313
|
+
EnforcedStyle: leading
|
314
|
+
SupportedStyles:
|
315
|
+
- leading
|
316
|
+
- trailing
|
317
|
+
|
318
|
+
Layout/EmptyComment:
|
319
|
+
Description: Checks empty comment.
|
320
|
+
Enabled: true
|
321
|
+
AllowBorderComment: true
|
322
|
+
AllowMarginComment: true
|
323
|
+
|
324
|
+
# Use empty lines between defs.
|
325
|
+
Layout/EmptyLineBetweenDefs:
|
326
|
+
Description: Use empty lines between defs.
|
327
|
+
StyleGuide: "#empty-lines-between-methods"
|
328
|
+
Enabled: true
|
329
|
+
# If `true`, this parameter means that single line method definitions don't
|
330
|
+
# need an empty line between them.
|
331
|
+
AllowAdjacentOneLineDefs: false
|
332
|
+
# Can be array to specify minimum and maximum number of empty lines, e.g. [1, 2]
|
333
|
+
NumberOfEmptyLines: 1
|
334
|
+
|
335
|
+
Layout/EmptyLinesAroundBlockBody:
|
336
|
+
Description: Keeps track of empty lines around block bodies.
|
337
|
+
StyleGuide: "#empty-lines-around-bodies"
|
338
|
+
Enabled: true
|
339
|
+
EnforcedStyle: no_empty_lines
|
340
|
+
SupportedStyles:
|
341
|
+
- empty_lines
|
342
|
+
- no_empty_lines
|
343
|
+
|
344
|
+
Layout/EmptyLinesAroundClassBody:
|
345
|
+
Description: Keeps track of empty lines around class bodies.
|
346
|
+
StyleGuide: "#empty-lines-around-bodies"
|
347
|
+
Enabled: true
|
348
|
+
EnforcedStyle: no_empty_lines
|
349
|
+
SupportedStyles:
|
350
|
+
- empty_lines
|
351
|
+
- empty_lines_except_namespace
|
352
|
+
- empty_lines_special
|
353
|
+
- no_empty_lines
|
354
|
+
- beginning_only
|
355
|
+
- ending_only
|
356
|
+
|
357
|
+
Layout/EmptyLinesAroundModuleBody:
|
358
|
+
Description: Keeps track of empty lines around module bodies.
|
359
|
+
StyleGuide: "#empty-lines-around-bodies"
|
360
|
+
Enabled: true
|
361
|
+
EnforcedStyle: no_empty_lines
|
362
|
+
SupportedStyles:
|
363
|
+
- empty_lines
|
364
|
+
- empty_lines_except_namespace
|
365
|
+
- empty_lines_special
|
366
|
+
- no_empty_lines
|
367
|
+
|
368
|
+
# Align ends correctly.
|
369
|
+
Layout/EndAlignment:
|
370
|
+
Description: Align ends correctly.
|
371
|
+
Enabled: true
|
372
|
+
# The value `keyword` means that `end` should be aligned with the matching
|
373
|
+
# keyword (`if`, `while`, etc.).
|
374
|
+
# The value `variable` means that in assignments, `end` should be aligned
|
375
|
+
# with the start of the variable on the left hand side of `=`. In all other
|
376
|
+
# situations, `end` should still be aligned with the keyword.
|
377
|
+
# The value `start_of_line` means that `end` should be aligned with the start
|
378
|
+
# of the line which the matching keyword appears on.
|
379
|
+
EnforcedStyleAlignWith: keyword
|
380
|
+
SupportedStylesAlignWith:
|
381
|
+
- keyword
|
382
|
+
- variable
|
383
|
+
- start_of_line
|
384
|
+
AutoCorrect: false
|
385
|
+
Severity: warning
|
386
|
+
|
387
|
+
Layout/EndOfLine:
|
388
|
+
Description: Use Unix-style line endings.
|
389
|
+
StyleGuide: "#crlf"
|
390
|
+
Enabled: true
|
391
|
+
# The `native` style means that CR+LF (Carriage Return + Line Feed) is
|
392
|
+
# enforced on Windows, and LF is enforced on other platforms. The other styles
|
393
|
+
# mean LF and CR+LF, respectively.
|
394
|
+
EnforcedStyle: native
|
395
|
+
SupportedStyles:
|
396
|
+
- native
|
397
|
+
- lf
|
398
|
+
- crlf
|
399
|
+
|
400
|
+
Layout/ExtraSpacing:
|
401
|
+
Description: Do not use unnecessary spacing.
|
402
|
+
Enabled: true
|
403
|
+
# When true, allows most uses of extra spacing if the intent is to align
|
404
|
+
# things with the previous or next line, not counting empty lines or comment
|
405
|
+
# lines.
|
406
|
+
AllowForAlignment: true
|
407
|
+
# When true, forces the alignment of `=` in assignments on consecutive lines.
|
408
|
+
ForceEqualSignAlignment: false
|
409
|
+
|
410
|
+
Layout/FirstArrayElementLineBreak:
|
411
|
+
Description: Checks for a line break before the first element in a multi-line array.
|
412
|
+
Enabled: false
|
413
|
+
|
414
|
+
Layout/FirstHashElementLineBreak:
|
415
|
+
Description: Checks for a line break before the first element in a multi-line hash.
|
416
|
+
Enabled: false
|
417
|
+
|
418
|
+
Layout/FirstMethodArgumentLineBreak:
|
419
|
+
Description: Checks for a line break before the first argument in a multi-line method
|
420
|
+
call.
|
421
|
+
Enabled: false
|
422
|
+
|
423
|
+
Layout/FirstMethodParameterLineBreak:
|
424
|
+
Description: Checks for a line break before the first parameter in a multi-line
|
425
|
+
method parameter definition.
|
426
|
+
Enabled: false
|
427
|
+
|
428
|
+
Layout/IndentFirstArgument:
|
429
|
+
Description: Checks the indentation of the first parameter in a method call.
|
430
|
+
Enabled: true
|
431
|
+
EnforcedStyle: special_for_inner_method_call_in_parentheses
|
432
|
+
SupportedStyles:
|
433
|
+
# The first parameter should always be indented one step more than the
|
434
|
+
# preceding line.
|
435
|
+
- consistent
|
436
|
+
# The first parameter should normally be indented one step more than the
|
437
|
+
# preceding line, but if it's a parameter for a method call that is itself
|
438
|
+
# a parameter in a method call, then the inner parameter should be indented
|
439
|
+
# relative to the inner method.
|
440
|
+
- special_for_inner_method_call
|
441
|
+
# Same as `special_for_inner_method_call` except that the special rule only
|
442
|
+
# applies if the outer method call encloses its arguments in parentheses.
|
443
|
+
- special_for_inner_method_call_in_parentheses
|
444
|
+
# By default, the indentation width from `Layout/IndentationWidth` is used
|
445
|
+
# But it can be overridden by setting this parameter
|
446
|
+
IndentationWidth: ~
|
447
|
+
|
448
|
+
Layout/IndentationConsistency:
|
449
|
+
Description: Keep indentation straight.
|
450
|
+
StyleGuide: "#spaces-indentation"
|
451
|
+
Enabled: true
|
452
|
+
# The difference between `rails` and `normal` is that the `rails` style
|
453
|
+
# prescribes that in classes and modules the `protected` and `private`
|
454
|
+
# modifier keywords shall be indented the same as public methods and that
|
455
|
+
# protected and private members shall be indented one step more than the
|
456
|
+
# modifiers. Other than that, both styles mean that entities on the same
|
457
|
+
# logical depth shall have the same indentation.
|
458
|
+
EnforcedStyle: normal
|
459
|
+
SupportedStyles:
|
460
|
+
- normal
|
461
|
+
- rails
|
462
|
+
|
463
|
+
Layout/IndentationWidth:
|
464
|
+
Description: Use 2 spaces for indentation.
|
465
|
+
StyleGuide: "#spaces-indentation"
|
466
|
+
Enabled: true
|
467
|
+
# Number of spaces for each indentation level.
|
468
|
+
Width: 2
|
469
|
+
IgnoredPatterns: []
|
470
|
+
|
471
|
+
# Checks the indentation of the first element in an array literal.
|
472
|
+
Layout/IndentFirstArrayElement:
|
473
|
+
Description: Checks the indentation of the first element in an array literal.
|
474
|
+
Enabled: true
|
475
|
+
# The value `special_inside_parentheses` means that array literals with
|
476
|
+
# brackets that have their opening bracket on the same line as a surrounding
|
477
|
+
# opening round parenthesis, shall have their first element indented relative
|
478
|
+
# to the first position inside the parenthesis.
|
479
|
+
#
|
480
|
+
# The value `consistent` means that the indentation of the first element shall
|
481
|
+
# always be relative to the first position of the line where the opening
|
482
|
+
# bracket is.
|
483
|
+
#
|
484
|
+
# The value `align_brackets` means that the indentation of the first element
|
485
|
+
# shall always be relative to the position of the opening bracket.
|
486
|
+
EnforcedStyle: special_inside_parentheses
|
487
|
+
SupportedStyles:
|
488
|
+
- special_inside_parentheses
|
489
|
+
- consistent
|
490
|
+
- align_brackets
|
491
|
+
# By default, the indentation width from `Layout/IndentationWidth` is used
|
492
|
+
# But it can be overridden by setting this parameter
|
493
|
+
IndentationWidth: ~
|
494
|
+
|
495
|
+
# Checks the indentation of assignment RHS, when on a different line from LHS
|
496
|
+
Layout/IndentAssignment:
|
497
|
+
Description: Checks the indentation of the first line of the right-hand-side of
|
498
|
+
a multi-line assignment.
|
499
|
+
Enabled: true
|
500
|
+
# By default, the indentation width from `Layout/IndentationWidth` is used
|
501
|
+
# But it can be overridden by setting this parameter
|
502
|
+
IndentationWidth: ~
|
503
|
+
|
504
|
+
# Checks the indentation of the first key in a hash literal.
|
505
|
+
Layout/IndentFirstHashElement:
|
506
|
+
Description: Checks the indentation of the first key in a hash literal.
|
507
|
+
Enabled: true
|
508
|
+
# The value `special_inside_parentheses` means that hash literals with braces
|
509
|
+
# that have their opening brace on the same line as a surrounding opening
|
510
|
+
# round parenthesis, shall have their first key indented relative to the
|
511
|
+
# first position inside the parenthesis.
|
512
|
+
#
|
513
|
+
# The value `consistent` means that the indentation of the first key shall
|
514
|
+
# always be relative to the first position of the line where the opening
|
515
|
+
# brace is.
|
516
|
+
#
|
517
|
+
# The value `align_braces` means that the indentation of the first key shall
|
518
|
+
# always be relative to the position of the opening brace.
|
519
|
+
EnforcedStyle: special_inside_parentheses
|
520
|
+
SupportedStyles:
|
521
|
+
- special_inside_parentheses
|
522
|
+
- consistent
|
523
|
+
- align_braces
|
524
|
+
# By default, the indentation width from `Layout/IndentationWidth` is used
|
525
|
+
# But it can be overridden by setting this parameter
|
526
|
+
IndentationWidth: ~
|
527
|
+
|
528
|
+
Layout/IndentHeredoc:
|
529
|
+
Description: This cops checks the indentation of the here document bodies.
|
530
|
+
StyleGuide: "#squiggly-heredocs"
|
531
|
+
Enabled: true
|
532
|
+
EnforcedStyle: squiggly
|
533
|
+
SupportedStyles:
|
534
|
+
- squiggly
|
535
|
+
- active_support
|
536
|
+
- powerpack
|
537
|
+
- unindent
|
538
|
+
|
539
|
+
Layout/SpaceInLambdaLiteral:
|
540
|
+
Description: Checks for spaces in lambda literals.
|
541
|
+
Enabled: true
|
542
|
+
EnforcedStyle: require_no_space
|
543
|
+
SupportedStyles:
|
544
|
+
- require_no_space
|
545
|
+
- require_space
|
546
|
+
|
547
|
+
Layout/MultilineArrayBraceLayout:
|
548
|
+
Description: Checks that the closing brace in an array literal is either on the
|
549
|
+
same line as the last array element, or a new line.
|
550
|
+
Enabled: true
|
551
|
+
EnforcedStyle: symmetrical
|
552
|
+
SupportedStyles:
|
553
|
+
# symmetrical: closing brace is positioned in same way as opening brace
|
554
|
+
# new_line: closing brace is always on a new line
|
555
|
+
# same_line: closing brace is always on the same line as last element
|
556
|
+
- symmetrical
|
557
|
+
- new_line
|
558
|
+
- same_line
|
559
|
+
|
560
|
+
Layout/MultilineAssignmentLayout:
|
561
|
+
Description: Check for a newline after the assignment operator in multi-line assignments.
|
562
|
+
StyleGuide: "#indent-conditional-assignment"
|
563
|
+
Enabled: false
|
564
|
+
# The types of assignments which are subject to this rule.
|
565
|
+
SupportedTypes:
|
566
|
+
- block
|
567
|
+
- case
|
568
|
+
- class
|
569
|
+
- if
|
570
|
+
- kwbegin
|
571
|
+
- module
|
572
|
+
EnforcedStyle: new_line
|
573
|
+
SupportedStyles:
|
574
|
+
# Ensures that the assignment operator and the rhs are on the same line for
|
575
|
+
# the set of supported types.
|
576
|
+
- same_line
|
577
|
+
# Ensures that the assignment operator and the rhs are on separate lines
|
578
|
+
# for the set of supported types.
|
579
|
+
- new_line
|
580
|
+
|
581
|
+
Layout/MultilineHashBraceLayout:
|
582
|
+
Description: Checks that the closing brace in a hash literal is either on the same
|
583
|
+
line as the last hash element, or a new line.
|
584
|
+
Enabled: true
|
585
|
+
EnforcedStyle: symmetrical
|
586
|
+
SupportedStyles:
|
587
|
+
# symmetrical: closing brace is positioned in same way as opening brace
|
588
|
+
# new_line: closing brace is always on a new line
|
589
|
+
# same_line: closing brace is always on same line as last element
|
590
|
+
- symmetrical
|
591
|
+
- new_line
|
592
|
+
- same_line
|
593
|
+
|
594
|
+
Layout/MultilineMethodCallBraceLayout:
|
595
|
+
Description: Checks that the closing brace in a method call is either on the same
|
596
|
+
line as the last method argument, or a new line.
|
597
|
+
Enabled: true
|
598
|
+
EnforcedStyle: symmetrical
|
599
|
+
SupportedStyles:
|
600
|
+
# symmetrical: closing brace is positioned in same way as opening brace
|
601
|
+
# new_line: closing brace is always on a new line
|
602
|
+
# same_line: closing brace is always on the same line as last argument
|
603
|
+
- symmetrical
|
604
|
+
- new_line
|
605
|
+
- same_line
|
606
|
+
|
607
|
+
Layout/MultilineMethodCallIndentation:
|
608
|
+
Description: Checks indentation of method calls with the dot operator that span
|
609
|
+
more than one line.
|
610
|
+
Enabled: true
|
611
|
+
EnforcedStyle: aligned
|
612
|
+
SupportedStyles:
|
613
|
+
- aligned
|
614
|
+
- indented
|
615
|
+
- indented_relative_to_receiver
|
616
|
+
# By default, the indentation width from Layout/IndentationWidth is used
|
617
|
+
# But it can be overridden by setting this parameter
|
618
|
+
IndentationWidth: ~
|
619
|
+
|
620
|
+
Layout/MultilineMethodDefinitionBraceLayout:
|
621
|
+
Description: Checks that the closing brace in a method definition is either on the
|
622
|
+
same line as the last method parameter, or a new line.
|
623
|
+
Enabled: true
|
624
|
+
EnforcedStyle: symmetrical
|
625
|
+
SupportedStyles:
|
626
|
+
# symmetrical: closing brace is positioned in same way as opening brace
|
627
|
+
# new_line: closing brace is always on a new line
|
628
|
+
# same_line: closing brace is always on the same line as last parameter
|
629
|
+
- symmetrical
|
630
|
+
- new_line
|
631
|
+
- same_line
|
632
|
+
|
633
|
+
Layout/MultilineOperationIndentation:
|
634
|
+
Description: Checks indentation of binary operations that span more than one line.
|
635
|
+
Enabled: true
|
636
|
+
EnforcedStyle: aligned
|
637
|
+
SupportedStyles:
|
638
|
+
- aligned
|
639
|
+
- indented
|
640
|
+
# By default, the indentation width from `Layout/IndentationWidth` is used
|
641
|
+
# But it can be overridden by setting this parameter
|
642
|
+
IndentationWidth: ~
|
643
|
+
|
644
|
+
Layout/SpaceAroundBlockParameters:
|
645
|
+
Description: Checks the spacing inside and after block parameters pipes.
|
646
|
+
Enabled: true
|
647
|
+
EnforcedStyleInsidePipes: no_space
|
648
|
+
SupportedStylesInsidePipes:
|
649
|
+
- space
|
650
|
+
- no_space
|
651
|
+
|
652
|
+
Layout/SpaceAroundEqualsInParameterDefault:
|
653
|
+
Description: Checks that the equals signs in parameter default assignments have
|
654
|
+
or don't have surrounding space depending on configuration.
|
655
|
+
StyleGuide: "#spaces-around-equals"
|
656
|
+
Enabled: true
|
657
|
+
EnforcedStyle: space
|
658
|
+
SupportedStyles:
|
659
|
+
- space
|
660
|
+
- no_space
|
661
|
+
|
662
|
+
Layout/SpaceAroundOperators:
|
663
|
+
Description: Use a single space around operators.
|
664
|
+
StyleGuide: "#spaces-operators"
|
665
|
+
Enabled: true
|
666
|
+
# When `true`, allows most uses of extra spacing if the intent is to align
|
667
|
+
# with an operator on the previous or next line, not counting empty lines
|
668
|
+
# or comment lines.
|
669
|
+
AllowForAlignment: true
|
670
|
+
|
671
|
+
Layout/SpaceBeforeBlockBraces:
|
672
|
+
Description: Checks that the left block brace has or doesn't have space before it.
|
673
|
+
Enabled: true
|
674
|
+
EnforcedStyle: space
|
675
|
+
SupportedStyles:
|
676
|
+
- space
|
677
|
+
- no_space
|
678
|
+
EnforcedStyleForEmptyBraces: space
|
679
|
+
SupportedStylesForEmptyBraces:
|
680
|
+
- space
|
681
|
+
- no_space
|
682
|
+
|
683
|
+
Layout/SpaceBeforeFirstArg:
|
684
|
+
Description: Checks that exactly one space is used between a method name and the
|
685
|
+
first argument for method calls without parentheses.
|
686
|
+
Enabled: true
|
687
|
+
# When `true`, allows most uses of extra spacing if the intent is to align
|
688
|
+
# things with the previous or next line, not counting empty lines or comment
|
689
|
+
# lines.
|
690
|
+
AllowForAlignment: true
|
691
|
+
|
692
|
+
Layout/SpaceInsideArrayLiteralBrackets:
|
693
|
+
Description: Checks the spacing inside array literal brackets.
|
694
|
+
Enabled: true
|
695
|
+
EnforcedStyle: no_space
|
696
|
+
SupportedStyles:
|
697
|
+
- space
|
698
|
+
- no_space
|
699
|
+
# 'compact' normally requires a space inside the brackets, with the exception
|
700
|
+
# that successive left brackets or right brackets are collapsed together
|
701
|
+
- compact
|
702
|
+
EnforcedStyleForEmptyBrackets: no_space
|
703
|
+
SupportedStylesForEmptyBrackets:
|
704
|
+
- space
|
705
|
+
- no_space
|
706
|
+
|
707
|
+
Layout/SpaceInsideBlockBraces:
|
708
|
+
Description: Checks that block braces have or don't have surrounding space. For
|
709
|
+
blocks taking parameters, checks that the left brace has or doesn't have trailing
|
710
|
+
space.
|
711
|
+
Enabled: true
|
712
|
+
EnforcedStyle: space
|
713
|
+
SupportedStyles:
|
714
|
+
- space
|
715
|
+
- no_space
|
716
|
+
EnforcedStyleForEmptyBraces: no_space
|
717
|
+
SupportedStylesForEmptyBraces:
|
718
|
+
- space
|
719
|
+
- no_space
|
720
|
+
# Space between `{` and `|`. Overrides `EnforcedStyle` if there is a conflict.
|
721
|
+
SpaceBeforeBlockParameters: true
|
722
|
+
|
723
|
+
Layout/SpaceInsideHashLiteralBraces:
|
724
|
+
Description: Use spaces inside hash literal braces - or don't.
|
725
|
+
StyleGuide: "#spaces-operators"
|
726
|
+
Enabled: true
|
727
|
+
EnforcedStyle: space
|
728
|
+
SupportedStyles:
|
729
|
+
- space
|
730
|
+
- no_space
|
731
|
+
# 'compact' normally requires a space inside hash braces, with the exception
|
732
|
+
# that successive left braces or right braces are collapsed together
|
733
|
+
- compact
|
734
|
+
EnforcedStyleForEmptyBraces: no_space
|
735
|
+
SupportedStylesForEmptyBraces:
|
736
|
+
- space
|
737
|
+
- no_space
|
738
|
+
|
739
|
+
Layout/SpaceInsideReferenceBrackets:
|
740
|
+
Description: Checks the spacing inside referential brackets.
|
741
|
+
Enabled: true
|
742
|
+
EnforcedStyle: no_space
|
743
|
+
SupportedStyles:
|
744
|
+
- space
|
745
|
+
- no_space
|
746
|
+
EnforcedStyleForEmptyBrackets: no_space
|
747
|
+
SupportedStylesForEmptyBrackets:
|
748
|
+
- space
|
749
|
+
- no_space
|
750
|
+
|
751
|
+
Layout/SpaceInsideStringInterpolation:
|
752
|
+
Description: Checks for padding/surrounding spaces inside string interpolation.
|
753
|
+
StyleGuide: "#string-interpolation"
|
754
|
+
Enabled: true
|
755
|
+
EnforcedStyle: no_space
|
756
|
+
SupportedStyles:
|
757
|
+
- space
|
758
|
+
- no_space
|
759
|
+
|
760
|
+
Layout/Tab:
|
761
|
+
IndentationWidth:
|
762
|
+
Description: No hard tabs.
|
763
|
+
StyleGuide: "#spaces-indentation"
|
764
|
+
Enabled: true
|
765
|
+
Layout/TrailingBlankLines:
|
766
|
+
EnforcedStyle: final_newline
|
767
|
+
SupportedStyles:
|
768
|
+
- final_newline
|
769
|
+
- final_blank_line
|
770
|
+
Description: Checks trailing blank lines and final newline.
|
771
|
+
StyleGuide: "#newline-eof"
|
772
|
+
Enabled: true
|
773
|
+
|
774
|
+
Layout/AlignArray:
|
775
|
+
Description: Align the elements of an array literal if they span more than one line.
|
776
|
+
StyleGuide: "#align-multiline-arrays"
|
777
|
+
Enabled: true
|
778
|
+
Layout/BlockEndNewline:
|
779
|
+
Description: Put end statement of multiline block on its own line.
|
780
|
+
Enabled: true
|
781
|
+
Layout/ClosingParenthesisIndentation:
|
782
|
+
Description: Checks the indentation of hanging closing parentheses.
|
783
|
+
Enabled: true
|
784
|
+
Layout/CommentIndentation:
|
785
|
+
Description: Indentation of comments.
|
786
|
+
Enabled: true
|
787
|
+
Layout/ConditionPosition:
|
788
|
+
Description: Checks for condition placed in a confusing position relative to the
|
789
|
+
keyword.
|
790
|
+
StyleGuide: "#same-line-condition"
|
791
|
+
Enabled: true
|
792
|
+
Layout/ElseAlignment:
|
793
|
+
Description: Align elses and elsifs correctly.
|
794
|
+
Enabled: true
|
795
|
+
Layout/EmptyLineAfterMagicComment:
|
796
|
+
Description: Add an empty line after magic comments to separate them from code.
|
797
|
+
StyleGuide: "#separate-magic-comments-from-code"
|
798
|
+
Enabled: true
|
799
|
+
Layout/EmptyLines:
|
800
|
+
Description: Don't use several empty lines in a row.
|
801
|
+
StyleGuide: "#two-or-more-empty-lines"
|
802
|
+
Enabled: true
|
803
|
+
Layout/EmptyLinesAroundAccessModifier:
|
804
|
+
Description: Keep blank lines around access modifiers.
|
805
|
+
StyleGuide: "#empty-lines-around-access-modifier"
|
806
|
+
Enabled: true
|
807
|
+
Layout/EmptyLinesAroundArguments:
|
808
|
+
Description: Keeps track of empty lines around method arguments.
|
809
|
+
Enabled: true
|
810
|
+
Layout/EmptyLinesAroundBeginBody:
|
811
|
+
Description: Keeps track of empty lines around begin-end bodies.
|
812
|
+
StyleGuide: "#empty-lines-around-bodies"
|
813
|
+
Enabled: true
|
814
|
+
Layout/EmptyLinesAroundExceptionHandlingKeywords:
|
815
|
+
Description: Keeps track of empty lines around exception handling keywords.
|
816
|
+
StyleGuide: "#empty-lines-around-bodies"
|
817
|
+
Enabled: true
|
818
|
+
Layout/EmptyLinesAroundMethodBody:
|
819
|
+
Description: Keeps track of empty lines around method bodies.
|
820
|
+
StyleGuide: "#empty-lines-around-bodies"
|
821
|
+
Enabled: true
|
822
|
+
Layout/InitialIndentation:
|
823
|
+
Description: Checks the indentation of the first non-blank non-comment line in a
|
824
|
+
file.
|
825
|
+
Enabled: true
|
826
|
+
Layout/LeadingCommentSpace:
|
827
|
+
Description: Comments should start with a space.
|
828
|
+
StyleGuide: "#hash-space"
|
829
|
+
Enabled: true
|
830
|
+
Layout/MultilineBlockLayout:
|
831
|
+
Description: Ensures newlines after multiline block do statements.
|
832
|
+
Enabled: true
|
833
|
+
Layout/RescueEnsureAlignment:
|
834
|
+
Description: Align rescues and ensures correctly.
|
835
|
+
Enabled: true
|
836
|
+
Layout/SpaceAfterColon:
|
837
|
+
Description: Use spaces after colons.
|
838
|
+
StyleGuide: "#spaces-operators"
|
839
|
+
Enabled: true
|
840
|
+
Layout/SpaceAfterComma:
|
841
|
+
Description: Use spaces after commas.
|
842
|
+
StyleGuide: "#spaces-operators"
|
843
|
+
Enabled: true
|
844
|
+
Layout/SpaceAfterMethodName:
|
845
|
+
Description: Do not put a space between a method name and the opening parenthesis
|
846
|
+
in a method definition.
|
847
|
+
StyleGuide: "#parens-no-spaces"
|
848
|
+
Enabled: true
|
849
|
+
Layout/SpaceAfterNot:
|
850
|
+
Description: Tracks redundant space after the ! operator.
|
851
|
+
StyleGuide: "#no-space-bang"
|
852
|
+
Enabled: true
|
853
|
+
Layout/SpaceAfterSemicolon:
|
854
|
+
Description: Use spaces after semicolons.
|
855
|
+
StyleGuide: "#spaces-operators"
|
856
|
+
Enabled: true
|
857
|
+
Layout/SpaceAroundKeyword:
|
858
|
+
Description: Use a space around keywords if appropriate.
|
859
|
+
Enabled: true
|
860
|
+
Layout/SpaceBeforeComma:
|
861
|
+
Description: No spaces before commas.
|
862
|
+
Enabled: true
|
863
|
+
|
864
|
+
Layout/SpaceBeforeComment:
|
865
|
+
Description: Checks for missing space between code and a comment on the same line.
|
866
|
+
Enabled: true
|
867
|
+
|
868
|
+
Layout/SpaceBeforeSemicolon:
|
869
|
+
Description: No spaces before semicolons.
|
870
|
+
Enabled: true
|
871
|
+
|
872
|
+
Layout/SpaceInsideArrayPercentLiteral:
|
873
|
+
Description: No unnecessary additional spaces between elements in %i/%w literals.
|
874
|
+
Enabled: true
|
875
|
+
|
876
|
+
Layout/SpaceInsideParens:
|
877
|
+
Description: No spaces after ( or before ).
|
878
|
+
StyleGuide: "#spaces-braces"
|
879
|
+
Enabled: true
|
880
|
+
|
881
|
+
Layout/SpaceInsidePercentLiteralDelimiters:
|
882
|
+
Description: No unnecessary spaces inside delimiters of %i/%w/%x literals.
|
883
|
+
Enabled: true
|
884
|
+
|
885
|
+
Layout/SpaceInsideRangeLiteral:
|
886
|
+
Description: No spaces inside range literals.
|
887
|
+
StyleGuide: "#no-space-inside-range-literals"
|
888
|
+
Enabled: true
|
889
|
+
|
890
|
+
Layout/TrailingWhitespace:
|
891
|
+
Description: Avoid trailing whitespace.
|
892
|
+
StyleGuide: "#no-trailing-whitespace"
|
893
|
+
Enabled: true
|
894
|
+
|
895
|
+
#################### Naming ##########################
|
896
|
+
|
897
|
+
Naming/AccessorMethodName:
|
898
|
+
Description: Check the naming of accessor methods for get_/set_.
|
899
|
+
StyleGuide: "#accessor_mutator_method_names"
|
900
|
+
Enabled: true
|
901
|
+
|
902
|
+
Naming/AsciiIdentifiers:
|
903
|
+
Description: Use only ascii symbols in identifiers.
|
904
|
+
StyleGuide: "#english-identifiers"
|
905
|
+
Enabled: true
|
906
|
+
|
907
|
+
Naming/BinaryOperatorParameterName:
|
908
|
+
Description: When defining binary operators, name the argument other.
|
909
|
+
StyleGuide: "#other-arg"
|
910
|
+
Enabled: true
|
911
|
+
|
912
|
+
Naming/ClassAndModuleCamelCase:
|
913
|
+
Description: Use CamelCase for classes and modules.
|
914
|
+
StyleGuide: "#camelcase-classes"
|
915
|
+
Enabled: true
|
916
|
+
|
917
|
+
Naming/ConstantName:
|
918
|
+
Description: Constants should use SCREAMING_SNAKE_CASE.
|
919
|
+
StyleGuide: "#screaming-snake-case"
|
920
|
+
Enabled: true
|
921
|
+
|
922
|
+
Naming/FileName:
|
923
|
+
Description: Use snake_case for source file names.
|
924
|
+
StyleGuide: "#snake-case-files"
|
925
|
+
Enabled: true
|
926
|
+
# File names listed in `AllCops:Include` are excluded by default. Add extra
|
927
|
+
# excludes here.
|
928
|
+
Exclude: []
|
929
|
+
# When `true`, requires that each source file should define a class or module
|
930
|
+
# with a name which matches the file name (converted to ... case).
|
931
|
+
# It further expects it to be nested inside modules which match the names
|
932
|
+
# of subdirectories in its path.
|
933
|
+
ExpectMatchingDefinition: false
|
934
|
+
# If non-`nil`, expect all source file names to match the following regex.
|
935
|
+
# Only the file name itself is matched, not the entire file path.
|
936
|
+
# Use anchors as necessary if you want to match the entire name rather than
|
937
|
+
# just a part of it.
|
938
|
+
Regex: ~
|
939
|
+
# With `IgnoreExecutableScripts` set to `true`, this cop does not
|
940
|
+
# report offending filenames for executable scripts (i.e. source
|
941
|
+
# files with a shebang in the first line).
|
942
|
+
IgnoreExecutableScripts: true
|
943
|
+
AllowedAcronyms:
|
944
|
+
- CLI
|
945
|
+
- DSL
|
946
|
+
- ACL
|
947
|
+
- API
|
948
|
+
- ASCII
|
949
|
+
- CPU
|
950
|
+
- CSS
|
951
|
+
- DNS
|
952
|
+
- EOF
|
953
|
+
- GUID
|
954
|
+
- HTML
|
955
|
+
- HTTP
|
956
|
+
- HTTPS
|
957
|
+
- ID
|
958
|
+
- IP
|
959
|
+
- JSON
|
960
|
+
- LHS
|
961
|
+
- QPS
|
962
|
+
- RAM
|
963
|
+
- RHS
|
964
|
+
- RPC
|
965
|
+
- SLA
|
966
|
+
- SMTP
|
967
|
+
- SQL
|
968
|
+
- SSH
|
969
|
+
- TCP
|
970
|
+
- TLS
|
971
|
+
- TTL
|
972
|
+
- UDP
|
973
|
+
- UI
|
974
|
+
- UID
|
975
|
+
- UUID
|
976
|
+
- URI
|
977
|
+
- URL
|
978
|
+
- UTF8
|
979
|
+
- VM
|
980
|
+
- XML
|
981
|
+
- XMPP
|
982
|
+
- XSRF
|
983
|
+
- XSS
|
984
|
+
|
985
|
+
Naming/HeredocDelimiterNaming:
|
986
|
+
Description: Use descriptive heredoc delimiters.
|
987
|
+
StyleGuide: "#heredoc-delimiters"
|
988
|
+
Enabled: true
|
989
|
+
Blacklist:
|
990
|
+
- END
|
991
|
+
- !ruby/regexp /EO[A-Z]{1}/
|
992
|
+
|
993
|
+
Naming/HeredocDelimiterCase:
|
994
|
+
Description: Use configured case for heredoc delimiters.
|
995
|
+
StyleGuide: "#heredoc-delimiters"
|
996
|
+
Enabled: true
|
997
|
+
EnforcedStyle: uppercase
|
998
|
+
SupportedStyles:
|
999
|
+
- lowercase
|
1000
|
+
- uppercase
|
1001
|
+
|
1002
|
+
Naming/MemoizedInstanceVariableName:
|
1003
|
+
Description: Memoized method name should match memo instance variable name.
|
1004
|
+
Enabled: true
|
1005
|
+
|
1006
|
+
Naming/MethodName:
|
1007
|
+
Description: Use the configured style when naming methods.
|
1008
|
+
StyleGuide: "#snake-case-symbols-methods-vars"
|
1009
|
+
Enabled: true
|
1010
|
+
EnforcedStyle: snake_case
|
1011
|
+
SupportedStyles:
|
1012
|
+
- snake_case
|
1013
|
+
- camelCase
|
1014
|
+
|
1015
|
+
Naming/PredicateName:
|
1016
|
+
Description: Check the names of predicate methods.
|
1017
|
+
StyleGuide: "#bool-methods-qmark"
|
1018
|
+
Enabled: true
|
1019
|
+
# Predicate name prefixes.
|
1020
|
+
NamePrefix:
|
1021
|
+
- is_
|
1022
|
+
- has_
|
1023
|
+
- have_
|
1024
|
+
# Predicate name prefixes that should be removed.
|
1025
|
+
NamePrefixBlacklist:
|
1026
|
+
- is_
|
1027
|
+
- has_
|
1028
|
+
- have_
|
1029
|
+
# Predicate names which, despite having a blacklisted prefix, or no `?`,
|
1030
|
+
# should still be accepted
|
1031
|
+
NameWhitelist:
|
1032
|
+
- is_a?
|
1033
|
+
# Method definition macros for dynamically generated methods.
|
1034
|
+
MethodDefinitionMacros:
|
1035
|
+
- define_method
|
1036
|
+
- define_singleton_method
|
1037
|
+
# Exclude Rspec specs because there is a strong convention to write spec
|
1038
|
+
# helpers in the form of `have_something` or `be_something`.
|
1039
|
+
Exclude:
|
1040
|
+
- 'spec/**/*'
|
1041
|
+
|
1042
|
+
Naming/UncommunicativeBlockParamName:
|
1043
|
+
Description: Checks for block parameter names that contain capital letters, end
|
1044
|
+
in numbers, or do not meet a minimal length.
|
1045
|
+
Enabled: true
|
1046
|
+
# Parameter names may be equal to or greater than this value
|
1047
|
+
MinNameLength: 1
|
1048
|
+
AllowNamesEndingInNumbers: true
|
1049
|
+
# Whitelisted names that will not register an offense
|
1050
|
+
AllowedNames: []
|
1051
|
+
# Blacklisted names that will register an offense
|
1052
|
+
ForbiddenNames: []
|
1053
|
+
|
1054
|
+
Naming/UncommunicativeMethodParamName:
|
1055
|
+
Description: Checks for method parameter names that contain capital letters, end
|
1056
|
+
in numbers, or do not meet a minimal length.
|
1057
|
+
Enabled: true
|
1058
|
+
# Parameter names may be equal to or greater than this value
|
1059
|
+
MinNameLength: 3
|
1060
|
+
AllowNamesEndingInNumbers: true
|
1061
|
+
# Whitelisted names that will not register an offense
|
1062
|
+
AllowedNames:
|
1063
|
+
- io
|
1064
|
+
- id
|
1065
|
+
- to
|
1066
|
+
# Blacklisted names that will register an offense
|
1067
|
+
ForbiddenNames: []
|
1068
|
+
|
1069
|
+
Naming/VariableName:
|
1070
|
+
Description: Use the configured style when naming variables.
|
1071
|
+
StyleGuide: "#snake-case-symbols-methods-vars"
|
1072
|
+
Enabled: true
|
1073
|
+
EnforcedStyle: snake_case
|
1074
|
+
SupportedStyles:
|
1075
|
+
- snake_case
|
1076
|
+
- camelCase
|
1077
|
+
|
1078
|
+
Naming/VariableNumber:
|
1079
|
+
Description: Use the configured style when numbering variables.
|
1080
|
+
Enabled: true
|
1081
|
+
EnforcedStyle: normalcase
|
1082
|
+
SupportedStyles:
|
1083
|
+
- snake_case
|
1084
|
+
- normalcase
|
1085
|
+
- non_integer
|
1086
|
+
|
1087
|
+
#################### Style ###########################
|
1088
|
+
|
1089
|
+
Style/MinMax:
|
1090
|
+
Description: Use `Enumerable#minmax` instead of `Enumerable#min` and `Enumerable#max`
|
1091
|
+
in conjunction.'
|
1092
|
+
Enabled: true
|
1093
|
+
Style/MixinUsage:
|
1094
|
+
Description: Checks that `include`, `extend` and `prepend` exists at the top level.
|
1095
|
+
Enabled: true
|
1096
|
+
Style/MultilineBlockChain:
|
1097
|
+
Description: Avoid multi-line chains of blocks.
|
1098
|
+
StyleGuide: "#single-line-blocks"
|
1099
|
+
Enabled: true
|
1100
|
+
Style/MultilineIfModifier:
|
1101
|
+
Description: Only use if/unless modifiers on single line statements.
|
1102
|
+
StyleGuide: "#no-multiline-if-modifiers"
|
1103
|
+
Enabled: true
|
1104
|
+
Style/MultilineIfThen:
|
1105
|
+
Description: Do not use then for multi-line if/unless.
|
1106
|
+
StyleGuide: "#no-then"
|
1107
|
+
Enabled: true
|
1108
|
+
Style/MultilineTernaryOperator:
|
1109
|
+
Description: 'Avoid multi-line ?: (the ternary operator); use if/unless instead.'
|
1110
|
+
StyleGuide: "#no-multiline-ternary"
|
1111
|
+
Enabled: true
|
1112
|
+
Style/MultipleComparison:
|
1113
|
+
Description: Avoid comparing a variable with multiple items in a conditional, use
|
1114
|
+
Array#include? instead.
|
1115
|
+
Enabled: true
|
1116
|
+
Style/MutableConstant:
|
1117
|
+
Description: Do not assign mutable objects to constants.
|
1118
|
+
Enabled: true
|
1119
|
+
Style/NegatedWhile:
|
1120
|
+
Description: Favor until over while for negative conditions.
|
1121
|
+
StyleGuide: "#until-for-negatives"
|
1122
|
+
Enabled: true
|
1123
|
+
Style/NestedModifier:
|
1124
|
+
Description: Avoid using nested modifiers.
|
1125
|
+
StyleGuide: "#no-nested-modifiers"
|
1126
|
+
Enabled: true
|
1127
|
+
Style/NestedTernaryOperator:
|
1128
|
+
Description: Use one expression per branch in a ternary operator.
|
1129
|
+
StyleGuide: "#no-nested-ternary"
|
1130
|
+
Enabled: true
|
1131
|
+
Style/NilComparison:
|
1132
|
+
Description: Prefer x.nil? to x == nil.
|
1133
|
+
StyleGuide: "#predicate-methods"
|
1134
|
+
Enabled: true
|
1135
|
+
Style/Not:
|
1136
|
+
Description: Use ! instead of not.
|
1137
|
+
StyleGuide: "#bang-not-not"
|
1138
|
+
Enabled: true
|
1139
|
+
Style/OneLineConditional:
|
1140
|
+
Description: Favor the ternary operator(?:) over if/then/else/end constructs.
|
1141
|
+
StyleGuide: "#ternary-operator"
|
1142
|
+
Enabled: true
|
1143
|
+
Style/OptionalArguments:
|
1144
|
+
Description: Checks for optional arguments that do not appear at the end of the
|
1145
|
+
argument list
|
1146
|
+
StyleGuide: "#optional-arguments"
|
1147
|
+
Enabled: true
|
1148
|
+
Style/OrAssignment:
|
1149
|
+
Description: Recommend usage of double pipe equals (||=) where applicable.
|
1150
|
+
StyleGuide: "#double-pipe-for-uninit"
|
1151
|
+
Enabled: true
|
1152
|
+
Style/ParallelAssignment:
|
1153
|
+
Description: Check for simple usages of parallel assignment. It will only warn when
|
1154
|
+
the number of variables matches on both sides of the assignment.
|
1155
|
+
StyleGuide: "#parallel-assignment"
|
1156
|
+
Enabled: true
|
1157
|
+
Style/PerlBackrefs:
|
1158
|
+
Description: Avoid Perl-style regex back references.
|
1159
|
+
StyleGuide: "#no-perl-regexp-last-matchers"
|
1160
|
+
Enabled: true
|
1161
|
+
Style/Proc:
|
1162
|
+
Description: Use proc instead of Proc.new.
|
1163
|
+
StyleGuide: "#proc"
|
1164
|
+
Enabled: true
|
1165
|
+
Style/RandomWithOffset:
|
1166
|
+
Description: Prefer to use ranges when generating random numbers instead of integers
|
1167
|
+
with offsets.
|
1168
|
+
StyleGuide: "#random-numbers"
|
1169
|
+
Enabled: true
|
1170
|
+
Style/RedundantBegin:
|
1171
|
+
Description: Don't use begin blocks when they are not needed.
|
1172
|
+
StyleGuide: "#begin-implicit"
|
1173
|
+
Enabled: true
|
1174
|
+
Style/RedundantConditional:
|
1175
|
+
Description: Don't return true/false from a conditional.
|
1176
|
+
Enabled: true
|
1177
|
+
Style/RedundantException:
|
1178
|
+
Description: Checks for an obsolete RuntimeException argument in raise/fail.
|
1179
|
+
StyleGuide: "#no-explicit-runtimeerror"
|
1180
|
+
Enabled: true
|
1181
|
+
Style/RedundantFreeze:
|
1182
|
+
Description: Checks usages of Object#freeze on immutable objects.
|
1183
|
+
Enabled: true
|
1184
|
+
Style/RedundantParentheses:
|
1185
|
+
Description: Checks for parentheses that seem not to serve any purpose.
|
1186
|
+
Enabled: true
|
1187
|
+
Style/RedundantSelf:
|
1188
|
+
Description: Don't use self where it's not needed.
|
1189
|
+
StyleGuide: "#no-self-unless-required"
|
1190
|
+
Enabled: true
|
1191
|
+
Style/RescueModifier:
|
1192
|
+
Description: Avoid using rescue in its modifier form.
|
1193
|
+
StyleGuide: "#no-rescue-modifiers"
|
1194
|
+
Enabled: true
|
1195
|
+
Style/SelfAssignment:
|
1196
|
+
Description: Checks for places where self-assignment shorthand should have been
|
1197
|
+
used.
|
1198
|
+
StyleGuide: "#self-assignment"
|
1199
|
+
Enabled: true
|
1200
|
+
Style/StderrPuts:
|
1201
|
+
Description: Use `warn` instead of `$stderr.puts`.
|
1202
|
+
StyleGuide: "#warn"
|
1203
|
+
Enabled: true
|
1204
|
+
Style/StructInheritance:
|
1205
|
+
Description: Checks for inheritance from Struct.new.
|
1206
|
+
StyleGuide: "#no-extend-struct-new"
|
1207
|
+
Enabled: true
|
1208
|
+
Style/SymbolLiteral:
|
1209
|
+
Description: Use plain symbols instead of string symbols when possible.
|
1210
|
+
Enabled: true
|
1211
|
+
|
1212
|
+
|
1213
|
+
# ==========================
|
1214
|
+
|
1215
|
+
|
1216
|
+
# =========================================
|
1217
|
+
|
1218
|
+
Style/Alias:
|
1219
|
+
Description: Use alias instead of alias_method.
|
1220
|
+
StyleGuide: "#alias-method"
|
1221
|
+
Enabled: true
|
1222
|
+
EnforcedStyle: prefer_alias
|
1223
|
+
SupportedStyles:
|
1224
|
+
- prefer_alias
|
1225
|
+
- prefer_alias_method
|
1226
|
+
|
1227
|
+
Style/AndOr:
|
1228
|
+
# Whether `and` and `or` are banned only in conditionals (conditionals)
|
1229
|
+
# or completely (always).
|
1230
|
+
Description: Use &&/|| instead of and/or.
|
1231
|
+
StyleGuide: "#no-and-or-or"
|
1232
|
+
Enabled: true
|
1233
|
+
EnforcedStyle: always
|
1234
|
+
SupportedStyles:
|
1235
|
+
- always
|
1236
|
+
- conditionals
|
1237
|
+
|
1238
|
+
Style/ArrayJoin:
|
1239
|
+
Description: Use Array#join instead of Array#*.
|
1240
|
+
StyleGuide: "#array-join"
|
1241
|
+
Enabled: true
|
1242
|
+
|
1243
|
+
Style/AsciiComments:
|
1244
|
+
Description: Use only ascii symbols in comments.
|
1245
|
+
StyleGuide: "#english-comments"
|
1246
|
+
Enabled: true
|
1247
|
+
AllowedChars: []
|
1248
|
+
|
1249
|
+
Style/Attr:
|
1250
|
+
Description: Checks for uses of Module#attr.
|
1251
|
+
StyleGuide: "#attr"
|
1252
|
+
Enabled: true
|
1253
|
+
|
1254
|
+
Style/AutoResourceCleanup:
|
1255
|
+
Description: Suggests the usage of an auto resource cleanup version of a method
|
1256
|
+
(if available).
|
1257
|
+
Enabled: false
|
1258
|
+
|
1259
|
+
# Checks if usage of `%()` or `%Q()` matches configuration.
|
1260
|
+
Style/BarePercentLiterals:
|
1261
|
+
Description: Checks if usage of %() or %Q() matches configuration.
|
1262
|
+
StyleGuide: "#percent-q-shorthand"
|
1263
|
+
Enabled: true
|
1264
|
+
EnforcedStyle: bare_percent
|
1265
|
+
SupportedStyles:
|
1266
|
+
- percent_q
|
1267
|
+
- bare_percent
|
1268
|
+
|
1269
|
+
Style/BeginBlock:
|
1270
|
+
Description: Avoid the use of BEGIN blocks.
|
1271
|
+
StyleGuide: "#no-BEGIN-blocks"
|
1272
|
+
Enabled: true
|
1273
|
+
|
1274
|
+
Style/BlockComments:
|
1275
|
+
Description: Do not use block comments.
|
1276
|
+
StyleGuide: "#no-block-comments"
|
1277
|
+
Enabled: true
|
1278
|
+
|
1279
|
+
Style/BlockDelimiters:
|
1280
|
+
Description: Avoid using {...} for multi-line blocks (multiline chaining is always
|
1281
|
+
ugly). Prefer {...} over do...end for single-line blocks.
|
1282
|
+
StyleGuide: "#single-line-blocks"
|
1283
|
+
Enabled: true
|
1284
|
+
EnforcedStyle: line_count_based
|
1285
|
+
SupportedStyles:
|
1286
|
+
# The `line_count_based` style enforces braces around single line blocks and
|
1287
|
+
# do..end around multi-line blocks.
|
1288
|
+
- line_count_based
|
1289
|
+
# The `semantic` style enforces braces around functional blocks, where the
|
1290
|
+
# primary purpose of the block is to return a value and do..end for
|
1291
|
+
# procedural blocks, where the primary purpose of the block is its
|
1292
|
+
# side-effects.
|
1293
|
+
#
|
1294
|
+
# This looks at the usage of a block's method to determine its type (e.g. is
|
1295
|
+
# the result of a `map` assigned to a variable or passed to another
|
1296
|
+
# method) but exceptions are permitted in the `ProceduralMethods`,
|
1297
|
+
# `FunctionalMethods` and `IgnoredMethods` sections below.
|
1298
|
+
- semantic
|
1299
|
+
# The `braces_for_chaining` style enforces braces around single line blocks
|
1300
|
+
# and do..end around multi-line blocks, except for multi-line blocks whose
|
1301
|
+
# return value is being chained with another method (in which case braces
|
1302
|
+
# are enforced).
|
1303
|
+
- braces_for_chaining
|
1304
|
+
ProceduralMethods:
|
1305
|
+
# Methods that are known to be procedural in nature but look functional from
|
1306
|
+
# their usage, e.g.
|
1307
|
+
#
|
1308
|
+
# time = Benchmark.realtime do
|
1309
|
+
# foo.bar
|
1310
|
+
# end
|
1311
|
+
#
|
1312
|
+
# Here, the return value of the block is discarded but the return value of
|
1313
|
+
# `Benchmark.realtime` is used.
|
1314
|
+
- benchmark
|
1315
|
+
- bm
|
1316
|
+
- bmbm
|
1317
|
+
- create
|
1318
|
+
- each_with_object
|
1319
|
+
- measure
|
1320
|
+
- new
|
1321
|
+
- realtime
|
1322
|
+
- tap
|
1323
|
+
- with_object
|
1324
|
+
FunctionalMethods:
|
1325
|
+
# Methods that are known to be functional in nature but look procedural from
|
1326
|
+
# their usage, e.g.
|
1327
|
+
#
|
1328
|
+
# let(:foo) { Foo.new }
|
1329
|
+
#
|
1330
|
+
# Here, the return value of `Foo.new` is used to define a `foo` helper but
|
1331
|
+
# doesn't appear to be used from the return value of `let`.
|
1332
|
+
- let
|
1333
|
+
- let!
|
1334
|
+
- subject
|
1335
|
+
- watch
|
1336
|
+
IgnoredMethods:
|
1337
|
+
# Methods that can be either procedural or functional and cannot be
|
1338
|
+
# categorised from their usage alone, e.g.
|
1339
|
+
#
|
1340
|
+
# foo = lambda do |x|
|
1341
|
+
# puts "Hello, #{x}"
|
1342
|
+
# end
|
1343
|
+
#
|
1344
|
+
# foo = lambda do |x|
|
1345
|
+
# x * 100
|
1346
|
+
# end
|
1347
|
+
#
|
1348
|
+
# Here, it is impossible to tell from the return value of `lambda` whether
|
1349
|
+
# the inner block's return value is significant.
|
1350
|
+
- lambda
|
1351
|
+
- proc
|
1352
|
+
- it
|
1353
|
+
|
1354
|
+
Style/BracesAroundHashParameters:
|
1355
|
+
Description: Enforce braces style around hash parameters.
|
1356
|
+
Enabled: true
|
1357
|
+
EnforcedStyle: no_braces
|
1358
|
+
SupportedStyles:
|
1359
|
+
# The `braces` style enforces braces around all method parameters that are
|
1360
|
+
# hashes.
|
1361
|
+
- braces
|
1362
|
+
# The `no_braces` style checks that the last parameter doesn't have braces
|
1363
|
+
# around it.
|
1364
|
+
- no_braces
|
1365
|
+
# The `context_dependent` style checks that the last parameter doesn't have
|
1366
|
+
# braces around it, but requires braces if the second to last parameter is
|
1367
|
+
# also a hash literal.
|
1368
|
+
- context_dependent
|
1369
|
+
|
1370
|
+
Style/CaseEquality:
|
1371
|
+
Description: 'Avoid explicit use of the case equality operator(===).'
|
1372
|
+
StyleGuide: '#no-case-equality'
|
1373
|
+
Enabled: true
|
1374
|
+
|
1375
|
+
Style/CharacterLiteral:
|
1376
|
+
Description: 'Checks for uses of character literals.'
|
1377
|
+
StyleGuide: '#no-character-literals'
|
1378
|
+
Enabled: true
|
1379
|
+
|
1380
|
+
Style/ClassAndModuleChildren:
|
1381
|
+
Description: 'Checks style of children classes and modules.'
|
1382
|
+
StyleGuide: '#namespace-definition'
|
1383
|
+
# Moving from compact to nested children requires knowledge of whether the
|
1384
|
+
# outer parent is a module or a class. Moving from nested to compact requires
|
1385
|
+
# verification that the outer parent is defined elsewhere. Rubocop does not
|
1386
|
+
# have the knowledge to perform either operation safely and thus requires
|
1387
|
+
# manual oversight.
|
1388
|
+
AutoCorrect: false
|
1389
|
+
Enabled: true
|
1390
|
+
# Checks the style of children definitions at classes and modules.
|
1391
|
+
#
|
1392
|
+
# Basically there are two different styles:
|
1393
|
+
#
|
1394
|
+
# `nested` - have each child on a separate line
|
1395
|
+
# class Foo
|
1396
|
+
# class Bar
|
1397
|
+
# end
|
1398
|
+
# end
|
1399
|
+
#
|
1400
|
+
# `compact` - combine definitions as much as possible
|
1401
|
+
# class Foo::Bar
|
1402
|
+
# end
|
1403
|
+
#
|
1404
|
+
# The compact style is only forced, for classes or modules with one child.
|
1405
|
+
EnforcedStyle: nested
|
1406
|
+
SupportedStyles:
|
1407
|
+
- nested
|
1408
|
+
- compact
|
1409
|
+
AutoCorrect: false
|
1410
|
+
|
1411
|
+
Style/ClassCheck:
|
1412
|
+
Description: 'Enforces consistent use of `Object#is_a?` or `Object#kind_of?`.'
|
1413
|
+
Enabled: true
|
1414
|
+
EnforcedStyle: is_a?
|
1415
|
+
SupportedStyles:
|
1416
|
+
- is_a?
|
1417
|
+
- kind_of?
|
1418
|
+
|
1419
|
+
Style/ClassMethods:
|
1420
|
+
Description: 'Use self when defining module/class methods.'
|
1421
|
+
StyleGuide: '#def-self-class-methods'
|
1422
|
+
Enabled: true
|
1423
|
+
|
1424
|
+
Style/ClassVars:
|
1425
|
+
Description: 'Avoid the use of class variables.'
|
1426
|
+
StyleGuide: '#no-class-vars'
|
1427
|
+
Enabled: true
|
1428
|
+
|
1429
|
+
# Align with the style guide.
|
1430
|
+
Style/CollectionMethods:
|
1431
|
+
Description: 'Preferred collection methods.'
|
1432
|
+
StyleGuide: '#map-find-select-reduce-size'
|
1433
|
+
Enabled: false
|
1434
|
+
# Mapping from undesired method to desired_method
|
1435
|
+
# e.g. to use `detect` over `find`:
|
1436
|
+
#
|
1437
|
+
# CollectionMethods:
|
1438
|
+
# PreferredMethods:
|
1439
|
+
# find: detect
|
1440
|
+
PreferredMethods:
|
1441
|
+
collect: 'map'
|
1442
|
+
collect!: 'map!'
|
1443
|
+
inject: 'reduce'
|
1444
|
+
detect: 'find'
|
1445
|
+
find_all: 'select'
|
1446
|
+
|
1447
|
+
Style/ColonMethodCall:
|
1448
|
+
Description: 'Do not use :: for method call.'
|
1449
|
+
StyleGuide: '#double-colons'
|
1450
|
+
Enabled: true
|
1451
|
+
|
1452
|
+
Style/ColonMethodDefinition:
|
1453
|
+
Description: 'Do not use :: for defining class methods.'
|
1454
|
+
StyleGuide: '#colon-method-definition'
|
1455
|
+
Enabled: true
|
1456
|
+
|
1457
|
+
# Use '`' or '%x' around command literals.
|
1458
|
+
Style/CommandLiteral:
|
1459
|
+
Description: 'Use `` or %x around command literals.'
|
1460
|
+
StyleGuide: '#percent-x'
|
1461
|
+
Enabled: true
|
1462
|
+
EnforcedStyle: backticks
|
1463
|
+
# backticks: Always use backticks.
|
1464
|
+
# percent_x: Always use `%x`.
|
1465
|
+
# mixed: Use backticks on single-line commands, and `%x` on multi-line commands.
|
1466
|
+
SupportedStyles:
|
1467
|
+
- backticks
|
1468
|
+
- percent_x
|
1469
|
+
- mixed
|
1470
|
+
# If `false`, the cop will always recommend using `%x` if one or more backticks
|
1471
|
+
# are found in the command string.
|
1472
|
+
AllowInnerBackticks: false
|
1473
|
+
|
1474
|
+
# Checks formatting of special comments
|
1475
|
+
Style/CommentAnnotation:
|
1476
|
+
Description: >-
|
1477
|
+
Checks formatting of special comments
|
1478
|
+
(TODO, FIXME, OPTIMIZE, HACK, REVIEW).
|
1479
|
+
StyleGuide: '#annotate-keywords'
|
1480
|
+
Enabled: true
|
1481
|
+
Keywords:
|
1482
|
+
- TODO
|
1483
|
+
- FIXME
|
1484
|
+
- OPTIMIZE
|
1485
|
+
- HACK
|
1486
|
+
- REVIEW
|
1487
|
+
|
1488
|
+
Style/CommentedKeyword:
|
1489
|
+
Description: 'Do not place comments on the same line as certain keywords.'
|
1490
|
+
Enabled: true
|
1491
|
+
|
1492
|
+
Style/ConditionalAssignment:
|
1493
|
+
Description: >-
|
1494
|
+
Use the return value of `if` and `case` statements for
|
1495
|
+
assignment to a variable and variable comparison instead
|
1496
|
+
of assigning that variable inside of each branch.
|
1497
|
+
Enabled: true
|
1498
|
+
EnforcedStyle: assign_to_condition
|
1499
|
+
SupportedStyles:
|
1500
|
+
- assign_to_condition
|
1501
|
+
- assign_inside_condition
|
1502
|
+
# When configured to `assign_to_condition`, `SingleLineConditionsOnly`
|
1503
|
+
# will only register an offense when all branches of a condition are
|
1504
|
+
# a single line.
|
1505
|
+
# When configured to `assign_inside_condition`, `SingleLineConditionsOnly`
|
1506
|
+
# will only register an offense for assignment to a condition that has
|
1507
|
+
# at least one multiline branch.
|
1508
|
+
SingleLineConditionsOnly: true
|
1509
|
+
IncludeTernaryExpressions: true
|
1510
|
+
|
1511
|
+
# Checks that you have put a copyright in a comment before any code.
|
1512
|
+
#
|
1513
|
+
# You can override the default Notice in your .rubocop.yml file.
|
1514
|
+
#
|
1515
|
+
# In order to use autocorrect, you must supply a value for the
|
1516
|
+
# `AutocorrectNotice` key that matches the regexp Notice. A blank
|
1517
|
+
# `AutocorrectNotice` will cause an error during autocorrect.
|
1518
|
+
#
|
1519
|
+
# Autocorrect will add a copyright notice in a comment at the top
|
1520
|
+
# of the file immediately after any shebang or encoding comments.
|
1521
|
+
#
|
1522
|
+
# Example rubocop.yml:
|
1523
|
+
#
|
1524
|
+
# Style/Copyright:
|
1525
|
+
# Enabled: true
|
1526
|
+
# Notice: 'Copyright (\(c\) )?2015 Yahoo! Inc'
|
1527
|
+
# AutocorrectNotice: '# Copyright (c) 2015 Yahoo! Inc.'
|
1528
|
+
#
|
1529
|
+
Style/Copyright:
|
1530
|
+
Description: 'Include a copyright notice in each file before any code.'
|
1531
|
+
Enabled: false
|
1532
|
+
Notice: '^Copyright (\(c\) )?2[0-9]{3} .+'
|
1533
|
+
AutocorrectNotice: ''
|
1534
|
+
|
1535
|
+
Style/DateTime:
|
1536
|
+
Description: 'Use Date or Time over DateTime.'
|
1537
|
+
StyleGuide: '#date--time'
|
1538
|
+
Enabled: true
|
1539
|
+
|
1540
|
+
Style/DefWithParentheses:
|
1541
|
+
Description: 'Use def with parentheses when there are arguments.'
|
1542
|
+
StyleGuide: '#method-parens'
|
1543
|
+
Enabled: true
|
1544
|
+
|
1545
|
+
Style/Dir:
|
1546
|
+
Description: >-
|
1547
|
+
Use the `__dir__` method to retrieve the canonicalized
|
1548
|
+
absolute path to the current file.
|
1549
|
+
Enabled: true
|
1550
|
+
|
1551
|
+
Style/Documentation:
|
1552
|
+
Description: 'Document classes and non-namespace modules.'
|
1553
|
+
Enabled: true
|
1554
|
+
Exclude:
|
1555
|
+
- 'spec/**/*'
|
1556
|
+
- 'test/**/*'
|
1557
|
+
|
1558
|
+
Style/DocumentationMethod:
|
1559
|
+
Description: 'Public methods.'
|
1560
|
+
Enabled: false
|
1561
|
+
Exclude:
|
1562
|
+
- 'spec/**/*'
|
1563
|
+
- 'test/**/*'
|
1564
|
+
RequireForNonPublicMethods: false
|
1565
|
+
|
1566
|
+
Style/DoubleNegation:
|
1567
|
+
Description: Checks for uses of double negation (!!).
|
1568
|
+
StyleGuide: "#no-bang-bang"
|
1569
|
+
Enabled: true
|
1570
|
+
|
1571
|
+
Style/EachForSimpleLoop:
|
1572
|
+
Description: >-
|
1573
|
+
Use `Integer#times` for a simple loop which iterates a fixed
|
1574
|
+
number of times.
|
1575
|
+
Enabled: true
|
1576
|
+
|
1577
|
+
Style/EachWithObject:
|
1578
|
+
Description: 'Prefer `each_with_object` over `inject` or `reduce`.'
|
1579
|
+
Enabled: true
|
1580
|
+
|
1581
|
+
Style/EmptyBlockParameter:
|
1582
|
+
Description: 'Omit pipes for empty block parameters.'
|
1583
|
+
Enabled: true
|
1584
|
+
|
1585
|
+
Style/EmptyCaseCondition:
|
1586
|
+
Description: 'Avoid empty condition in case statements.'
|
1587
|
+
Enabled: true
|
1588
|
+
|
1589
|
+
# Warn on empty else statements
|
1590
|
+
# empty - warn only on empty `else`
|
1591
|
+
# nil - warn on `else` with nil in it
|
1592
|
+
# both - warn on empty `else` and `else` with `nil` in it
|
1593
|
+
Style/EmptyElse:
|
1594
|
+
Description: Avoid empty else-clauses.
|
1595
|
+
Enabled: true
|
1596
|
+
EnforcedStyle: both
|
1597
|
+
SupportedStyles:
|
1598
|
+
- empty
|
1599
|
+
- nil
|
1600
|
+
- both
|
1601
|
+
|
1602
|
+
Style/EmptyLambdaParameter:
|
1603
|
+
Description: 'Omit parens for empty lambda parameters.'
|
1604
|
+
Enabled: true
|
1605
|
+
|
1606
|
+
Style/EmptyLineAfterGuardClause:
|
1607
|
+
Description: Add empty line after guard clause.
|
1608
|
+
Enabled: false
|
1609
|
+
|
1610
|
+
Style/EmptyLiteral:
|
1611
|
+
Description: 'Prefer literals to Array.new/Hash.new/String.new.'
|
1612
|
+
StyleGuide: '#literal-array-hash'
|
1613
|
+
Enabled: true
|
1614
|
+
|
1615
|
+
Style/EmptyMethod:
|
1616
|
+
Description: 'Checks the formatting of empty method definitions.'
|
1617
|
+
StyleGuide: '#no-single-line-methods'
|
1618
|
+
Enabled: true
|
1619
|
+
EnforcedStyle: compact
|
1620
|
+
SupportedStyles:
|
1621
|
+
- compact
|
1622
|
+
- expanded
|
1623
|
+
|
1624
|
+
Style/Encoding:
|
1625
|
+
Description: 'Use UTF-8 as the source file encoding.'
|
1626
|
+
StyleGuide: '#utf-8'
|
1627
|
+
Enabled: true
|
1628
|
+
|
1629
|
+
Style/EndBlock:
|
1630
|
+
Description: 'Avoid the use of END blocks.'
|
1631
|
+
StyleGuide: '#no-END-blocks'
|
1632
|
+
Enabled: true
|
1633
|
+
|
1634
|
+
Style/EvalWithLocation:
|
1635
|
+
Description: 'Pass `__FILE__` and `__LINE__` to `eval` method, as they are used by backtraces.'
|
1636
|
+
Enabled: true
|
1637
|
+
|
1638
|
+
Style/EvenOdd:
|
1639
|
+
Description: 'Favor the use of Integer#even? && Integer#odd?'
|
1640
|
+
StyleGuide: '#predicate-methods'
|
1641
|
+
Enabled: true
|
1642
|
+
|
1643
|
+
Style/ExpandPathArguments:
|
1644
|
+
Description: "Use `expand_path(__dir__)` instead of `expand_path('..', __FILE__)`."
|
1645
|
+
Enabled: true
|
1646
|
+
|
1647
|
+
Style/FlipFlop:
|
1648
|
+
Description: 'Checks for flip flops'
|
1649
|
+
StyleGuide: '#no-flip-flops'
|
1650
|
+
Enabled: true
|
1651
|
+
|
1652
|
+
# Checks use of for or each in multiline loops.
|
1653
|
+
Style/For:
|
1654
|
+
Description: 'Checks use of for or each in multiline loops.'
|
1655
|
+
StyleGuide: '#no-for-loops'
|
1656
|
+
Enabled: true
|
1657
|
+
EnforcedStyle: each
|
1658
|
+
SupportedStyles:
|
1659
|
+
- each
|
1660
|
+
- for
|
1661
|
+
|
1662
|
+
# Enforce the method used for string formatting.
|
1663
|
+
Style/FormatString:
|
1664
|
+
Description: 'Enforce the use of Kernel#sprintf, Kernel#format or String#%.'
|
1665
|
+
StyleGuide: '#sprintf'
|
1666
|
+
Enabled: true
|
1667
|
+
EnforcedStyle: format
|
1668
|
+
SupportedStyles:
|
1669
|
+
- format
|
1670
|
+
- sprintf
|
1671
|
+
- percent
|
1672
|
+
|
1673
|
+
# Enforce using either `%<token>s` or `%{token}`
|
1674
|
+
Style/FormatStringToken:
|
1675
|
+
Description: 'Use a consistent style for format string tokens.'
|
1676
|
+
Enabled: true
|
1677
|
+
EnforcedStyle: annotated
|
1678
|
+
SupportedStyles:
|
1679
|
+
# Prefer tokens which contain a sprintf like type annotation like
|
1680
|
+
# `%<name>s`, `%<age>d`, `%<score>f`
|
1681
|
+
- annotated
|
1682
|
+
# Prefer simple looking "template" style tokens like `%{name}`, `%{age}`
|
1683
|
+
- template
|
1684
|
+
- unannotated
|
1685
|
+
|
1686
|
+
Style/FrozenStringLiteralComment:
|
1687
|
+
Description: >-
|
1688
|
+
Add the frozen_string_literal comment to the top of files
|
1689
|
+
to help transition from Ruby 2.3.0 to Ruby 3.0.
|
1690
|
+
Enabled: true
|
1691
|
+
EnforcedStyle: always
|
1692
|
+
SupportedStyles:
|
1693
|
+
# `always` will always add the frozen string literal comment to a file
|
1694
|
+
# regardless of the Ruby version or if `freeze` or `<<` are called on a
|
1695
|
+
# string literal. If you run code against multiple versions of Ruby, it is
|
1696
|
+
# possible that this will create errors in Ruby 2.3.0+.
|
1697
|
+
- always
|
1698
|
+
# `never` will enforce that the frozen string literal comment does not
|
1699
|
+
# exist in a file.
|
1700
|
+
- never
|
1701
|
+
|
1702
|
+
# Built-in global variables are allowed by default.
|
1703
|
+
Style/GlobalVars:
|
1704
|
+
Description: 'Do not introduce global variables.'
|
1705
|
+
StyleGuide: '#instance-vars'
|
1706
|
+
Reference: 'http://www.zenspider.com/Languages/Ruby/QuickRef.html'
|
1707
|
+
Enabled: true
|
1708
|
+
AllowedVariables: []
|
1709
|
+
|
1710
|
+
# `MinBodyLength` defines the number of lines of the a body of an `if` or `unless`
|
1711
|
+
# needs to have to trigger this cop
|
1712
|
+
Style/GuardClause:
|
1713
|
+
Description: 'Check for conditionals that can be replaced with guard clauses'
|
1714
|
+
StyleGuide: '#no-nested-conditionals'
|
1715
|
+
Enabled: true
|
1716
|
+
MinBodyLength: 1
|
1717
|
+
|
1718
|
+
Style/HashSyntax:
|
1719
|
+
Description: >-
|
1720
|
+
Prefer Ruby 1.9 hash syntax { a: 1, b: 2 } over 1.8 syntax
|
1721
|
+
{ :a => 1, :b => 2 }.
|
1722
|
+
StyleGuide: '#hash-literals'
|
1723
|
+
Enabled: true
|
1724
|
+
EnforcedStyle: ruby19
|
1725
|
+
SupportedStyles:
|
1726
|
+
# checks for 1.9 syntax (e.g. {a: 1}) for all symbol keys
|
1727
|
+
- ruby19
|
1728
|
+
# checks for hash rocket syntax for all hashes
|
1729
|
+
- hash_rockets
|
1730
|
+
# forbids mixed key syntaxes (e.g. {a: 1, :b => 2})
|
1731
|
+
- no_mixed_keys
|
1732
|
+
# enforces both ruby19 and no_mixed_keys styles
|
1733
|
+
- ruby19_no_mixed_keys
|
1734
|
+
# Force hashes that have a symbol value to use hash rockets
|
1735
|
+
UseHashRocketsWithSymbolValues: false
|
1736
|
+
# Do not suggest { a?: 1 } over { :a? => 1 } in ruby19 style
|
1737
|
+
PreferHashRocketsForNonAlnumEndingSymbols: false
|
1738
|
+
|
1739
|
+
Style/IdenticalConditionalBranches:
|
1740
|
+
Description: >-
|
1741
|
+
Checks that conditional statements do not have an identical
|
1742
|
+
line at the end of each branch, which can validly be moved
|
1743
|
+
out of the conditional.
|
1744
|
+
Enabled: true
|
1745
|
+
|
1746
|
+
Style/IfInsideElse:
|
1747
|
+
Description: 'Finds if nodes inside else, which can be converted to elsif.'
|
1748
|
+
Enabled: true
|
1749
|
+
|
1750
|
+
Style/IfUnlessModifier:
|
1751
|
+
Description: >-
|
1752
|
+
Favor modifier if/unless usage when you have a
|
1753
|
+
single-line body.
|
1754
|
+
StyleGuide: '#if-as-a-modifier'
|
1755
|
+
Enabled: true
|
1756
|
+
|
1757
|
+
Style/IfUnlessModifierOfIfUnless:
|
1758
|
+
Description: >-
|
1759
|
+
Avoid modifier if/unless usage on conditionals.
|
1760
|
+
Enabled: true
|
1761
|
+
|
1762
|
+
Style/IfWithSemicolon:
|
1763
|
+
Description: 'Do not use if x; .... Use the ternary operator instead.'
|
1764
|
+
StyleGuide: '#no-semicolon-ifs'
|
1765
|
+
Enabled: true
|
1766
|
+
|
1767
|
+
Style/ImplicitRuntimeError:
|
1768
|
+
Description: >-
|
1769
|
+
Use `raise` or `fail` with an explicit exception class and
|
1770
|
+
message, rather than just a message.
|
1771
|
+
Enabled: false
|
1772
|
+
|
1773
|
+
Style/InfiniteLoop:
|
1774
|
+
Description: 'Use Kernel#loop for infinite loops.'
|
1775
|
+
StyleGuide: '#infinite-loop'
|
1776
|
+
Enabled: true
|
1777
|
+
|
1778
|
+
Style/InlineComment:
|
1779
|
+
Description: 'Avoid trailing inline comments.'
|
1780
|
+
Enabled: false
|
1781
|
+
|
1782
|
+
Style/InverseMethods:
|
1783
|
+
Description: >-
|
1784
|
+
Use the inverse method instead of `!.method`
|
1785
|
+
if an inverse method is defined.
|
1786
|
+
Enabled: true
|
1787
|
+
# `InverseMethods` are methods that can be inverted by a not (`not` or `!`)
|
1788
|
+
# The relationship of inverse methods only needs to be defined in one direction.
|
1789
|
+
# Keys and values both need to be defined as symbols.
|
1790
|
+
InverseMethods:
|
1791
|
+
:any?: :none?
|
1792
|
+
:even?: :odd?
|
1793
|
+
:==: :!=
|
1794
|
+
:=~: :!~
|
1795
|
+
:<: :>=
|
1796
|
+
:>: :<=
|
1797
|
+
# `ActiveSupport` defines some common inverse methods. They are listed below,
|
1798
|
+
# and not enabled by default.
|
1799
|
+
#:present?: :blank?,
|
1800
|
+
#:include?: :exclude?
|
1801
|
+
# `InverseBlocks` are methods that are inverted by inverting the return
|
1802
|
+
# of the block that is passed to the method
|
1803
|
+
InverseBlocks:
|
1804
|
+
:select: :reject
|
1805
|
+
:select!: :reject!
|
1806
|
+
|
1807
|
+
Style/Lambda:
|
1808
|
+
Description: 'Use the new lambda literal syntax for single-line blocks.'
|
1809
|
+
StyleGuide: '#lambda-multi-line'
|
1810
|
+
Enabled: true
|
1811
|
+
EnforcedStyle: line_count_dependent
|
1812
|
+
SupportedStyles:
|
1813
|
+
- line_count_dependent
|
1814
|
+
- lambda
|
1815
|
+
- literal
|
1816
|
+
|
1817
|
+
Style/LambdaCall:
|
1818
|
+
Description: 'Use lambda.call(...) instead of lambda.(...).'
|
1819
|
+
StyleGuide: '#proc-call'
|
1820
|
+
Enabled: true
|
1821
|
+
EnforcedStyle: call
|
1822
|
+
SupportedStyles:
|
1823
|
+
- call
|
1824
|
+
- braces
|
1825
|
+
|
1826
|
+
Style/LineEndConcatenation:
|
1827
|
+
Description: >-
|
1828
|
+
Use \ instead of + or << to concatenate two string literals at
|
1829
|
+
line end.
|
1830
|
+
Enabled: true
|
1831
|
+
|
1832
|
+
Style/MethodCalledOnDoEndBlock:
|
1833
|
+
Description: Avoid chaining a method call on a do...end block.
|
1834
|
+
StyleGuide: "#single-line-blocks"
|
1835
|
+
Enabled: false
|
1836
|
+
|
1837
|
+
Style/MethodCallWithArgsParentheses:
|
1838
|
+
Description: Use parentheses for method calls with arguments.
|
1839
|
+
StyleGuide: "#method-invocation-parens"
|
1840
|
+
Enabled: false
|
1841
|
+
IgnoreMacros: true
|
1842
|
+
IgnoredMethods: []
|
1843
|
+
|
1844
|
+
Style/MethodCallWithoutArgsParentheses:
|
1845
|
+
Description: 'Do not use parentheses for method calls with no arguments.'
|
1846
|
+
StyleGuide: '#method-invocation-parens'
|
1847
|
+
Enabled: true
|
1848
|
+
|
1849
|
+
Style/MethodDefParentheses:
|
1850
|
+
Description: >-
|
1851
|
+
Checks if the method definitions have or don't have
|
1852
|
+
parentheses.
|
1853
|
+
StyleGuide: '#method-parens'
|
1854
|
+
Enabled: true
|
1855
|
+
EnforcedStyle: require_parentheses
|
1856
|
+
SupportedStyles:
|
1857
|
+
- require_parentheses
|
1858
|
+
- require_no_parentheses
|
1859
|
+
- require_no_parentheses_except_multiline
|
1860
|
+
|
1861
|
+
Style/MethodMissingSuper:
|
1862
|
+
Description: 'This cop checks for the presence of method_missing without falling back on super.'
|
1863
|
+
StyleGuide: '#no-method-missing'
|
1864
|
+
Enabled: true
|
1865
|
+
|
1866
|
+
Style/MissingRespondToMissing:
|
1867
|
+
Description: 'This cop checks for the presence of `method_missing` without also defining `respond_to_missing?`.'
|
1868
|
+
StyleGuide: '#no-method-missing'
|
1869
|
+
Enabled: true
|
1870
|
+
|
1871
|
+
Style/MissingElse:
|
1872
|
+
Description: Require if/case expressions to have an else branches. If enabled, it
|
1873
|
+
is recommended that Style/UnlessElse and Style/EmptyElse be enabled. This will
|
1874
|
+
conflict with Style/EmptyElse if Style/EmptyElse is configured to style "both"
|
1875
|
+
Enabled: false
|
1876
|
+
EnforcedStyle: both
|
1877
|
+
SupportedStyles:
|
1878
|
+
# if - warn when an if expression is missing an else branch
|
1879
|
+
# case - warn when a case expression is missing an else branch
|
1880
|
+
# both - warn when an if or case expression is missing an else branch
|
1881
|
+
- if
|
1882
|
+
- case
|
1883
|
+
- both
|
1884
|
+
|
1885
|
+
# Checks the grouping of mixins (`include`, `extend`, `prepend`) in `class` and
|
1886
|
+
# `module` bodies.
|
1887
|
+
Style/MixinGrouping:
|
1888
|
+
Description: Checks for grouping of mixins in `class` and `module` bodies.
|
1889
|
+
StyleGuide: "#mixin-grouping"
|
1890
|
+
Enabled: true
|
1891
|
+
EnforcedStyle: separated
|
1892
|
+
SupportedStyles:
|
1893
|
+
# separated: each mixed in module goes in a separate statement.
|
1894
|
+
# grouped: mixed in modules are grouped into a single statement.
|
1895
|
+
- separated
|
1896
|
+
- grouped
|
1897
|
+
|
1898
|
+
Style/ModuleFunction:
|
1899
|
+
Description: Checks for usage of `extend self` in modules.
|
1900
|
+
StyleGuide: "#module-function"
|
1901
|
+
Enabled: true
|
1902
|
+
EnforcedStyle: module_function
|
1903
|
+
SupportedStyles:
|
1904
|
+
- module_function
|
1905
|
+
- extend_self
|
1906
|
+
|
1907
|
+
Style/MultilineMemoization:
|
1908
|
+
Description: Wrap multiline memoizations in a `begin` and `end` block.
|
1909
|
+
Enabled: true
|
1910
|
+
EnforcedStyle: keyword
|
1911
|
+
SupportedStyles:
|
1912
|
+
- keyword
|
1913
|
+
- braces
|
1914
|
+
|
1915
|
+
Style/NegatedIf:
|
1916
|
+
Description: Favor unless over if for negative conditions (or control flow or).
|
1917
|
+
StyleGuide: "#unless-for-negatives"
|
1918
|
+
Enabled: true
|
1919
|
+
EnforcedStyle: both
|
1920
|
+
SupportedStyles:
|
1921
|
+
# both: prefix and postfix negated `if` should both use `unless`
|
1922
|
+
# prefix: only use `unless` for negated `if` statements positioned before the body of the statement
|
1923
|
+
# postfix: only use `unless` for negated `if` statements positioned after the body of the statement
|
1924
|
+
- both
|
1925
|
+
- prefix
|
1926
|
+
- postfix
|
1927
|
+
|
1928
|
+
Style/NestedParenthesizedCalls:
|
1929
|
+
Description: Parenthesize method calls which are nested inside the argument list
|
1930
|
+
of another parenthesized method call.
|
1931
|
+
Enabled: true
|
1932
|
+
Whitelist:
|
1933
|
+
- be
|
1934
|
+
- be_a
|
1935
|
+
- be_an
|
1936
|
+
- be_between
|
1937
|
+
- be_falsey
|
1938
|
+
- be_kind_of
|
1939
|
+
- be_instance_of
|
1940
|
+
- be_truthy
|
1941
|
+
- be_within
|
1942
|
+
- eq
|
1943
|
+
- eql
|
1944
|
+
- end_with
|
1945
|
+
- include
|
1946
|
+
- match
|
1947
|
+
- raise_error
|
1948
|
+
- respond_to
|
1949
|
+
- start_with
|
1950
|
+
|
1951
|
+
Style/Next:
|
1952
|
+
Description: Use `next` to skip iteration instead of a condition at the end.
|
1953
|
+
StyleGuide: "#no-nested-conditionals"
|
1954
|
+
Enabled: true
|
1955
|
+
# With `always` all conditions at the end of an iteration needs to be
|
1956
|
+
# replaced by next - with `skip_modifier_ifs` the modifier if like this one
|
1957
|
+
# are ignored: [1, 2].each { |a| return 'yes' if a == 1 }
|
1958
|
+
EnforcedStyle: skip_modifier_ifs
|
1959
|
+
# `MinBodyLength` defines the number of lines of the a body of an `if` or `unless`
|
1960
|
+
# needs to have to trigger this cop
|
1961
|
+
MinBodyLength: 3
|
1962
|
+
SupportedStyles:
|
1963
|
+
- skip_modifier_ifs
|
1964
|
+
- always
|
1965
|
+
|
1966
|
+
Style/NonNilCheck:
|
1967
|
+
Description: Checks for redundant nil checks.
|
1968
|
+
StyleGuide: "#no-non-nil-checks"
|
1969
|
+
Enabled: true
|
1970
|
+
# With `IncludeSemanticChanges` set to `true`, this cop reports offenses for
|
1971
|
+
# `!x.nil?` and autocorrects that and `x != nil` to solely `x`, which is
|
1972
|
+
# **usually** OK, but might change behavior.
|
1973
|
+
#
|
1974
|
+
# With `IncludeSemanticChanges` set to `false`, this cop does not report
|
1975
|
+
# offenses for `!x.nil?` and does no changes that might change behavior.
|
1976
|
+
IncludeSemanticChanges: false
|
1977
|
+
|
1978
|
+
Style/NumericLiterals:
|
1979
|
+
Description: Add underscores to large numeric literals to improve their readability.
|
1980
|
+
StyleGuide: "#underscores-in-numerics"
|
1981
|
+
Enabled: true
|
1982
|
+
MinDigits: 5
|
1983
|
+
Strict: false
|
1984
|
+
|
1985
|
+
Style/NumericLiteralPrefix:
|
1986
|
+
Description: Use smallcase prefixes for numeric literals.
|
1987
|
+
StyleGuide: "#numeric-literal-prefixes"
|
1988
|
+
Enabled: true
|
1989
|
+
EnforcedOctalStyle: zero_with_o
|
1990
|
+
SupportedOctalStyles:
|
1991
|
+
- zero_with_o
|
1992
|
+
- zero_only
|
1993
|
+
|
1994
|
+
Style/NumericPredicate:
|
1995
|
+
Description: Checks for the use of predicate- or comparison methods for numeric
|
1996
|
+
comparisons.
|
1997
|
+
StyleGuide: "#predicate-methods"
|
1998
|
+
AutoCorrect: false
|
1999
|
+
Enabled: true
|
2000
|
+
EnforcedStyle: predicate
|
2001
|
+
SupportedStyles:
|
2002
|
+
- predicate
|
2003
|
+
- comparison
|
2004
|
+
# Exclude RSpec specs because assertions like `expect(1).to be > 0` cause
|
2005
|
+
# false positives.
|
2006
|
+
Exclude:
|
2007
|
+
- 'spec/**/*'
|
2008
|
+
|
2009
|
+
Style/OptionHash:
|
2010
|
+
# A list of parameter names that will be flagged by this cop.
|
2011
|
+
Description: Don't use option hashes when you can use keyword arguments.
|
2012
|
+
Enabled: false
|
2013
|
+
SuspiciousParamNames:
|
2014
|
+
- options
|
2015
|
+
- opts
|
2016
|
+
- args
|
2017
|
+
- params
|
2018
|
+
- parameters
|
2019
|
+
|
2020
|
+
# Allow safe assignment in conditions.
|
2021
|
+
Style/ParenthesesAroundCondition:
|
2022
|
+
Description: Don't use parentheses around the condition of an if/unless/while.
|
2023
|
+
StyleGuide: "#no-parens-around-condition"
|
2024
|
+
Enabled: true
|
2025
|
+
AllowSafeAssignment: true
|
2026
|
+
|
2027
|
+
Style/PercentLiteralDelimiters:
|
2028
|
+
# Specify the default preferred delimiter for all types with the 'default' key
|
2029
|
+
# Override individual delimiters (even with default specified) by specifying
|
2030
|
+
# an individual key
|
2031
|
+
Description: Use `%`-literal delimiters consistently
|
2032
|
+
StyleGuide: "#percent-literal-braces"
|
2033
|
+
Enabled: true
|
2034
|
+
PreferredDelimiters:
|
2035
|
+
default: ()
|
2036
|
+
'%i': '[]'
|
2037
|
+
'%I': '[]'
|
2038
|
+
'%r': '{}'
|
2039
|
+
'%w': '[]'
|
2040
|
+
'%W': '[]'
|
2041
|
+
|
2042
|
+
Style/PercentQLiterals:
|
2043
|
+
Description: Checks if uses of %Q/%q match the configured preference.
|
2044
|
+
Enabled: true
|
2045
|
+
EnforcedStyle: lower_case_q
|
2046
|
+
SupportedStyles:
|
2047
|
+
- lower_case_q # Use `%q` when possible, `%Q` when necessary
|
2048
|
+
- upper_case_q # Always use `%Q`
|
2049
|
+
|
2050
|
+
Style/PreferredHashMethods:
|
2051
|
+
Description: Checks use of `has_key?` and `has_value?` Hash methods.
|
2052
|
+
StyleGuide: "#hash-key"
|
2053
|
+
Enabled: true
|
2054
|
+
EnforcedStyle: short
|
2055
|
+
SupportedStyles:
|
2056
|
+
- short
|
2057
|
+
- verbose
|
2058
|
+
|
2059
|
+
Style/RaiseArgs:
|
2060
|
+
Description: Checks the arguments passed to raise/fail.
|
2061
|
+
StyleGuide: "#exception-class-messages"
|
2062
|
+
Enabled: true
|
2063
|
+
EnforcedStyle: exploded
|
2064
|
+
SupportedStyles:
|
2065
|
+
- compact # raise Exception.new(msg)
|
2066
|
+
- exploded # raise Exception, msg
|
2067
|
+
|
2068
|
+
Style/RedundantReturn:
|
2069
|
+
# When `true` allows code like `return x, y`.
|
2070
|
+
Description: Don't use return where it's not required.
|
2071
|
+
StyleGuide: "#no-explicit-return"
|
2072
|
+
Enabled: true
|
2073
|
+
AllowMultipleReturnValues: false
|
2074
|
+
|
2075
|
+
# Use `/` or `%r` around regular expressions.
|
2076
|
+
Style/RegexpLiteral:
|
2077
|
+
Description: Use / or %r around regular expressions.
|
2078
|
+
StyleGuide: "#percent-r"
|
2079
|
+
Enabled: true
|
2080
|
+
EnforcedStyle: slashes
|
2081
|
+
# slashes: Always use slashes.
|
2082
|
+
# percent_r: Always use `%r`.
|
2083
|
+
# mixed: Use slashes on single-line regexes, and `%r` on multi-line regexes.
|
2084
|
+
SupportedStyles:
|
2085
|
+
- slashes
|
2086
|
+
- percent_r
|
2087
|
+
- mixed
|
2088
|
+
# If `false`, the cop will always recommend using `%r` if one or more slashes
|
2089
|
+
# are found in the regexp string.
|
2090
|
+
AllowInnerSlashes: false
|
2091
|
+
|
2092
|
+
Style/RescueStandardError:
|
2093
|
+
Description: Avoid rescuing without specifying an error class.
|
2094
|
+
Enabled: true
|
2095
|
+
EnforcedStyle: explicit
|
2096
|
+
# implicit: Do not include the error class, `rescue`
|
2097
|
+
# explicit: Require an error class `rescue StandardError`
|
2098
|
+
SupportedStyles:
|
2099
|
+
- implicit
|
2100
|
+
- explicit
|
2101
|
+
|
2102
|
+
Style/ReturnNil:
|
2103
|
+
Description: Use return instead of return nil.
|
2104
|
+
Enabled: false
|
2105
|
+
EnforcedStyle: return
|
2106
|
+
SupportedStyles:
|
2107
|
+
- return
|
2108
|
+
- return_nil
|
2109
|
+
|
2110
|
+
Style/SafeNavigation:
|
2111
|
+
# Safe navigation may cause a statement to start returning `nil` in addition
|
2112
|
+
# to whatever it used to return.
|
2113
|
+
Description: This cop transforms usages of a method call safeguarded by a check
|
2114
|
+
for the existence of the object to safe navigation (`&.`).
|
2115
|
+
Enabled: true
|
2116
|
+
ConvertCodeThatCanStartToReturnNil: false
|
2117
|
+
Whitelist:
|
2118
|
+
- present?
|
2119
|
+
- blank?
|
2120
|
+
- presence
|
2121
|
+
- try
|
2122
|
+
|
2123
|
+
Style/Semicolon:
|
2124
|
+
# Allow `;` to separate several expressions on the same line.
|
2125
|
+
Description: Don't use semicolons to terminate expressions.
|
2126
|
+
StyleGuide: "#no-semicolon"
|
2127
|
+
Enabled: true
|
2128
|
+
AllowAsExpressionSeparator: false
|
2129
|
+
|
2130
|
+
Style/Send:
|
2131
|
+
Description: Prefer `Object#__send__` or `Object#public_send` to `send`, as `send`
|
2132
|
+
may overlap with existing methods.
|
2133
|
+
StyleGuide: "#prefer-public-send"
|
2134
|
+
Enabled: false
|
2135
|
+
|
2136
|
+
Style/SignalException:
|
2137
|
+
Description: Checks for proper usage of fail and raise.
|
2138
|
+
StyleGuide: "#prefer-raise-over-fail"
|
2139
|
+
Enabled: true
|
2140
|
+
EnforcedStyle: only_raise
|
2141
|
+
SupportedStyles:
|
2142
|
+
- only_raise
|
2143
|
+
- only_fail
|
2144
|
+
- semantic
|
2145
|
+
|
2146
|
+
Style/SingleLineBlockParams:
|
2147
|
+
Description: Enforces the names of some block params.
|
2148
|
+
Enabled: false
|
2149
|
+
Methods:
|
2150
|
+
- reduce:
|
2151
|
+
- acc
|
2152
|
+
- elem
|
2153
|
+
- inject:
|
2154
|
+
- acc
|
2155
|
+
- elem
|
2156
|
+
|
2157
|
+
Style/SingleLineMethods:
|
2158
|
+
Description: Avoid single-line methods.
|
2159
|
+
StyleGuide: "#no-single-line-methods"
|
2160
|
+
Enabled: true
|
2161
|
+
AllowIfMethodIsEmpty: true
|
2162
|
+
|
2163
|
+
Style/SpecialGlobalVars:
|
2164
|
+
Description: Avoid Perl-style global variables.
|
2165
|
+
StyleGuide: "#no-cryptic-perlisms"
|
2166
|
+
Enabled: true
|
2167
|
+
EnforcedStyle: use_english_names
|
2168
|
+
SupportedStyles:
|
2169
|
+
- use_perl_names
|
2170
|
+
- use_english_names
|
2171
|
+
|
2172
|
+
Style/StabbyLambdaParentheses:
|
2173
|
+
Description: Check for the usage of parentheses around stabby lambda arguments.
|
2174
|
+
StyleGuide: "#stabby-lambda-with-args"
|
2175
|
+
Enabled: true
|
2176
|
+
EnforcedStyle: require_parentheses
|
2177
|
+
SupportedStyles:
|
2178
|
+
- require_parentheses
|
2179
|
+
- require_no_parentheses
|
2180
|
+
|
2181
|
+
Style/StringHashKeys:
|
2182
|
+
Description: Prefer symbols instead of strings as hash keys.
|
2183
|
+
StyleGuide: "#symbols-as-keys"
|
2184
|
+
Enabled: false
|
2185
|
+
|
2186
|
+
Style/StringLiterals:
|
2187
|
+
Description: Checks if uses of quotes match the configured preference.
|
2188
|
+
StyleGuide: "#consistent-string-literals"
|
2189
|
+
Enabled: true
|
2190
|
+
EnforcedStyle: single_quotes
|
2191
|
+
SupportedStyles:
|
2192
|
+
- single_quotes
|
2193
|
+
- double_quotes
|
2194
|
+
# If `true`, strings which span multiple lines using `\` for continuation must
|
2195
|
+
# use the same type of quotes on each line.
|
2196
|
+
ConsistentQuotesInMultiline: false
|
2197
|
+
|
2198
|
+
Style/StringLiteralsInInterpolation:
|
2199
|
+
Description: Checks if uses of quotes inside expressions in interpolated strings
|
2200
|
+
match the configured preference.
|
2201
|
+
Enabled: true
|
2202
|
+
EnforcedStyle: single_quotes
|
2203
|
+
SupportedStyles:
|
2204
|
+
- single_quotes
|
2205
|
+
- double_quotes
|
2206
|
+
|
2207
|
+
Style/StringMethods:
|
2208
|
+
# Mapping from undesired method to desired_method
|
2209
|
+
# e.g. to use `to_sym` over `intern`:
|
2210
|
+
#
|
2211
|
+
# StringMethods:
|
2212
|
+
# PreferredMethods:
|
2213
|
+
# intern: to_sym
|
2214
|
+
Description: Checks if configured preferred methods are used over non-preferred.
|
2215
|
+
Enabled: false
|
2216
|
+
PreferredMethods:
|
2217
|
+
intern: to_sym
|
2218
|
+
|
2219
|
+
Style/SymbolArray:
|
2220
|
+
Description: Use %i or %I for arrays of symbols.
|
2221
|
+
StyleGuide: "#percent-i"
|
2222
|
+
Enabled: true
|
2223
|
+
EnforcedStyle: percent
|
2224
|
+
MinSize: 0
|
2225
|
+
SupportedStyles:
|
2226
|
+
- percent
|
2227
|
+
- brackets
|
2228
|
+
|
2229
|
+
Style/SymbolProc:
|
2230
|
+
Description: Use symbols as procs instead of blocks when possible.
|
2231
|
+
Enabled: true
|
2232
|
+
# A list of method names to be ignored by the check.
|
2233
|
+
# The names should be fairly unique, otherwise you'll end up ignoring lots of code.
|
2234
|
+
IgnoredMethods:
|
2235
|
+
- respond_to
|
2236
|
+
- define_method
|
2237
|
+
|
2238
|
+
Style/TernaryParentheses:
|
2239
|
+
Description: Checks for use of parentheses around ternary conditions.
|
2240
|
+
Enabled: true
|
2241
|
+
EnforcedStyle: require_no_parentheses
|
2242
|
+
SupportedStyles:
|
2243
|
+
- require_parentheses
|
2244
|
+
- require_no_parentheses
|
2245
|
+
- require_parentheses_when_complex
|
2246
|
+
AllowSafeAssignment: true
|
2247
|
+
|
2248
|
+
Style/TrailingBodyOnClass:
|
2249
|
+
Description: Class body goes below class statement.
|
2250
|
+
Enabled: true
|
2251
|
+
|
2252
|
+
Style/TrailingBodyOnMethodDefinition:
|
2253
|
+
Description: Method body goes below definition.
|
2254
|
+
Enabled: true
|
2255
|
+
|
2256
|
+
Style/TrailingBodyOnModule:
|
2257
|
+
Description: Module body goes below module statement.
|
2258
|
+
Enabled: true
|
2259
|
+
|
2260
|
+
Style/TrailingMethodEndStatement:
|
2261
|
+
Description: Checks for trailing end statement on line of method body.
|
2262
|
+
Enabled: true
|
2263
|
+
|
2264
|
+
Style/TrailingCommaInArguments:
|
2265
|
+
Description: Checks for trailing comma in argument lists.
|
2266
|
+
StyleGuide: "#no-trailing-params-comma"
|
2267
|
+
Enabled: true
|
2268
|
+
# If `comma`, the cop requires a comma after the last argument, but only for
|
2269
|
+
# parenthesized method calls where each argument is on its own line.
|
2270
|
+
# If `consistent_comma`, the cop requires a comma after the last argument,
|
2271
|
+
# for all parenthesized method calls with arguments.
|
2272
|
+
EnforcedStyleForMultiline: no_comma
|
2273
|
+
SupportedStylesForMultiline:
|
2274
|
+
- comma
|
2275
|
+
- consistent_comma
|
2276
|
+
- no_comma
|
2277
|
+
|
2278
|
+
Style/TrailingCommaInArrayLiteral:
|
2279
|
+
Description: Checks for trailing comma in array literals.
|
2280
|
+
StyleGuide: "#no-trailing-array-commas"
|
2281
|
+
Enabled: true
|
2282
|
+
# If `comma`, the cop requires a comma after the last item in an array,
|
2283
|
+
# but only when each item is on its own line.
|
2284
|
+
# If `consistent_comma`, the cop requires a comma after the last item of all
|
2285
|
+
# non-empty array literals.
|
2286
|
+
EnforcedStyleForMultiline: no_comma
|
2287
|
+
SupportedStylesForMultiline:
|
2288
|
+
- comma
|
2289
|
+
- consistent_comma
|
2290
|
+
- no_comma
|
2291
|
+
|
2292
|
+
Style/TrailingCommaInHashLiteral:
|
2293
|
+
Description: Checks for trailing comma in hash literals.
|
2294
|
+
Enabled: true
|
2295
|
+
# If `comma`, the cop requires a comma after the last item in a hash,
|
2296
|
+
# but only when each item is on its own line.
|
2297
|
+
# If `consistent_comma`, the cop requires a comma after the last item of all
|
2298
|
+
# non-empty hash literals.
|
2299
|
+
EnforcedStyleForMultiline: no_comma
|
2300
|
+
SupportedStylesForMultiline:
|
2301
|
+
- comma
|
2302
|
+
- consistent_comma
|
2303
|
+
- no_comma
|
2304
|
+
|
2305
|
+
Style/TrailingUnderscoreVariable:
|
2306
|
+
Description: Checks for the usage of unneeded trailing underscores at the end of
|
2307
|
+
parallel variable assignment.
|
2308
|
+
AllowNamedUnderscoreVariables: true
|
2309
|
+
Enabled: true
|
2310
|
+
|
2311
|
+
# `TrivialAccessors` requires exact name matches and doesn't allow
|
2312
|
+
# predicated methods by default.
|
2313
|
+
Style/TrivialAccessors:
|
2314
|
+
Description: Prefer attr_* methods to trivial readers/writers.
|
2315
|
+
StyleGuide: "#attr_family"
|
2316
|
+
Enabled: true
|
2317
|
+
# When set to `false` the cop will suggest the use of accessor methods
|
2318
|
+
# in situations like:
|
2319
|
+
#
|
2320
|
+
# def name
|
2321
|
+
# @other_name
|
2322
|
+
# end
|
2323
|
+
#
|
2324
|
+
# This way you can uncover "hidden" attributes in your code.
|
2325
|
+
ExactNameMatch: true
|
2326
|
+
AllowPredicates: true
|
2327
|
+
# Allows trivial writers that don't end in an equal sign. e.g.
|
2328
|
+
#
|
2329
|
+
# def on_exception(action)
|
2330
|
+
# @on_exception=action
|
2331
|
+
# end
|
2332
|
+
# on_exception :restart
|
2333
|
+
#
|
2334
|
+
# Commonly used in DSLs
|
2335
|
+
AllowDSLWriters: false
|
2336
|
+
IgnoreClassMethods: false
|
2337
|
+
Whitelist:
|
2338
|
+
- to_ary
|
2339
|
+
- to_a
|
2340
|
+
- to_c
|
2341
|
+
- to_enum
|
2342
|
+
- to_h
|
2343
|
+
- to_hash
|
2344
|
+
- to_i
|
2345
|
+
- to_int
|
2346
|
+
- to_io
|
2347
|
+
- to_open
|
2348
|
+
- to_path
|
2349
|
+
- to_proc
|
2350
|
+
- to_r
|
2351
|
+
- to_regexp
|
2352
|
+
- to_str
|
2353
|
+
- to_s
|
2354
|
+
- to_sym
|
2355
|
+
|
2356
|
+
Style/UnlessElse:
|
2357
|
+
Description: Do not use unless with else. Rewrite these with the positive case first.
|
2358
|
+
StyleGuide: "#no-else-with-unless"
|
2359
|
+
Enabled: true
|
2360
|
+
|
2361
|
+
Style/UnneededCapitalW:
|
2362
|
+
Description: Checks for %W when interpolation is not needed.
|
2363
|
+
Enabled: true
|
2364
|
+
|
2365
|
+
Style/UnneededInterpolation:
|
2366
|
+
Description: Checks for strings that are just an interpolated expression.
|
2367
|
+
Enabled: true
|
2368
|
+
|
2369
|
+
Style/UnneededPercentQ:
|
2370
|
+
Description: Checks for %q/%Q when single quotes or double quotes would do.
|
2371
|
+
StyleGuide: "#percent-q"
|
2372
|
+
Enabled: true
|
2373
|
+
|
2374
|
+
Style/UnpackFirst:
|
2375
|
+
Description: Checks for accessing the first element of `String#unpack` instead of
|
2376
|
+
using `unpack1`
|
2377
|
+
Enabled: true
|
2378
|
+
|
2379
|
+
Style/VariableInterpolation:
|
2380
|
+
Description: Don't interpolate global, instance and class variables directly in
|
2381
|
+
strings.
|
2382
|
+
StyleGuide: "#curlies-interpolate"
|
2383
|
+
Enabled: true
|
2384
|
+
|
2385
|
+
Style/WhenThen:
|
2386
|
+
Description: Use when x then ... for one-line cases.
|
2387
|
+
StyleGuide: "#one-line-cases"
|
2388
|
+
Enabled: true
|
2389
|
+
|
2390
|
+
Style/WhileUntilDo:
|
2391
|
+
Description: Checks for redundant do after while or until.
|
2392
|
+
StyleGuide: "#no-multiline-while-do"
|
2393
|
+
Enabled: true
|
2394
|
+
|
2395
|
+
Style/WhileUntilModifier:
|
2396
|
+
Description: Favor modifier while/until usage when you have a single-line body.
|
2397
|
+
StyleGuide: "#while-as-a-modifier"
|
2398
|
+
Enabled: true
|
2399
|
+
|
2400
|
+
# `WordArray` enforces how array literals of word-like strings should be expressed.
|
2401
|
+
Style/WordArray:
|
2402
|
+
Description: Use %w or %W for arrays of words.
|
2403
|
+
StyleGuide: "#percent-w"
|
2404
|
+
Enabled: true
|
2405
|
+
EnforcedStyle: percent
|
2406
|
+
SupportedStyles:
|
2407
|
+
# percent style: %w(word1 word2)
|
2408
|
+
- percent
|
2409
|
+
# bracket style: ['word1', 'word2']
|
2410
|
+
- brackets
|
2411
|
+
# The `MinSize` option causes the `WordArray` rule to be ignored for arrays
|
2412
|
+
# smaller than a certain size. The rule is only applied to arrays
|
2413
|
+
# whose element count is greater than or equal to `MinSize`.
|
2414
|
+
MinSize: 0
|
2415
|
+
# The regular expression `WordRegex` decides what is considered a word.
|
2416
|
+
WordRegex: !ruby/regexp '/\A[\p{Word}\n\t]+\z/'
|
2417
|
+
|
2418
|
+
Style/YodaCondition:
|
2419
|
+
Description: Do not use literals as the first operand of a comparison.
|
2420
|
+
Reference: https://en.wikipedia.org/wiki/Yoda_conditions
|
2421
|
+
Enabled: true
|
2422
|
+
EnforcedStyle: forbid_for_all_comparison_operators
|
2423
|
+
SupportedStyles:
|
2424
|
+
# check only equality operators: `!=` and `==`
|
2425
|
+
- equality_operators_only
|
2426
|
+
- forbid_for_all_comparison_operators
|
2427
|
+
- forbid_for_equality_operators_only
|
2428
|
+
- require_for_all_comparison_operators
|
2429
|
+
- require_for_equality_operators_only
|
2430
|
+
|
2431
|
+
Style/ZeroLengthPredicate:
|
2432
|
+
Description: 'Use #empty? when testing for objects of length 0.'
|
2433
|
+
Enabled: true
|
2434
|
+
|
2435
|
+
#################### Metrics ###############################
|
2436
|
+
|
2437
|
+
Metrics/AbcSize:
|
2438
|
+
# The ABC size is a calculated magnitude, so this number can be an Integer or
|
2439
|
+
# a Float.
|
2440
|
+
Description: A calculated magnitude based on number of assignments, branches, and
|
2441
|
+
conditions.
|
2442
|
+
Reference: http://c2.com/cgi/wiki?AbcMetric
|
2443
|
+
Enabled: true
|
2444
|
+
Max: 15
|
2445
|
+
|
2446
|
+
Metrics/BlockLength:
|
2447
|
+
Description: Avoid long blocks with many lines.
|
2448
|
+
Enabled: true
|
2449
|
+
CountComments: false # count full line comments?
|
2450
|
+
Max: 25
|
2451
|
+
ExcludedMethods: []
|
2452
|
+
Exclude:
|
2453
|
+
- 'spec/**/*_spec.rb'
|
2454
|
+
|
2455
|
+
Metrics/BlockNesting:
|
2456
|
+
CountBlocks: false
|
2457
|
+
Max: 3
|
2458
|
+
Description: Avoid excessive block nesting
|
2459
|
+
StyleGuide: "#three-is-the-number-thou-shalt-count"
|
2460
|
+
Enabled: true
|
2461
|
+
|
2462
|
+
Metrics/ClassLength:
|
2463
|
+
Description: Avoid classes longer than 100 lines of code.
|
2464
|
+
Enabled: true
|
2465
|
+
CountComments: false # count full line comments?
|
2466
|
+
Max: 100
|
2467
|
+
|
2468
|
+
# Avoid complex methods.
|
2469
|
+
Metrics/CyclomaticComplexity:
|
2470
|
+
Description: A complexity metric that is strongly correlated to the number of test
|
2471
|
+
cases needed to validate a method.
|
2472
|
+
Enabled: true
|
2473
|
+
Max: 6
|
2474
|
+
|
2475
|
+
Metrics/LineLength:
|
2476
|
+
# To make it possible to copy or click on URIs in the code, we allow lines
|
2477
|
+
# containing a URI to be longer than Max.
|
2478
|
+
Description: Limit lines to 80 characters.
|
2479
|
+
StyleGuide: "#80-character-limits"
|
2480
|
+
Enabled: true
|
2481
|
+
Max: 80
|
2482
|
+
AllowHeredoc: true
|
2483
|
+
AllowURI: true
|
2484
|
+
URISchemes:
|
2485
|
+
- http
|
2486
|
+
- https
|
2487
|
+
# The IgnoreCopDirectives option causes the LineLength rule to ignore cop
|
2488
|
+
# directives like '# rubocop: enable ...' when calculating a line's length.
|
2489
|
+
IgnoreCopDirectives: false
|
2490
|
+
# The IgnoredPatterns option is a list of !ruby/regexp and/or string
|
2491
|
+
# elements. Strings will be converted to Regexp objects. A line that matches
|
2492
|
+
# any regular expression listed in this option will be ignored by LineLength.
|
2493
|
+
IgnoredPatterns: []
|
2494
|
+
|
2495
|
+
Metrics/MethodLength:
|
2496
|
+
Description: Avoid methods longer than 10 lines of code.
|
2497
|
+
StyleGuide: "#short-methods"
|
2498
|
+
Enabled: true
|
2499
|
+
CountComments: false # count full line comments?
|
2500
|
+
Max: 10
|
2501
|
+
|
2502
|
+
Metrics/ModuleLength:
|
2503
|
+
Description: Avoid modules longer than 100 lines of code.
|
2504
|
+
Enabled: true
|
2505
|
+
CountComments: false # count full line comments?
|
2506
|
+
Max: 100
|
2507
|
+
|
2508
|
+
Metrics/ParameterLists:
|
2509
|
+
Description: Avoid parameter lists longer than three or four parameters.
|
2510
|
+
StyleGuide: "#too-many-params"
|
2511
|
+
Enabled: true
|
2512
|
+
Max: 5
|
2513
|
+
CountKeywordArgs: true
|
2514
|
+
|
2515
|
+
Metrics/PerceivedComplexity:
|
2516
|
+
Description: A complexity metric geared towards measuring complexity for a human
|
2517
|
+
reader.
|
2518
|
+
Enabled: true
|
2519
|
+
Max: 7
|
2520
|
+
|
2521
|
+
#################### Lint ##################################
|
2522
|
+
|
2523
|
+
Lint/AmbiguousBlockAssociation:
|
2524
|
+
Description: Checks for ambiguous block association with method when param passed
|
2525
|
+
without parentheses.
|
2526
|
+
StyleGuide: "#syntax"
|
2527
|
+
Enabled: true
|
2528
|
+
|
2529
|
+
Lint/AmbiguousOperator:
|
2530
|
+
Description: Checks for ambiguous operators in the first argument of a method invocation
|
2531
|
+
without parentheses.
|
2532
|
+
StyleGuide: "#method-invocation-parens"
|
2533
|
+
Enabled: true
|
2534
|
+
|
2535
|
+
Lint/AmbiguousRegexpLiteral:
|
2536
|
+
Description: Checks for ambiguous regexp literals in the first argument of a method
|
2537
|
+
invocation without parentheses.
|
2538
|
+
Enabled: true
|
2539
|
+
|
2540
|
+
# Allow safe assignment in conditions.
|
2541
|
+
Lint/AssignmentInCondition:
|
2542
|
+
Enabled: true
|
2543
|
+
Description: Don't use assignment in conditions.
|
2544
|
+
StyleGuide: "#safe-assignment-in-condition"
|
2545
|
+
AllowSafeAssignment: true
|
2546
|
+
|
2547
|
+
Lint/BigDecimalNew:
|
2548
|
+
Description: "`BigDecimal.new()` is deprecated. Use `BigDecimal()` instead."
|
2549
|
+
Enabled: true
|
2550
|
+
|
2551
|
+
Lint/BooleanSymbol:
|
2552
|
+
Description: Check for `:true` and `:false` symbols.
|
2553
|
+
Enabled: true
|
2554
|
+
|
2555
|
+
Lint/CircularArgumentReference:
|
2556
|
+
Description: Default values in optional keyword arguments and optional ordinal arguments
|
2557
|
+
should not refer back to the name of the argument.
|
2558
|
+
Enabled: true
|
2559
|
+
|
2560
|
+
Lint/Debugger:
|
2561
|
+
Description: Check for debugger calls.
|
2562
|
+
Enabled: true
|
2563
|
+
|
2564
|
+
Lint/DeprecatedClassMethods:
|
2565
|
+
Description: Check for deprecated class method calls.
|
2566
|
+
Enabled: true
|
2567
|
+
|
2568
|
+
Lint/DuplicateCaseCondition:
|
2569
|
+
Description: Do not repeat values in case conditionals.
|
2570
|
+
Enabled: true
|
2571
|
+
|
2572
|
+
Lint/DuplicateMethods:
|
2573
|
+
Description: Check for duplicate method definitions.
|
2574
|
+
Enabled: true
|
2575
|
+
|
2576
|
+
Lint/DuplicatedKey:
|
2577
|
+
Description: Check for duplicate keys in hash literals.
|
2578
|
+
Enabled: true
|
2579
|
+
|
2580
|
+
Lint/EachWithObjectArgument:
|
2581
|
+
Description: Check for immutable argument given to each_with_object.
|
2582
|
+
Enabled: true
|
2583
|
+
|
2584
|
+
Lint/ElseLayout:
|
2585
|
+
Description: Check for odd code arrangement in an else block.
|
2586
|
+
Enabled: true
|
2587
|
+
|
2588
|
+
Lint/EmptyEnsure:
|
2589
|
+
Description: Checks for empty ensure block.
|
2590
|
+
Enabled: true
|
2591
|
+
AutoCorrect: false
|
2592
|
+
|
2593
|
+
Lint/EmptyExpression:
|
2594
|
+
Description: Checks for empty expressions.
|
2595
|
+
Enabled: true
|
2596
|
+
|
2597
|
+
Lint/EmptyInterpolation:
|
2598
|
+
Description: Checks for empty string interpolation.
|
2599
|
+
Enabled: true
|
2600
|
+
|
2601
|
+
Lint/EmptyWhen:
|
2602
|
+
Description: Checks for `when` branches with empty bodies.
|
2603
|
+
Enabled: true
|
2604
|
+
|
2605
|
+
Lint/EndInMethod:
|
2606
|
+
Description: END blocks should not be placed inside method definitions.
|
2607
|
+
Enabled: true
|
2608
|
+
|
2609
|
+
Lint/EnsureReturn:
|
2610
|
+
Description: Do not use return in an ensure block.
|
2611
|
+
StyleGuide: "#no-return-ensure"
|
2612
|
+
Enabled: true
|
2613
|
+
|
2614
|
+
Lint/FloatOutOfRange:
|
2615
|
+
Description: Catches floating-point literals too large or small for Ruby to represent.
|
2616
|
+
Enabled: true
|
2617
|
+
|
2618
|
+
Lint/FormatParameterMismatch:
|
2619
|
+
Description: The number of parameters to format/sprint must match the fields.
|
2620
|
+
Enabled: true
|
2621
|
+
Lint/HandleExceptions:
|
2622
|
+
Description: Don't suppress exception.
|
2623
|
+
StyleGuide: "#dont-hide-exceptions"
|
2624
|
+
Enabled: true
|
2625
|
+
Lint/ImplicitStringConcatenation:
|
2626
|
+
Description: Checks for adjacent string literals on the same line, which could better
|
2627
|
+
be represented as a single string literal.
|
2628
|
+
Enabled: true
|
2629
|
+
Lint/IneffectiveAccessModifier:
|
2630
|
+
Description: Checks for attempts to use `private` or `protected` to set the visibility
|
2631
|
+
of a class method, which does not work.
|
2632
|
+
Enabled: true
|
2633
|
+
|
2634
|
+
Lint/InheritException:
|
2635
|
+
Enabled: true
|
2636
|
+
Description: Avoid inheriting from the `Exception` class.
|
2637
|
+
EnforcedStyle: runtime_error
|
2638
|
+
SupportedStyles:
|
2639
|
+
- runtime_error
|
2640
|
+
- standard_error
|
2641
|
+
|
2642
|
+
Lint/InterpolationCheck:
|
2643
|
+
Description: Raise warning for interpolation in single q strs
|
2644
|
+
Enabled: true
|
2645
|
+
Lint/LiteralAsCondition:
|
2646
|
+
Description: Checks of literals used in conditions.
|
2647
|
+
Enabled: true
|
2648
|
+
Lint/LiteralInInterpolation:
|
2649
|
+
Description: Checks for literals used in interpolation.
|
2650
|
+
Enabled: true
|
2651
|
+
Lint/Loop:
|
2652
|
+
Description: Use Kernel#loop with break rather than begin/end/until or begin/end/while
|
2653
|
+
for post-loop tests.
|
2654
|
+
StyleGuide: "#loop-with-break"
|
2655
|
+
Enabled: true
|
2656
|
+
|
2657
|
+
Lint/MissingCopEnableDirective:
|
2658
|
+
# Maximum number of consecutive lines the cop can be disabled for.
|
2659
|
+
# 0 allows only single-line disables
|
2660
|
+
# 1 would mean the maximum allowed is the following:
|
2661
|
+
# # rubocop:disable SomeCop
|
2662
|
+
# a = 1
|
2663
|
+
# # rubocop:enable SomeCop
|
2664
|
+
# .inf for any size
|
2665
|
+
Enabled: true
|
2666
|
+
Description: Checks for a `# rubocop:enable` after `# rubocop:disable`
|
2667
|
+
MaximumRangeSize: .inf
|
2668
|
+
|
2669
|
+
Lint/MultipleCompare:
|
2670
|
+
Description: Use `&&` operator to compare multiple value.
|
2671
|
+
Enabled: true
|
2672
|
+
Lint/NestedMethodDefinition:
|
2673
|
+
Description: Do not use nested method definitions.
|
2674
|
+
StyleGuide: "#no-nested-methods"
|
2675
|
+
Enabled: true
|
2676
|
+
Lint/NestedPercentLiteral:
|
2677
|
+
Description: Checks for nested percent literals.
|
2678
|
+
Enabled: true
|
2679
|
+
Lint/NextWithoutAccumulator:
|
2680
|
+
Description: Do not omit the accumulator when calling `next` in a `reduce`/`inject`
|
2681
|
+
block.
|
2682
|
+
Enabled: true
|
2683
|
+
Lint/NonLocalExitFromIterator:
|
2684
|
+
Enabled: true
|
2685
|
+
Description: Do not use return in iterator to cause non-local exit.
|
2686
|
+
|
2687
|
+
Lint/NumberConversion:
|
2688
|
+
Enabled: false
|
2689
|
+
Description: Checks unsafe usage of number conversion methods.
|
2690
|
+
|
2691
|
+
Lint/OrderedMagicComments:
|
2692
|
+
Description: Checks the proper ordering of magic comments and whether a magic comment
|
2693
|
+
is not placed before a shebang.
|
2694
|
+
Enabled: true
|
2695
|
+
|
2696
|
+
Lint/ParenthesesAsGroupedExpression:
|
2697
|
+
Description: Checks for method calls with a space before the opening parenthesis.
|
2698
|
+
StyleGuide: "#parens-no-spaces"
|
2699
|
+
Enabled: true
|
2700
|
+
|
2701
|
+
Lint/PercentStringArray:
|
2702
|
+
Description: Checks for unwanted commas and quotes in %w/%W literals.
|
2703
|
+
Enabled: true
|
2704
|
+
|
2705
|
+
Lint/PercentSymbolArray:
|
2706
|
+
Description: Checks for unwanted commas and colons in %i/%I literals.
|
2707
|
+
Enabled: true
|
2708
|
+
|
2709
|
+
Lint/RandOne:
|
2710
|
+
Description: Checks for `rand(1)` calls. Such calls always return `0` and most likely
|
2711
|
+
a mistake.
|
2712
|
+
Enabled: true
|
2713
|
+
|
2714
|
+
Lint/RedundantWithIndex:
|
2715
|
+
Description: Checks for redundant `with_index`.
|
2716
|
+
Enabled: true
|
2717
|
+
|
2718
|
+
Lint/RedundantWithObject:
|
2719
|
+
Description: Checks for redundant `with_object`.
|
2720
|
+
Enabled: true
|
2721
|
+
|
2722
|
+
Lint/RegexpAsCondition:
|
2723
|
+
Description: Do not use regexp literal as a condition. The regexp literal matches
|
2724
|
+
`$_` implicitly.
|
2725
|
+
Enabled: true
|
2726
|
+
|
2727
|
+
Lint/RequireParentheses:
|
2728
|
+
Description: Use parentheses in the method call to avoid confusion about precedence.
|
2729
|
+
Enabled: true
|
2730
|
+
|
2731
|
+
Lint/RescueException:
|
2732
|
+
Description: Avoid rescuing the Exception class.
|
2733
|
+
StyleGuide: "#no-blind-rescues"
|
2734
|
+
Enabled: true
|
2735
|
+
|
2736
|
+
Lint/RescueType:
|
2737
|
+
Description: Avoid rescuing from non constants that could result in a `TypeError`.
|
2738
|
+
Enabled: true
|
2739
|
+
|
2740
|
+
Lint/ReturnInVoidContext:
|
2741
|
+
Description: Checks for return in void context.
|
2742
|
+
Enabled: true
|
2743
|
+
|
2744
|
+
Lint/SafeNavigationChain:
|
2745
|
+
Enabled: true
|
2746
|
+
Description: Do not chain ordinary method call after safe navigation operator.
|
2747
|
+
Whitelist:
|
2748
|
+
- present?
|
2749
|
+
- blank?
|
2750
|
+
- presence
|
2751
|
+
- try
|
2752
|
+
|
2753
|
+
Lint/ScriptPermission:
|
2754
|
+
Description: Grant script file execute permission.
|
2755
|
+
Enabled: true
|
2756
|
+
|
2757
|
+
# Checks for shadowed arguments
|
2758
|
+
Lint/ShadowedArgument:
|
2759
|
+
Enabled: true
|
2760
|
+
Description: Avoid reassigning arguments before they were used.
|
2761
|
+
IgnoreImplicitReferences: false
|
2762
|
+
|
2763
|
+
Lint/ShadowedException:
|
2764
|
+
Description: Avoid rescuing a higher level exception before a lower level exception.
|
2765
|
+
Enabled: true
|
2766
|
+
|
2767
|
+
Lint/ShadowingOuterLocalVariable:
|
2768
|
+
Description: Do not use the same name as outer local variable for block arguments
|
2769
|
+
or block local variables.
|
2770
|
+
Enabled: true
|
2771
|
+
Lint/StringConversionInInterpolation:
|
2772
|
+
Description: Checks for Object#to_s usage in string interpolation.
|
2773
|
+
StyleGuide: "#no-to-s"
|
2774
|
+
Enabled: true
|
2775
|
+
|
2776
|
+
Lint/UnderscorePrefixedVariableName:
|
2777
|
+
Description: Do not use prefix `_` for a variable that is used.
|
2778
|
+
Enabled: true
|
2779
|
+
|
2780
|
+
Lint/UnifiedInteger:
|
2781
|
+
Description: Use Integer instead of Fixnum or Bignum
|
2782
|
+
Enabled: true
|
2783
|
+
|
2784
|
+
Lint/UnneededCopDisableDirective:
|
2785
|
+
Description: 'Checks for rubocop:disable comments that can be removed. Note: this
|
2786
|
+
cop is not disabled when disabling all cops. It must be explicitly disabled.'
|
2787
|
+
Enabled: true
|
2788
|
+
|
2789
|
+
Lint/UnneededCopEnableDirective:
|
2790
|
+
Description: Checks for rubocop:enable comments that can be removed.
|
2791
|
+
Enabled: true
|
2792
|
+
|
2793
|
+
Lint/UnneededRequireStatement:
|
2794
|
+
Description: Checks for unnecessary `require` statement.
|
2795
|
+
Enabled: true
|
2796
|
+
|
2797
|
+
Lint/UnneededSplatExpansion:
|
2798
|
+
Description: Checks for splat unnecessarily being called on literals
|
2799
|
+
Enabled: true
|
2800
|
+
|
2801
|
+
Lint/UnreachableCode:
|
2802
|
+
Description: Unreachable code.
|
2803
|
+
Enabled: true
|
2804
|
+
|
2805
|
+
# Checks for unused block arguments
|
2806
|
+
Lint/UnusedBlockArgument:
|
2807
|
+
IgnoreEmptyBlocks: true
|
2808
|
+
AllowUnusedKeywordArguments: false
|
2809
|
+
Description: Checks for unused block arguments.
|
2810
|
+
StyleGuide: "#underscore-unused-vars"
|
2811
|
+
Enabled: true
|
2812
|
+
|
2813
|
+
# Checks for unused method arguments.
|
2814
|
+
Lint/UnusedMethodArgument:
|
2815
|
+
AllowUnusedKeywordArguments: false
|
2816
|
+
IgnoreEmptyMethods: true
|
2817
|
+
Description: Checks for unused method arguments.
|
2818
|
+
StyleGuide: "#underscore-unused-vars"
|
2819
|
+
Enabled: true
|
2820
|
+
|
2821
|
+
Lint/UriEscapeUnescape:
|
2822
|
+
Description: "`URI.escape` method is obsolete and should not be used. Instead, use
|
2823
|
+
`CGI.escape`, `URI.encode_www_form` or `URI.encode_www_form_component` depending
|
2824
|
+
on your specific use case. Also `URI.unescape` method is obsolete and should not
|
2825
|
+
be used. Instead, use `CGI.unescape`, `URI.decode_www_form` or `URI.decode_www_form_component`
|
2826
|
+
depending on your specific use case."
|
2827
|
+
Enabled: true
|
2828
|
+
|
2829
|
+
Lint/UriRegexp:
|
2830
|
+
Description: Use `URI::DEFAULT_PARSER.make_regexp` instead of `URI.regexp`.
|
2831
|
+
Enabled: true
|
2832
|
+
|
2833
|
+
Lint/UselessAccessModifier:
|
2834
|
+
Description: Checks for useless access modifiers.
|
2835
|
+
Enabled: true
|
2836
|
+
ContextCreatingMethods: []
|
2837
|
+
MethodCreatingMethods: []
|
2838
|
+
|
2839
|
+
Lint/UselessAssignment:
|
2840
|
+
Description: Checks for useless assignment to a local variable.
|
2841
|
+
StyleGuide: "#underscore-unused-vars"
|
2842
|
+
Enabled: true
|
2843
|
+
|
2844
|
+
Lint/UselessComparison:
|
2845
|
+
Description: Checks for comparison of something with itself.
|
2846
|
+
Enabled: true
|
2847
|
+
|
2848
|
+
Lint/UselessElseWithoutRescue:
|
2849
|
+
Description: Checks for useless `else` in `begin..end` without `rescue`.
|
2850
|
+
Enabled: true
|
2851
|
+
|
2852
|
+
Lint/UselessSetterCall:
|
2853
|
+
Description: Checks for useless setter call to a local variable.
|
2854
|
+
Enabled: true
|
2855
|
+
|
2856
|
+
Lint/Void:
|
2857
|
+
CheckForMethodsWithNoSideEffects: false
|
2858
|
+
Description: Possible use of operator/literal/variable in void context.
|
2859
|
+
Enabled: true
|
2860
|
+
|
2861
|
+
#################### Performance ###########################
|
2862
|
+
|
2863
|
+
Performance/Caller:
|
2864
|
+
Description: Use `caller(n..n)` instead of `caller`.
|
2865
|
+
Enabled: true
|
2866
|
+
|
2867
|
+
Performance/CaseWhenSplat:
|
2868
|
+
Description: Place `when` conditions that use splat at the end of the list of `when`
|
2869
|
+
branches.
|
2870
|
+
Enabled: true
|
2871
|
+
|
2872
|
+
Performance/Casecmp:
|
2873
|
+
Description: Use `casecmp` rather than `downcase ==`, `upcase ==`, `== downcase`,
|
2874
|
+
or `== upcase`..
|
2875
|
+
Reference: https://github.com/JuanitoFatas/fast-ruby#stringcasecmp-vs-stringdowncase---code
|
2876
|
+
Enabled: true
|
2877
|
+
|
2878
|
+
Performance/CompareWithBlock:
|
2879
|
+
Description: Use `sort_by(&:foo)` instead of `sort { |a, b| a.foo <=> b.foo }`.
|
2880
|
+
Enabled: true
|
2881
|
+
|
2882
|
+
Performance/Count:
|
2883
|
+
Description: >-
|
2884
|
+
Use `count` instead of `select...size`, `reject...size`,
|
2885
|
+
`select...count`, `reject...count`, `select...length`,
|
2886
|
+
and `reject...length`.
|
2887
|
+
# This cop has known compatibility issues with `ActiveRecord` and other
|
2888
|
+
# frameworks. ActiveRecord's `count` ignores the block that is passed to it.
|
2889
|
+
# For more information, see the documentation in the cop itself.
|
2890
|
+
# If you understand the known risk, you can disable `SafeMode`.
|
2891
|
+
SafeMode: true
|
2892
|
+
Enabled: true
|
2893
|
+
|
2894
|
+
Performance/Detect:
|
2895
|
+
Description: >-
|
2896
|
+
Use `detect` instead of `select.first`, `find_all.first`,
|
2897
|
+
`select.last`, and `find_all.last`.
|
2898
|
+
Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerabledetect-vs-enumerableselectfirst-code'
|
2899
|
+
# This cop has known compatibility issues with `ActiveRecord` and other
|
2900
|
+
# frameworks. `ActiveRecord` does not implement a `detect` method and `find`
|
2901
|
+
# has its own meaning. Correcting `ActiveRecord` methods with this cop
|
2902
|
+
# should be considered unsafe.
|
2903
|
+
SafeMode: true
|
2904
|
+
Enabled: true
|
2905
|
+
|
2906
|
+
Performance/DoubleStartEndWith:
|
2907
|
+
Description: >-
|
2908
|
+
Use `str.{start,end}_with?(x, ..., y, ...)`
|
2909
|
+
instead of `str.{start,end}_with?(x, ...) || str.{start,end}_with?(y, ...)`.
|
2910
|
+
Enabled: true
|
2911
|
+
# Used to check for `starts_with?` and `ends_with?`.
|
2912
|
+
# These methods are defined by `ActiveSupport`.
|
2913
|
+
IncludeActiveSupportAliases: false
|
2914
|
+
|
2915
|
+
Performance/EndWith:
|
2916
|
+
Description: 'Use `end_with?` instead of a regex match anchored to the end of a string.'
|
2917
|
+
Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringmatch-vs-stringstart_withstringend_with-code-start-code-end'
|
2918
|
+
# This will change to a new method call which isn't guaranteed to be on the
|
2919
|
+
# object. Switching these methods has to be done with knowledge of the types
|
2920
|
+
# of the variables which rubocop doesn't have.
|
2921
|
+
AutoCorrect: false
|
2922
|
+
Enabled: true
|
2923
|
+
|
2924
|
+
Performance/FixedSize:
|
2925
|
+
Description: Do not compute the size of statically sized objects except in constants
|
2926
|
+
Enabled: true
|
2927
|
+
|
2928
|
+
Performance/FlatMap:
|
2929
|
+
Description: >-
|
2930
|
+
Use `Enumerable#flat_map`
|
2931
|
+
instead of `Enumerable#map...Array#flatten(1)`
|
2932
|
+
or `Enumberable#collect..Array#flatten(1)`
|
2933
|
+
Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerablemaparrayflatten-vs-enumerableflat_map-code'
|
2934
|
+
Enabled: true
|
2935
|
+
EnabledForFlattenWithoutParams: false
|
2936
|
+
# If enabled, this cop will warn about usages of
|
2937
|
+
# `flatten` being called without any parameters.
|
2938
|
+
# This can be dangerous since `flat_map` will only flatten 1 level, and
|
2939
|
+
# `flatten` without any parameters can flatten multiple levels.
|
2940
|
+
|
2941
|
+
Performance/LstripRstrip:
|
2942
|
+
Description: 'Use `strip` instead of `lstrip.rstrip`.'
|
2943
|
+
Enabled: true
|
2944
|
+
|
2945
|
+
Performance/RangeInclude:
|
2946
|
+
Description: 'Use `Range#cover?` instead of `Range#include?`.'
|
2947
|
+
Reference: 'https://github.com/JuanitoFatas/fast-ruby#cover-vs-include-code'
|
2948
|
+
Enabled: true
|
2949
|
+
|
2950
|
+
Performance/RedundantBlockCall:
|
2951
|
+
Description: 'Use `yield` instead of `block.call`.'
|
2952
|
+
Reference: 'https://github.com/JuanitoFatas/fast-ruby#proccall-and-block-arguments-vs-yieldcode'
|
2953
|
+
Enabled: true
|
2954
|
+
|
2955
|
+
Performance/RedundantMatch:
|
2956
|
+
Description: >-
|
2957
|
+
Use `=~` instead of `String#match` or `Regexp#match` in a context where the
|
2958
|
+
returned `MatchData` is not needed.
|
2959
|
+
Enabled: true
|
2960
|
+
|
2961
|
+
Performance/RedundantMerge:
|
2962
|
+
Description: 'Use Hash#[]=, rather than Hash#merge! with a single key-value pair.'
|
2963
|
+
Reference: 'https://github.com/JuanitoFatas/fast-ruby#hashmerge-vs-hash-code'
|
2964
|
+
Enabled: true
|
2965
|
+
# Max number of key-value pairs to consider an offense
|
2966
|
+
MaxKeyValuePairs: 2
|
2967
|
+
|
2968
|
+
Performance/RedundantSortBy:
|
2969
|
+
Description: 'Use `sort` instead of `sort_by { |x| x }`.'
|
2970
|
+
Enabled: true
|
2971
|
+
|
2972
|
+
Performance/RegexpMatch:
|
2973
|
+
Description: >-
|
2974
|
+
Use `match?` instead of `Regexp#match`, `String#match`, `Symbol#match`,
|
2975
|
+
`Regexp#===`, or `=~` when `MatchData` is not used.
|
2976
|
+
Enabled: true
|
2977
|
+
|
2978
|
+
Performance/ReverseEach:
|
2979
|
+
Description: 'Use `reverse_each` instead of `reverse.each`.'
|
2980
|
+
Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerablereverseeach-vs-enumerablereverse_each-code'
|
2981
|
+
Enabled: true
|
2982
|
+
|
2983
|
+
Performance/Sample:
|
2984
|
+
Description: >-
|
2985
|
+
Use `sample` instead of `shuffle.first`,
|
2986
|
+
`shuffle.last`, and `shuffle[Integer]`.
|
2987
|
+
Reference: 'https://github.com/JuanitoFatas/fast-ruby#arrayshufflefirst-vs-arraysample-code'
|
2988
|
+
Enabled: true
|
2989
|
+
|
2990
|
+
Performance/Size:
|
2991
|
+
Description: >-
|
2992
|
+
Use `size` instead of `count` for counting
|
2993
|
+
the number of elements in `Array` and `Hash`.
|
2994
|
+
Reference: 'https://github.com/JuanitoFatas/fast-ruby#arraylength-vs-arraysize-vs-arraycount-code'
|
2995
|
+
Enabled: true
|
2996
|
+
|
2997
|
+
Performance/StartWith:
|
2998
|
+
Description: 'Use `start_with?` instead of a regex match anchored to the beginning of a string.'
|
2999
|
+
Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringmatch-vs-stringstart_withstringend_with-code-start-code-end'
|
3000
|
+
# This will change to a new method call which isn't guaranteed to be on the
|
3001
|
+
# object. Switching these methods has to be done with knowledge of the types
|
3002
|
+
# of the variables which rubocop doesn't have.
|
3003
|
+
AutoCorrect: false
|
3004
|
+
Enabled: true
|
3005
|
+
|
3006
|
+
Performance/StringReplacement:
|
3007
|
+
Description: >-
|
3008
|
+
Use `tr` instead of `gsub` when you are replacing the same
|
3009
|
+
number of characters. Use `delete` instead of `gsub` when
|
3010
|
+
you are deleting characters.
|
3011
|
+
Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringgsub-vs-stringtr-code'
|
3012
|
+
Enabled: true
|
3013
|
+
|
3014
|
+
Performance/TimesMap:
|
3015
|
+
Description: 'Checks for .times.map calls.'
|
3016
|
+
AutoCorrect: false
|
3017
|
+
Enabled: true
|
3018
|
+
|
3019
|
+
Performance/UnfreezeString:
|
3020
|
+
Description: 'Use unary plus to get an unfrozen string literal.'
|
3021
|
+
Enabled: true
|
3022
|
+
|
3023
|
+
Performance/UriDefaultParser:
|
3024
|
+
Description: 'Use `URI::DEFAULT_PARSER` instead of `URI::Parser.new`.'
|
3025
|
+
Enabled: true
|
3026
|
+
|
3027
|
+
#################### Rails #################################
|
3028
|
+
|
3029
|
+
# Rails checks will be disabled by default. For Rails projects, we'll use
|
3030
|
+
# the .rubocop-rails.yml, which inherits from this file, and enables the Rails
|
3031
|
+
# checks:
|
3032
|
+
Rails:
|
3033
|
+
Enabled: false
|
3034
|
+
|
3035
|
+
#################### Bundler ###############################
|
3036
|
+
|
3037
|
+
Bundler/OrderedGems:
|
3038
|
+
Enabled: true
|
3039
|
+
Description: Gems within groups in the Gemfile should be alphabetically sorted.
|
3040
|
+
TreatCommentsAsGroupSeparators: true
|
3041
|
+
Include:
|
3042
|
+
- "**/*.gemfile"
|
3043
|
+
- "**/Gemfile"
|
3044
|
+
- "**/gems.rb"
|
3045
|
+
|
3046
|
+
Bundler/DuplicatedGem:
|
3047
|
+
Enabled: true
|
3048
|
+
Description: Checks for duplicate gem entries in Gemfile.
|
3049
|
+
Include:
|
3050
|
+
- "**/*.gemfile"
|
3051
|
+
- "**/Gemfile"
|
3052
|
+
- "**/gems.rb"
|
3053
|
+
|
3054
|
+
Bundler/InsecureProtocolSource:
|
3055
|
+
Enabled: true
|
3056
|
+
Description: The source `:gemcutter`, `:rubygems` and `:rubyforge` are deprecated
|
3057
|
+
because HTTP requests are insecure. Please change your source to 'https://rubygems.org'
|
3058
|
+
if possible, or 'http://rubygems.org' if not.
|
3059
|
+
Include:
|
3060
|
+
- "**/*.gemfile"
|
3061
|
+
- "**/Gemfile"
|
3062
|
+
- "**/gems.rb"
|
3063
|
+
|
3064
|
+
#################### Security ##############################
|
3065
|
+
|
3066
|
+
Security/Eval:
|
3067
|
+
Description: 'The use of eval represents a serious security risk.'
|
3068
|
+
Enabled: true
|
3069
|
+
|
3070
|
+
Security/JSONLoad:
|
3071
|
+
Description: >-
|
3072
|
+
Prefer usage of `JSON.parse` over `JSON.load` due to potential
|
3073
|
+
security issues. See reference for more information.
|
3074
|
+
Reference: 'http://ruby-doc.org/stdlib-2.3.0/libdoc/json/rdoc/JSON.html#method-i-load'
|
3075
|
+
Enabled: true
|
3076
|
+
# Autocorrect here will change to a method that may cause crashes depending
|
3077
|
+
# on the value of the argument.
|
3078
|
+
AutoCorrect: false
|
3079
|
+
|
3080
|
+
Security/MarshalLoad:
|
3081
|
+
Description: >-
|
3082
|
+
Avoid using of `Marshal.load` or `Marshal.restore` due to potential
|
3083
|
+
security issues. See reference for more information.
|
3084
|
+
Reference: 'http://ruby-doc.org/core-2.3.3/Marshal.html#module-Marshal-label-Security+considerations'
|
3085
|
+
Enabled: true
|
3086
|
+
|
3087
|
+
Security/Open:
|
3088
|
+
Description: 'The use of Kernel#open represents a serious security risk.'
|
3089
|
+
Enabled: true
|
3090
|
+
|
3091
|
+
Security/YAMLLoad:
|
3092
|
+
Description: >-
|
3093
|
+
Prefer usage of `YAML.safe_load` over `YAML.load` due to potential
|
3094
|
+
security issues. See reference for more information.
|
3095
|
+
Reference: 'https://ruby-doc.org/stdlib-2.3.3/libdoc/yaml/rdoc/YAML.html#module-YAML-label-Security'
|
3096
|
+
Enabled: true
|
3097
|
+
|
3098
|
+
#################### Gemspec ###############################
|
3099
|
+
|
3100
|
+
Gemspec/OrderedDependencies:
|
3101
|
+
Enabled: true
|
3102
|
+
Description: Dependencies in the gemspec should be alphabetically sorted.
|
3103
|
+
TreatCommentsAsGroupSeparators: true
|
3104
|
+
Include:
|
3105
|
+
- "**/*.gemspec"
|
3106
|
+
|
3107
|
+
Gemspec/DuplicatedAssignment:
|
3108
|
+
Enabled: true
|
3109
|
+
Description: An attribute assignment method calls should be listed only once in
|
3110
|
+
a gemspec.
|
3111
|
+
Include:
|
3112
|
+
- "**/*.gemspec"
|
3113
|
+
|
3114
|
+
Gemspec/RequiredRubyVersion:
|
3115
|
+
Enabled: true
|
3116
|
+
Description: Checks that `required_ruby_version` of gemspec and `TargetRubyVersion`
|
3117
|
+
of .rubocop.yml are equal.
|
3118
|
+
Include:
|
3119
|
+
- "**/*.gemspec"
|