clarinet 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +89 -0
- data/.rspec +1 -0
- data/.rubocop.yml +2299 -0
- data/.travis.yml +6 -0
- data/Gemfile +20 -0
- data/LICENSE +15 -0
- data/README.md +29 -0
- data/Rakefile +12 -0
- data/clarinet.gemspec +19 -0
- data/lib/clarinet.rb +17 -0
- data/lib/clarinet/app.rb +28 -0
- data/lib/clarinet/client.rb +161 -0
- data/lib/clarinet/concept.rb +22 -0
- data/lib/clarinet/concepts.rb +47 -0
- data/lib/clarinet/error/error.rb +29 -0
- data/lib/clarinet/input.rb +63 -0
- data/lib/clarinet/inputs.rb +108 -0
- data/lib/clarinet/model.rb +133 -0
- data/lib/clarinet/models.rb +106 -0
- data/lib/clarinet/status.rb +13 -0
- data/lib/clarinet/utils.rb +102 -0
- data/lib/clarinet/version.rb +5 -0
- data/spec/app_spec.rb +12 -0
- data/spec/fixtures/model-predict-default.txt +11 -0
- data/spec/fixtures/models-get.txt +11 -0
- data/spec/fixtures/models-list.txt +11 -0
- data/spec/fixtures/search-general-concept.txt +11 -0
- data/spec/model_spec.rb +57 -0
- data/spec/models_spec.rb +106 -0
- data/spec/spec_helper.rb +109 -0
- metadata +101 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: b90d73d9ce57c2955fe6b269b075f1547df0ee8b
|
4
|
+
data.tar.gz: 71b1659de4eaaed1d2a34100c2953eefbc9d62db
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 82de752e4cff84eeee98eab7d915eb715e9edc5b25424c876dd34bb60e78f6b3738bcea47e922208ce24465aecac2934871700e272692fff1f0ba9310b280b1b
|
7
|
+
data.tar.gz: f22aa15712ced7ab58f5fcadf612174880022462a89b0a9f4a148f4f7e7340104803d8e4c4b8655c80f8e3a2a83b29c2cf763726ee7a9c856ed95bfa077eaa95
|
data/.gitignore
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
|
2
|
+
# Created by https://www.gitignore.io/api/ruby,visualstudiocode,osx
|
3
|
+
|
4
|
+
### Ruby ###
|
5
|
+
*.gem
|
6
|
+
*.rbc
|
7
|
+
/.config
|
8
|
+
/coverage/
|
9
|
+
/InstalledFiles
|
10
|
+
/pkg/
|
11
|
+
/spec/reports/
|
12
|
+
/spec/examples.txt
|
13
|
+
/test/tmp/
|
14
|
+
/test/version_tmp/
|
15
|
+
/tmp/
|
16
|
+
|
17
|
+
# Used by dotenv library to load environment variables.
|
18
|
+
# .env
|
19
|
+
|
20
|
+
## Specific to RubyMotion:
|
21
|
+
.dat*
|
22
|
+
.repl_history
|
23
|
+
build/
|
24
|
+
*.bridgesupport
|
25
|
+
build-iPhoneOS/
|
26
|
+
build-iPhoneSimulator/
|
27
|
+
|
28
|
+
## Specific to RubyMotion (use of CocoaPods):
|
29
|
+
#
|
30
|
+
# We recommend against adding the Pods directory to your .gitignore. However
|
31
|
+
# you should judge for yourself, the pros and cons are mentioned at:
|
32
|
+
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
33
|
+
#
|
34
|
+
# vendor/Pods/
|
35
|
+
|
36
|
+
## Documentation cache and generated files:
|
37
|
+
/.yardoc/
|
38
|
+
/_yardoc/
|
39
|
+
/doc/
|
40
|
+
/rdoc/
|
41
|
+
|
42
|
+
## Environment normalization:
|
43
|
+
/.bundle/
|
44
|
+
/vendor/bundle
|
45
|
+
/lib/bundler/man/
|
46
|
+
|
47
|
+
# for a library or gem, you might want to ignore these files since the code is
|
48
|
+
# intended to run in multiple environments; otherwise, check them in:
|
49
|
+
Gemfile.lock
|
50
|
+
.ruby-version
|
51
|
+
.ruby-gemset
|
52
|
+
|
53
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
54
|
+
.rvmrc
|
55
|
+
|
56
|
+
|
57
|
+
### VisualStudioCode ###
|
58
|
+
.vscode/*
|
59
|
+
!.vscode/settings.json
|
60
|
+
!.vscode/tasks.json
|
61
|
+
!.vscode/launch.json
|
62
|
+
!.vscode/extensions.json
|
63
|
+
|
64
|
+
|
65
|
+
### OSX ###
|
66
|
+
*.DS_Store
|
67
|
+
.AppleDouble
|
68
|
+
.LSOverride
|
69
|
+
|
70
|
+
# Icon must end with two \r
|
71
|
+
Icon
|
72
|
+
# Thumbnails
|
73
|
+
._*
|
74
|
+
# Files that might appear in the root of a volume
|
75
|
+
.DocumentRevisions-V100
|
76
|
+
.fseventsd
|
77
|
+
.Spotlight-V100
|
78
|
+
.TemporaryItems
|
79
|
+
.Trashes
|
80
|
+
.VolumeIcon.icns
|
81
|
+
.com.apple.timemachine.donotpresent
|
82
|
+
# Directories potentially created on remote AFP share
|
83
|
+
.AppleDB
|
84
|
+
.AppleDesktop
|
85
|
+
Network Trash Folder
|
86
|
+
Temporary Items
|
87
|
+
.apdisk
|
88
|
+
|
89
|
+
# End of https://www.gitignore.io/api/ruby,visualstudiocode,osx
|
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--require spec_helper
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,2299 @@
|
|
1
|
+
# Common configuration.
|
2
|
+
AllCops:
|
3
|
+
# Include common Ruby source files.
|
4
|
+
Include:
|
5
|
+
- '**/*.gemspec'
|
6
|
+
- '**/*.podspec'
|
7
|
+
- '**/*.jbuilder'
|
8
|
+
- '**/*.rake'
|
9
|
+
- '**/*.opal'
|
10
|
+
- '**/config.ru'
|
11
|
+
- '**/Gemfile'
|
12
|
+
- '**/Rakefile'
|
13
|
+
- '**/Capfile'
|
14
|
+
- '**/Guardfile'
|
15
|
+
- '**/Podfile'
|
16
|
+
- '**/Thorfile'
|
17
|
+
- '**/Vagrantfile'
|
18
|
+
- '**/Berksfile'
|
19
|
+
- '**/Cheffile'
|
20
|
+
- '**/Vagabondfile'
|
21
|
+
Exclude:
|
22
|
+
- 'vendor/**/*'
|
23
|
+
# Default formatter will be used if no -f/--format option is given.
|
24
|
+
DefaultFormatter: progress
|
25
|
+
# Cop names are not displayed in offense messages by default. Change behavior
|
26
|
+
# by overriding DisplayCopNames, or by giving the -D/--display-cop-names
|
27
|
+
# option.
|
28
|
+
DisplayCopNames: true
|
29
|
+
# Style guide URLs are not displayed in offense messages by default. Change
|
30
|
+
# behavior by overriding DisplayStyleGuide, or by giving the
|
31
|
+
# -S/--display-style-guide option.
|
32
|
+
DisplayStyleGuide: false
|
33
|
+
# Extra details are not displayed in offense messages by default. Change
|
34
|
+
# behavior by overriding ExtraDetails, or by giving the
|
35
|
+
# -E/--extra-details option.
|
36
|
+
ExtraDetails: false
|
37
|
+
# Additional cops that do not reference a style guide rule may be enabled by
|
38
|
+
# default. Change behavior by overriding StyleGuideCopsOnly, or by giving
|
39
|
+
# the --only-guide-cops option.
|
40
|
+
StyleGuideCopsOnly: false
|
41
|
+
# All cops except the ones in disabled.yml are enabled by default. Change
|
42
|
+
# this behavior by overriding DisabledByDefault. When DisabledByDefault is
|
43
|
+
# true, all cops in the default configuration are disabled, and and only cops
|
44
|
+
# in user configuration are enabled. This makes cops opt-in instead of
|
45
|
+
# opt-out. Note that when DisabledByDefault is true, cops in user
|
46
|
+
# configuration will be enabled even if they don't set the Enabled parameter.
|
47
|
+
DisabledByDefault: false
|
48
|
+
# Enables the result cache if true. Can be overridden by the --cache command
|
49
|
+
# line option.
|
50
|
+
UseCache: true
|
51
|
+
# Threshold for how many files can be stored in the result cache before some
|
52
|
+
# of the files are automatically removed.
|
53
|
+
MaxFilesInCache: 20000
|
54
|
+
# The cache will be stored in "rubocop_cache" under this directory. The name
|
55
|
+
# "/tmp" is special and will be converted to the system temporary directory,
|
56
|
+
# which is "/tmp" on Unix-like systems, but could be something else on other
|
57
|
+
# systems.
|
58
|
+
CacheRootDirectory: /tmp
|
59
|
+
# What version of the Ruby interpreter is the inspected code intended to
|
60
|
+
# run on? (If there is more than one, set this to the lowest version.)
|
61
|
+
TargetRubyVersion: 2.3
|
62
|
+
|
63
|
+
# Indent private/protected/public as deep as method definitions
|
64
|
+
Style/AccessModifierIndentation:
|
65
|
+
Description: Check indentation of private/protected visibility modifiers.
|
66
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#indent-public-private-protected'
|
67
|
+
Enabled: true
|
68
|
+
EnforcedStyle: indent
|
69
|
+
SupportedStyles:
|
70
|
+
- outdent
|
71
|
+
- indent
|
72
|
+
# By default, the indentation width from Style/IndentationWidth is used
|
73
|
+
# But it can be overridden by setting this parameter
|
74
|
+
IndentationWidth: ~
|
75
|
+
|
76
|
+
Style/AccessorMethodName:
|
77
|
+
Description: Check the naming of accessor methods for get_/set_.
|
78
|
+
Enabled: true
|
79
|
+
|
80
|
+
Style/Alias:
|
81
|
+
Description: 'Use alias_method instead of alias.'
|
82
|
+
Enabled: true
|
83
|
+
EnforcedStyle: prefer_alias
|
84
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#alias-method'
|
85
|
+
SupportedStyles:
|
86
|
+
- prefer_alias
|
87
|
+
- prefer_alias_method
|
88
|
+
|
89
|
+
Style/AlignArray:
|
90
|
+
Description: >-
|
91
|
+
Align the elements of an array literal if they span more than
|
92
|
+
one line.
|
93
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#align-multiline-arrays'
|
94
|
+
Enabled: true
|
95
|
+
|
96
|
+
# Align the elements of a hash literal if they span more than one line.
|
97
|
+
Style/AlignHash:
|
98
|
+
Description: >-
|
99
|
+
Align the elements of a hash literal if they span more than
|
100
|
+
one line.
|
101
|
+
Enabled: true
|
102
|
+
# Alignment of entries using hash rocket as separator. Valid values are:
|
103
|
+
#
|
104
|
+
# key - left alignment of keys
|
105
|
+
# 'a' => 2
|
106
|
+
# 'bb' => 3
|
107
|
+
# separator - alignment of hash rockets, keys are right aligned
|
108
|
+
# 'a' => 2
|
109
|
+
# 'bb' => 3
|
110
|
+
# table - left alignment of keys, hash rockets, and values
|
111
|
+
# 'a' => 2
|
112
|
+
# 'bb' => 3
|
113
|
+
EnforcedHashRocketStyle: key
|
114
|
+
# Alignment of entries using colon as separator. Valid values are:
|
115
|
+
#
|
116
|
+
# key - left alignment of keys
|
117
|
+
# a: 0
|
118
|
+
# bb: 1
|
119
|
+
# separator - alignment of colons, keys are right aligned
|
120
|
+
# a: 0
|
121
|
+
# bb: 1
|
122
|
+
# table - left alignment of keys and values
|
123
|
+
# a: 0
|
124
|
+
# bb: 1
|
125
|
+
EnforcedColonStyle: key
|
126
|
+
# Select whether hashes that are the last argument in a method call should be
|
127
|
+
# inspected? Valid values are:
|
128
|
+
#
|
129
|
+
# always_inspect - Inspect both implicit and explicit hashes.
|
130
|
+
# Registers an offense for:
|
131
|
+
# function(a: 1,
|
132
|
+
# b: 2)
|
133
|
+
# Registers an offense for:
|
134
|
+
# function({a: 1,
|
135
|
+
# b: 2})
|
136
|
+
# always_ignore - Ignore both implicit and explicit hashes.
|
137
|
+
# Accepts:
|
138
|
+
# function(a: 1,
|
139
|
+
# b: 2)
|
140
|
+
# Accepts:
|
141
|
+
# function({a: 1,
|
142
|
+
# b: 2})
|
143
|
+
# ignore_implicit - Ignore only implicit hashes.
|
144
|
+
# Accepts:
|
145
|
+
# function(a: 1,
|
146
|
+
# b: 2)
|
147
|
+
# Registers an offense for:
|
148
|
+
# function({a: 1,
|
149
|
+
# b: 2})
|
150
|
+
# ignore_explicit - Ignore only explicit hashes.
|
151
|
+
# Accepts:
|
152
|
+
# function({a: 1,
|
153
|
+
# b: 2})
|
154
|
+
# Registers an offense for:
|
155
|
+
# function(a: 1,
|
156
|
+
# b: 2)
|
157
|
+
EnforcedLastArgumentHashStyle: always_inspect
|
158
|
+
SupportedLastArgumentHashStyles:
|
159
|
+
- always_inspect
|
160
|
+
- always_ignore
|
161
|
+
- ignore_implicit
|
162
|
+
- ignore_explicit
|
163
|
+
|
164
|
+
Style/AlignParameters:
|
165
|
+
Description: >-
|
166
|
+
Align the parameters of a method call if they span more
|
167
|
+
than one line.
|
168
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-double-indent'
|
169
|
+
Enabled: true
|
170
|
+
# Alignment of parameters in multi-line method calls.
|
171
|
+
#
|
172
|
+
# The `with_first_parameter` style aligns the following lines along the same
|
173
|
+
# column as the first parameter.
|
174
|
+
#
|
175
|
+
# method_call(a,
|
176
|
+
# b)
|
177
|
+
#
|
178
|
+
# The `with_fixed_indentation` style aligns the following lines with one
|
179
|
+
# level of indentation relative to the start of the line with the method call.
|
180
|
+
#
|
181
|
+
# method_call(a,
|
182
|
+
# b)
|
183
|
+
EnforcedStyle: with_first_parameter
|
184
|
+
SupportedStyles:
|
185
|
+
- with_first_parameter
|
186
|
+
- with_fixed_indentation
|
187
|
+
|
188
|
+
Style/AndOr:
|
189
|
+
Description: 'Use &&/|| instead of and/or.'
|
190
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-and-or-or'
|
191
|
+
Enabled: true
|
192
|
+
# Whether `and` and `or` are banned only in conditionals (conditionals)
|
193
|
+
# or completely (always).
|
194
|
+
EnforcedStyle: always
|
195
|
+
SupportedStyles:
|
196
|
+
- always
|
197
|
+
- conditionals
|
198
|
+
|
199
|
+
Style/ArrayJoin:
|
200
|
+
Description: 'Use Array#join instead of Array#*.'
|
201
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#array-join'
|
202
|
+
Enabled: true
|
203
|
+
|
204
|
+
Style/AsciiComments:
|
205
|
+
Description: 'Use only ascii symbols in comments.'
|
206
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#english-comments'
|
207
|
+
Enabled: true
|
208
|
+
|
209
|
+
Style/AsciiIdentifiers:
|
210
|
+
Description: 'Use only ascii symbols in identifiers.'
|
211
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#english-identifiers'
|
212
|
+
Enabled: true
|
213
|
+
|
214
|
+
Style/Attr:
|
215
|
+
Description: 'Checks for uses of Module#attr.'
|
216
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#attr'
|
217
|
+
Enabled: true
|
218
|
+
|
219
|
+
# Checks if usage of %() or %Q() matches configuration.
|
220
|
+
Style/BarePercentLiterals:
|
221
|
+
Description: 'Checks if usage of %() or %Q() matches configuration.'
|
222
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#percent-q-shorthand'
|
223
|
+
Enabled: true
|
224
|
+
EnforcedStyle: bare_percent
|
225
|
+
SupportedStyles:
|
226
|
+
- percent_q
|
227
|
+
- bare_percent
|
228
|
+
|
229
|
+
Style/BeginBlock:
|
230
|
+
Description: 'Avoid the use of BEGIN blocks.'
|
231
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-BEGIN-blocks'
|
232
|
+
Enabled: true
|
233
|
+
|
234
|
+
Style/BlockComments:
|
235
|
+
Description: 'Do not use block comments.'
|
236
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-block-comments'
|
237
|
+
Enabled: true
|
238
|
+
|
239
|
+
Style/BlockDelimiters:
|
240
|
+
Description: >-
|
241
|
+
Avoid using {...} for multi-line blocks (multiline chaining is
|
242
|
+
always ugly).
|
243
|
+
Prefer {...} over do...end for single-line blocks.
|
244
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#single-line-blocks'
|
245
|
+
Enabled: true
|
246
|
+
EnforcedStyle: line_count_based
|
247
|
+
SupportedStyles:
|
248
|
+
# The `line_count_based` style enforces braces around single line blocks and
|
249
|
+
# do..end around multi-line blocks.
|
250
|
+
- line_count_based
|
251
|
+
# The `semantic` style enforces braces around functional blocks, where the
|
252
|
+
# primary purpose of the block is to return a value and do..end for
|
253
|
+
# procedural blocks, where the primary purpose of the block is its
|
254
|
+
# side-effects.
|
255
|
+
#
|
256
|
+
# This looks at the usage of a block's method to determine its type (e.g. is
|
257
|
+
# the result of a `map` assigned to a variable or passed to another
|
258
|
+
# method) but exceptions are permitted in the `ProceduralMethods`,
|
259
|
+
# `FunctionalMethods` and `IgnoredMethods` sections below.
|
260
|
+
- semantic
|
261
|
+
# The `braces_for_chaining` style enforces braces around single line blocks
|
262
|
+
# and do..end around multi-line blocks, except for multi-line blocks whose
|
263
|
+
# return value is being chained with another method (in which case braces
|
264
|
+
# are enforced).
|
265
|
+
- braces_for_chaining
|
266
|
+
ProceduralMethods:
|
267
|
+
# Methods that are known to be procedural in nature but look functional from
|
268
|
+
# their usage, e.g.
|
269
|
+
#
|
270
|
+
# time = Benchmark.realtime do
|
271
|
+
# foo.bar
|
272
|
+
# end
|
273
|
+
#
|
274
|
+
# Here, the return value of the block is discarded but the return value of
|
275
|
+
# `Benchmark.realtime` is used.
|
276
|
+
- benchmark
|
277
|
+
- bm
|
278
|
+
- bmbm
|
279
|
+
- create
|
280
|
+
- each_with_object
|
281
|
+
- measure
|
282
|
+
- new
|
283
|
+
- realtime
|
284
|
+
- tap
|
285
|
+
- with_object
|
286
|
+
FunctionalMethods:
|
287
|
+
# Methods that are known to be functional in nature but look procedural from
|
288
|
+
# their usage, e.g.
|
289
|
+
#
|
290
|
+
# let(:foo) { Foo.new }
|
291
|
+
#
|
292
|
+
# Here, the return value of `Foo.new` is used to define a `foo` helper but
|
293
|
+
# doesn't appear to be used from the return value of `let`.
|
294
|
+
- let
|
295
|
+
- let!
|
296
|
+
- subject
|
297
|
+
- watch
|
298
|
+
IgnoredMethods:
|
299
|
+
# Methods that can be either procedural or functional and cannot be
|
300
|
+
# categorised from their usage alone, e.g.
|
301
|
+
#
|
302
|
+
# foo = lambda do |x|
|
303
|
+
# puts "Hello, #{x}"
|
304
|
+
# end
|
305
|
+
#
|
306
|
+
# foo = lambda do |x|
|
307
|
+
# x * 100
|
308
|
+
# end
|
309
|
+
#
|
310
|
+
# Here, it is impossible to tell from the return value of `lambda` whether
|
311
|
+
# the inner block's return value is significant.
|
312
|
+
- lambda
|
313
|
+
- proc
|
314
|
+
- it
|
315
|
+
|
316
|
+
Style/BlockEndNewline:
|
317
|
+
Description: 'Put end statement of multiline block on its own line.'
|
318
|
+
Enabled: true
|
319
|
+
|
320
|
+
Style/BracesAroundHashParameters:
|
321
|
+
Description: 'Enforce braces style around hash parameters.'
|
322
|
+
Enabled: true
|
323
|
+
EnforcedStyle: no_braces
|
324
|
+
SupportedStyles:
|
325
|
+
# The `braces` style enforces braces around all method parameters that are
|
326
|
+
# hashes.
|
327
|
+
- braces
|
328
|
+
# The `no_braces` style checks that the last parameter doesn't have braces
|
329
|
+
# around it.
|
330
|
+
- no_braces
|
331
|
+
# The `context_dependent` style checks that the last parameter doesn't have
|
332
|
+
# braces around it, but requires braces if the second to last parameter is
|
333
|
+
# also a hash literal.
|
334
|
+
- context_dependent
|
335
|
+
|
336
|
+
Style/CaseEquality:
|
337
|
+
Description: 'Avoid explicit use of the case equality operator(===).'
|
338
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-case-equality'
|
339
|
+
Enabled: true
|
340
|
+
|
341
|
+
# Indentation of `when`.
|
342
|
+
Style/CaseIndentation:
|
343
|
+
Description: 'Indentation of when in a case/when/[else/]end.'
|
344
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#indent-when-to-case'
|
345
|
+
Enabled: true
|
346
|
+
IndentWhenRelativeTo: case
|
347
|
+
SupportedStyles:
|
348
|
+
- case
|
349
|
+
- end
|
350
|
+
IndentOneStep: false
|
351
|
+
# By default, the indentation width from Style/IndentationWidth is used
|
352
|
+
# But it can be overridden by setting this parameter
|
353
|
+
# This only matters if IndentOneStep is true
|
354
|
+
IndentationWidth: ~
|
355
|
+
|
356
|
+
Style/CharacterLiteral:
|
357
|
+
Description: 'Checks for uses of character literals.'
|
358
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-character-literals'
|
359
|
+
Enabled: true
|
360
|
+
|
361
|
+
Style/ClassAndModuleCamelCase:
|
362
|
+
Description: 'Use CamelCase for classes and modules.'
|
363
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#camelcase-classes'
|
364
|
+
Enabled: true
|
365
|
+
|
366
|
+
Style/ClassAndModuleChildren:
|
367
|
+
# Checks the style of children definitions at classes and modules.
|
368
|
+
#
|
369
|
+
# Basically there are two different styles:
|
370
|
+
#
|
371
|
+
# `nested` - have each child on a separate line
|
372
|
+
# class Foo
|
373
|
+
# class Bar
|
374
|
+
# end
|
375
|
+
# end
|
376
|
+
#
|
377
|
+
# `compact` - combine definitions as much as possible
|
378
|
+
# class Foo::Bar
|
379
|
+
# end
|
380
|
+
#
|
381
|
+
# The compact style is only forced, for classes / modules with one child.
|
382
|
+
Description: 'Checks style of children classes and modules.'
|
383
|
+
Enabled: false
|
384
|
+
EnforcedStyle: nested
|
385
|
+
SupportedStyles:
|
386
|
+
- nested
|
387
|
+
- compact
|
388
|
+
|
389
|
+
Style/ClassCheck:
|
390
|
+
Description: 'Enforces consistent use of `Object#is_a?` or `Object#kind_of?`.'
|
391
|
+
Enabled: true
|
392
|
+
EnforcedStyle: is_a?
|
393
|
+
SupportedStyles:
|
394
|
+
- is_a?
|
395
|
+
- kind_of?
|
396
|
+
|
397
|
+
Style/ClassMethods:
|
398
|
+
Description: 'Use self when defining module/class methods.'
|
399
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#def-self-class-methods'
|
400
|
+
Enabled: true
|
401
|
+
|
402
|
+
Style/ClassVars:
|
403
|
+
Description: 'Avoid the use of class variables.'
|
404
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-class-vars'
|
405
|
+
Enabled: true
|
406
|
+
|
407
|
+
Style/ClosingParenthesisIndentation:
|
408
|
+
Description: 'Checks the indentation of hanging closing parentheses.'
|
409
|
+
Enabled: true
|
410
|
+
|
411
|
+
# Align with the style guide.
|
412
|
+
Style/CollectionMethods:
|
413
|
+
# Mapping from undesired method to desired_method
|
414
|
+
# e.g. to use `detect` over `find`:
|
415
|
+
#
|
416
|
+
# CollectionMethods:
|
417
|
+
# PreferredMethods:
|
418
|
+
# find: detect
|
419
|
+
Description: 'Preferred collection methods.'
|
420
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#map-find-select-reduce-size'
|
421
|
+
Enabled: false
|
422
|
+
PreferredMethods:
|
423
|
+
collect: 'map'
|
424
|
+
collect!: 'map!'
|
425
|
+
inject: 'reduce'
|
426
|
+
detect: 'find'
|
427
|
+
find_all: 'select'
|
428
|
+
|
429
|
+
Style/ColonMethodCall:
|
430
|
+
Description: 'Do not use :: for method call.'
|
431
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#double-colons'
|
432
|
+
Enabled: true
|
433
|
+
|
434
|
+
# Use ` or %x around command literals.
|
435
|
+
Style/CommandLiteral:
|
436
|
+
Description: 'Use `` or %x around command literals.'
|
437
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#percent-x'
|
438
|
+
Enabled: true
|
439
|
+
EnforcedStyle: backticks
|
440
|
+
# backticks: Always use backticks.
|
441
|
+
# percent_x: Always use %x.
|
442
|
+
# mixed: Use backticks on single-line commands, and %x on multi-line commands.
|
443
|
+
SupportedStyles:
|
444
|
+
- backticks
|
445
|
+
- percent_x
|
446
|
+
- mixed
|
447
|
+
# If false, the cop will always recommend using %x if one or more backticks
|
448
|
+
# are found in the command string.
|
449
|
+
AllowInnerBackticks: false
|
450
|
+
|
451
|
+
# Checks formatting of special comments
|
452
|
+
Style/CommentAnnotation:
|
453
|
+
Description: >-
|
454
|
+
Checks formatting of special comments
|
455
|
+
(TODO, FIXME, OPTIMIZE, HACK, REVIEW).
|
456
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#annotate-keywords'
|
457
|
+
Enabled: true
|
458
|
+
Keywords:
|
459
|
+
- TODO
|
460
|
+
- FIXME
|
461
|
+
- OPTIMIZE
|
462
|
+
- HACK
|
463
|
+
- REVIEW
|
464
|
+
|
465
|
+
Style/CommentIndentation:
|
466
|
+
Description: 'Indentation of comments.'
|
467
|
+
Enabled: true
|
468
|
+
Exclude:
|
469
|
+
- 'test/**/*'
|
470
|
+
|
471
|
+
Style/ConditionalAssignment:
|
472
|
+
Description: >-
|
473
|
+
Use the return value of `if` and `case` statements for
|
474
|
+
assignment to a variable and variable comparison instead
|
475
|
+
of assigning that variable inside of each branch.
|
476
|
+
Enabled: true
|
477
|
+
SingleLineConditionsOnly: true
|
478
|
+
# Whether the cop should register offenses for conditionals whose branches
|
479
|
+
# contain more than one statement a piece
|
480
|
+
|
481
|
+
Style/ConstantName:
|
482
|
+
Description: 'Constants should use SCREAMING_SNAKE_CASE.'
|
483
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#screaming-snake-case'
|
484
|
+
Enabled: true
|
485
|
+
|
486
|
+
# Checks that you have put a copyright in a comment before any code.
|
487
|
+
#
|
488
|
+
# You can override the default Notice in your .rubocop.yml file.
|
489
|
+
#
|
490
|
+
# In order to use autocorrect, you must supply a value for the
|
491
|
+
# AutocorrectNotice key that matches the regexp Notice. A blank
|
492
|
+
# AutocorrectNotice will cause an error during autocorrect.
|
493
|
+
#
|
494
|
+
# Autocorrect will add a copyright notice in a comment at the top
|
495
|
+
# of the file immediately after any shebang or encoding comments.
|
496
|
+
#
|
497
|
+
# Example rubocop.yml:
|
498
|
+
#
|
499
|
+
# Style/Copyright:
|
500
|
+
# Enabled: true
|
501
|
+
# Notice: 'Copyright (\(c\) )?2015 Yahoo! Inc'
|
502
|
+
# AutocorrectNotice: '# Copyright (c) 2015 Yahoo! Inc.'
|
503
|
+
#
|
504
|
+
Style/Copyright:
|
505
|
+
Description: 'Include a copyright notice in each file before any code.'
|
506
|
+
Enabled: false
|
507
|
+
Notice: '^Copyright (\(c\) )?2[0-9]{3} .+'
|
508
|
+
AutocorrectNotice: ''
|
509
|
+
|
510
|
+
Style/DefWithParentheses:
|
511
|
+
Description: 'Use def with parentheses when there are arguments.'
|
512
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#method-parens'
|
513
|
+
Enabled: true
|
514
|
+
|
515
|
+
Style/DeprecatedHashMethods:
|
516
|
+
Description: 'Checks for use of deprecated Hash methods.'
|
517
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#hash-key'
|
518
|
+
Enabled: true
|
519
|
+
|
520
|
+
# Multi-line method chaining should be done with leading dots.
|
521
|
+
Style/DotPosition:
|
522
|
+
Description: 'Checks the position of the dot in multi-line method calls.'
|
523
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#consistent-multi-line-chains'
|
524
|
+
Enabled: true
|
525
|
+
EnforcedStyle: leading
|
526
|
+
SupportedStyles:
|
527
|
+
- leading
|
528
|
+
- trailing
|
529
|
+
|
530
|
+
Style/DoubleNegation:
|
531
|
+
Description: 'Checks for uses of double negation (!!).'
|
532
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-bang-bang'
|
533
|
+
Enabled: true
|
534
|
+
|
535
|
+
Style/EachWithObject:
|
536
|
+
Description: 'Prefer `each_with_object` over `inject` or `reduce`.'
|
537
|
+
Enabled: true
|
538
|
+
|
539
|
+
Style/ElseAlignment:
|
540
|
+
Description: 'Align elses and elsifs correctly.'
|
541
|
+
Enabled: true
|
542
|
+
|
543
|
+
# Warn on empty else statements
|
544
|
+
# empty - warn only on empty else
|
545
|
+
# nil - warn on else with nil in it
|
546
|
+
# both - warn on empty else and else with nil in it
|
547
|
+
Style/EmptyElse:
|
548
|
+
Description: 'Avoid empty else-clauses.'
|
549
|
+
Enabled: true
|
550
|
+
EnforcedStyle: both
|
551
|
+
SupportedStyles:
|
552
|
+
- empty
|
553
|
+
- nil
|
554
|
+
- both
|
555
|
+
|
556
|
+
# Use empty lines between defs.
|
557
|
+
Style/EmptyLineBetweenDefs:
|
558
|
+
# If true, this parameter means that single line method definitions don't
|
559
|
+
# need an empty line between them.
|
560
|
+
Description: 'Use empty lines between defs.'
|
561
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#empty-lines-between-methods'
|
562
|
+
Enabled: true
|
563
|
+
AllowAdjacentOneLineDefs: false
|
564
|
+
|
565
|
+
Style/EmptyLines:
|
566
|
+
Description: "Don't use several empty lines in a row."
|
567
|
+
Enabled: true
|
568
|
+
|
569
|
+
Style/EmptyLinesAroundAccessModifier:
|
570
|
+
Description: "Keep blank lines around access modifiers."
|
571
|
+
Enabled: true
|
572
|
+
|
573
|
+
Style/EmptyLinesAroundBlockBody:
|
574
|
+
Description: "Keeps track of empty lines around block bodies."
|
575
|
+
Enabled: false
|
576
|
+
EnforcedStyle: no_empty_lines
|
577
|
+
SupportedStyles:
|
578
|
+
- empty_lines
|
579
|
+
- no_empty_lines
|
580
|
+
|
581
|
+
Style/EmptyLinesAroundClassBody:
|
582
|
+
Description: "Keeps track of empty lines around class bodies."
|
583
|
+
Enabled: false
|
584
|
+
EnforcedStyle: no_empty_lines
|
585
|
+
SupportedStyles:
|
586
|
+
- empty_lines
|
587
|
+
- no_empty_lines
|
588
|
+
|
589
|
+
Style/EmptyLinesAroundMethodBody:
|
590
|
+
Description: "Keeps track of empty lines around method bodies."
|
591
|
+
Enabled: true
|
592
|
+
|
593
|
+
Style/EmptyLinesAroundModuleBody:
|
594
|
+
Description: "Keeps track of empty lines around module bodies."
|
595
|
+
Enabled: true
|
596
|
+
EnforcedStyle: no_empty_lines
|
597
|
+
SupportedStyles:
|
598
|
+
- empty_lines
|
599
|
+
- no_empty_lines
|
600
|
+
|
601
|
+
Style/EmptyLiteral:
|
602
|
+
Description: 'Prefer literals to Array.new/Hash.new/String.new.'
|
603
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#literal-array-hash'
|
604
|
+
Enabled: true
|
605
|
+
|
606
|
+
# Checks whether the source file has a utf-8 encoding comment or not
|
607
|
+
# AutoCorrectEncodingComment must match the regex
|
608
|
+
# /#.*coding\s?[:=]\s?(?:UTF|utf)-8/
|
609
|
+
Style/Encoding:
|
610
|
+
Description: 'Use UTF-8 as the source file encoding.'
|
611
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#utf-8'
|
612
|
+
Enabled: false
|
613
|
+
EnforcedStyle: always
|
614
|
+
SupportedStyles:
|
615
|
+
- when_needed
|
616
|
+
- always
|
617
|
+
AutoCorrectEncodingComment: '# encoding: utf-8'
|
618
|
+
|
619
|
+
Style/EndBlock:
|
620
|
+
Description: 'Avoid the use of END blocks.'
|
621
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-END-blocks'
|
622
|
+
Enabled: true
|
623
|
+
|
624
|
+
Style/EndOfLine:
|
625
|
+
Description: 'Use Unix-style line endings.'
|
626
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#crlf'
|
627
|
+
Enabled: true
|
628
|
+
|
629
|
+
Style/EvenOdd:
|
630
|
+
Description: 'Favor the use of Fixnum#even? && Fixnum#odd?'
|
631
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#predicate-methods'
|
632
|
+
Enabled: true
|
633
|
+
|
634
|
+
Style/ExtraSpacing:
|
635
|
+
Description: 'Do not use unnecessary spacing.'
|
636
|
+
Enabled: true
|
637
|
+
# When true, allows most uses of extra spacing if the intent is to align
|
638
|
+
# things with the previous or next line, not counting empty lines or comment
|
639
|
+
# lines.
|
640
|
+
AllowForAlignment: true
|
641
|
+
# When true, forces the alignment of = in assignments on consecutive lines.
|
642
|
+
ForceEqualSignAlignment: false
|
643
|
+
|
644
|
+
Style/FileName:
|
645
|
+
Description: 'Use snake_case for source file names.'
|
646
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#snake-case-files'
|
647
|
+
Enabled: true
|
648
|
+
# File names listed in AllCops:Include are excluded by default. Add extra
|
649
|
+
# excludes here.
|
650
|
+
Exclude: []
|
651
|
+
# When true, requires that each source file should define a class or module
|
652
|
+
# with a name which matches the file name (converted to ... case).
|
653
|
+
# It further expects it to be nested inside modules which match the names
|
654
|
+
# of subdirectories in its path.
|
655
|
+
ExpectMatchingDefinition: false
|
656
|
+
# If non-nil, expect all source file names to match the following regex.
|
657
|
+
# Only the file name itself is matched, not the entire file path.
|
658
|
+
# Use anchors as necessary if you want to match the entire name rather than
|
659
|
+
# just a part of it.
|
660
|
+
Regex: ~
|
661
|
+
# With `IgnoreExecutableScripts` set to `true`, this cop does not
|
662
|
+
# report offending filenames for executable scripts (i.e. source
|
663
|
+
# files with a shebang in the first line).
|
664
|
+
IgnoreExecutableScripts: true
|
665
|
+
|
666
|
+
Style/FirstParameterIndentation:
|
667
|
+
Description: 'Checks the indentation of the first parameter in a method call.'
|
668
|
+
Enabled: true
|
669
|
+
EnforcedStyle: special_for_inner_method_call_in_parentheses
|
670
|
+
SupportedStyles:
|
671
|
+
# The first parameter should always be indented one step more than the
|
672
|
+
# preceding line.
|
673
|
+
- consistent
|
674
|
+
# The first parameter should normally be indented one step more than the
|
675
|
+
# preceding line, but if it's a parameter for a method call that is itself
|
676
|
+
# a parameter in a method call, then the inner parameter should be indented
|
677
|
+
# relative to the inner method.
|
678
|
+
- special_for_inner_method_call
|
679
|
+
# Same as special_for_inner_method_call except that the special rule only
|
680
|
+
# applies if the outer method call encloses its arguments in parentheses.
|
681
|
+
- special_for_inner_method_call_in_parentheses
|
682
|
+
# By default, the indentation width from Style/IndentationWidth is used
|
683
|
+
# But it can be overridden by setting this parameter
|
684
|
+
IndentationWidth: ~
|
685
|
+
|
686
|
+
Style/FlipFlop:
|
687
|
+
Description: 'Checks for flip flops'
|
688
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-flip-flops'
|
689
|
+
Enabled: true
|
690
|
+
|
691
|
+
# Checks use of for or each in multiline loops.
|
692
|
+
Style/For:
|
693
|
+
Description: 'Checks use of for or each in multiline loops.'
|
694
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-for-loops'
|
695
|
+
Enabled: true
|
696
|
+
EnforcedStyle: each
|
697
|
+
SupportedStyles:
|
698
|
+
- for
|
699
|
+
- each
|
700
|
+
|
701
|
+
# Enforce the method used for string formatting.
|
702
|
+
Style/FormatString:
|
703
|
+
Description: 'Enforce the use of Kernel#sprintf, Kernel#format or String#%.'
|
704
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#sprintf'
|
705
|
+
Enabled: true
|
706
|
+
EnforcedStyle: format
|
707
|
+
SupportedStyles:
|
708
|
+
- format
|
709
|
+
- sprintf
|
710
|
+
- percent
|
711
|
+
|
712
|
+
Style/FrozenStringLiteralComment:
|
713
|
+
Description: >-
|
714
|
+
Add the frozen_string_literal comment to the top of files
|
715
|
+
to help transition from Ruby 2.3.0 to Ruby 3.0.
|
716
|
+
Enabled: true
|
717
|
+
EnforcedStyle: when_needed
|
718
|
+
SupportedStyles:
|
719
|
+
# `when_needed` will add the frozen string literal comment to files that call
|
720
|
+
# `freeze` or `<<` on a string literal. It will only add the comment to files
|
721
|
+
# when running Ruby 2.3.0+.
|
722
|
+
- when_needed
|
723
|
+
# `always` will always add the frozen string literal comment to a file
|
724
|
+
# regardless of the Ruby version or if `freeze` or `<<` are called on a
|
725
|
+
# string literal. If you run code against multiple versions of Ruby, it is
|
726
|
+
# possible that this will create errors in Ruby 2.3.0+.
|
727
|
+
- always
|
728
|
+
|
729
|
+
# Built-in global variables are allowed by default.
|
730
|
+
Style/GlobalVars:
|
731
|
+
Description: 'Do not introduce global variables.'
|
732
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#instance-vars'
|
733
|
+
Reference: 'http://www.zenspider.com/Languages/Ruby/QuickRef.html'
|
734
|
+
Enabled: true
|
735
|
+
AllowedVariables: []
|
736
|
+
|
737
|
+
# `MinBodyLength` defines the number of lines of the a body of an if / unless
|
738
|
+
# needs to have to trigger this cop
|
739
|
+
Style/GuardClause:
|
740
|
+
Description: 'Check for conditionals that can be replaced with guard clauses'
|
741
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-nested-conditionals'
|
742
|
+
Enabled: true
|
743
|
+
MinBodyLength: 1
|
744
|
+
|
745
|
+
Style/HashSyntax:
|
746
|
+
Description: >-
|
747
|
+
Prefer Ruby 1.9 hash syntax { a: 1, b: 2 } over 1.8 syntax
|
748
|
+
{ :a => 1, :b => 2 }.
|
749
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#hash-literals'
|
750
|
+
Enabled: true
|
751
|
+
EnforcedStyle: ruby19
|
752
|
+
SupportedStyles:
|
753
|
+
- ruby19
|
754
|
+
- ruby19_no_mixed_keys
|
755
|
+
- hash_rockets
|
756
|
+
# Force hashes that have a symbol value to use hash rockets
|
757
|
+
UseHashRocketsWithSymbolValues: false
|
758
|
+
|
759
|
+
Style/IdenticalConditionalBranches:
|
760
|
+
Description: >-
|
761
|
+
Checks that conditional statements do not have an identical
|
762
|
+
line at the end of each branch, which can validly be moved
|
763
|
+
out of the conditional.
|
764
|
+
Enabled: true
|
765
|
+
|
766
|
+
Style/IfInsideElse:
|
767
|
+
Description: 'Finds if nodes inside else, which can be converted to elsif.'
|
768
|
+
Enabled: true
|
769
|
+
|
770
|
+
Style/IfUnlessModifier:
|
771
|
+
Description: >-
|
772
|
+
Favor modifier if/unless usage when you have a
|
773
|
+
single-line body.
|
774
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#if-as-a-modifier'
|
775
|
+
Enabled: true
|
776
|
+
MaxLineLength: 80
|
777
|
+
|
778
|
+
Style/IfWithSemicolon:
|
779
|
+
Description: 'Do not use if x; .... Use the ternary operator instead.'
|
780
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-semicolon-ifs'
|
781
|
+
Enabled: true
|
782
|
+
|
783
|
+
Style/IndentationConsistency:
|
784
|
+
# The difference between `rails` and `normal` is that the `rails` style
|
785
|
+
# prescribes that in classes and modules the `protected` and `private`
|
786
|
+
# modifier keywords shall be indented the same as public methods and that
|
787
|
+
# protected and private members shall be indented one step more than the
|
788
|
+
# modifiers. Other than that, both styles mean that entities on the same
|
789
|
+
# logical depth shall have the same indentation.
|
790
|
+
Enabled: true
|
791
|
+
EnforcedStyle: rails
|
792
|
+
SupportedStyles:
|
793
|
+
- normal
|
794
|
+
- rails
|
795
|
+
|
796
|
+
Style/IndentationWidth:
|
797
|
+
Description: 'Use 2 spaces for indentation.'
|
798
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#spaces-indentation'
|
799
|
+
Enabled: true
|
800
|
+
Width: 2
|
801
|
+
|
802
|
+
# Checks the indentation of the first element in an array literal.
|
803
|
+
Style/IndentArray:
|
804
|
+
Description: >-
|
805
|
+
Checks the indentation of the first element in an array
|
806
|
+
literal.
|
807
|
+
Enabled: true
|
808
|
+
# The value `special_inside_parentheses` means that array literals with
|
809
|
+
# brackets that have their opening bracket on the same line as a surrounding
|
810
|
+
# opening round parenthesis, shall have their first element indented relative
|
811
|
+
# to the first position inside the parenthesis.
|
812
|
+
#
|
813
|
+
# The value `consistent` means that the indentation of the first element shall
|
814
|
+
# always be relative to the first position of the line where the opening
|
815
|
+
# bracket is.
|
816
|
+
#
|
817
|
+
# The value `align_brackets` means that the indentation of the first element
|
818
|
+
# shall always be relative to the position of the opening bracket.
|
819
|
+
EnforcedStyle: special_inside_parentheses
|
820
|
+
SupportedStyles:
|
821
|
+
- special_inside_parentheses
|
822
|
+
- consistent
|
823
|
+
- align_brackets
|
824
|
+
# By default, the indentation width from Style/IndentationWidth is used
|
825
|
+
# But it can be overridden by setting this parameter
|
826
|
+
IndentationWidth: ~
|
827
|
+
|
828
|
+
# Checks the indentation of assignment RHS, when on a different line from LHS
|
829
|
+
Style/IndentAssignment:
|
830
|
+
Description: >-
|
831
|
+
Checks the indentation of the first line of the
|
832
|
+
right-hand-side of a multi-line assignment.
|
833
|
+
Enabled: true
|
834
|
+
# By default, the indentation width from Style/IndentationWidth is used
|
835
|
+
# But it can be overridden by setting this parameter
|
836
|
+
IndentationWidth: ~
|
837
|
+
|
838
|
+
# Checks the indentation of the first key in a hash literal.
|
839
|
+
Style/IndentHash:
|
840
|
+
Description: 'Checks the indentation of the first key in a hash literal.'
|
841
|
+
Enabled: true
|
842
|
+
# The value `special_inside_parentheses` means that hash literals with braces
|
843
|
+
# that have their opening brace on the same line as a surrounding opening
|
844
|
+
# round parenthesis, shall have their first key indented relative to the
|
845
|
+
# first position inside the parenthesis.
|
846
|
+
#
|
847
|
+
# The value `consistent` means that the indentation of the first key shall
|
848
|
+
# always be relative to the first position of the line where the opening
|
849
|
+
# brace is.
|
850
|
+
#
|
851
|
+
# The value `align_braces` means that the indentation of the first key shall
|
852
|
+
# always be relative to the position of the opening brace.
|
853
|
+
EnforcedStyle: special_inside_parentheses
|
854
|
+
SupportedStyles:
|
855
|
+
- special_inside_parentheses
|
856
|
+
- consistent
|
857
|
+
- align_braces
|
858
|
+
# By default, the indentation width from Style/IndentationWidth is used
|
859
|
+
# But it can be overridden by setting this parameter
|
860
|
+
IndentationWidth: ~
|
861
|
+
|
862
|
+
Style/InfiniteLoop:
|
863
|
+
Description: 'Use Kernel#loop for infinite loops.'
|
864
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#infinite-loop'
|
865
|
+
Enabled: true
|
866
|
+
|
867
|
+
Style/InitialIndentation:
|
868
|
+
Description: >-
|
869
|
+
Checks the indentation of the first non-blank non-comment line in a file.
|
870
|
+
Enabled: true
|
871
|
+
|
872
|
+
Style/Lambda:
|
873
|
+
Description: 'Use the new lambda literal syntax for single-line blocks.'
|
874
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#lambda-multi-line'
|
875
|
+
Enabled: true
|
876
|
+
|
877
|
+
Style/LambdaCall:
|
878
|
+
Description: 'Use lambda.call(...) instead of lambda.(...).'
|
879
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#proc-call'
|
880
|
+
Enabled: true
|
881
|
+
EnforcedStyle: call
|
882
|
+
SupportedStyles:
|
883
|
+
- call
|
884
|
+
- braces
|
885
|
+
|
886
|
+
Style/LeadingCommentSpace:
|
887
|
+
Description: 'Comments should start with a space.'
|
888
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#hash-space'
|
889
|
+
Enabled: true
|
890
|
+
|
891
|
+
Style/LineEndConcatenation:
|
892
|
+
Description: >-
|
893
|
+
Use \ instead of + or << to concatenate two string literals at
|
894
|
+
line end.
|
895
|
+
Enabled: true
|
896
|
+
|
897
|
+
Style/MethodCallParentheses:
|
898
|
+
Description: 'Do not use parentheses for method calls with no arguments.'
|
899
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-args-no-parens'
|
900
|
+
Enabled: true
|
901
|
+
|
902
|
+
Style/MethodDefParentheses:
|
903
|
+
Description: >-
|
904
|
+
Checks if the method definitions have or don't have
|
905
|
+
parentheses.
|
906
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#method-parens'
|
907
|
+
Enabled: true
|
908
|
+
EnforcedStyle: require_parentheses
|
909
|
+
SupportedStyles:
|
910
|
+
- require_parentheses
|
911
|
+
- require_no_parentheses
|
912
|
+
- require_no_parentheses_except_multiline
|
913
|
+
|
914
|
+
Style/MethodName:
|
915
|
+
Description: 'Use the configured style when naming methods.'
|
916
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#snake-case-symbols-methods-vars'
|
917
|
+
Enabled: true
|
918
|
+
EnforcedStyle: snake_case
|
919
|
+
SupportedStyles:
|
920
|
+
- snake_case
|
921
|
+
- camelCase
|
922
|
+
|
923
|
+
Style/ModuleFunction:
|
924
|
+
Description: 'Checks for usage of `extend self` in modules.'
|
925
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#module-function'
|
926
|
+
Enabled: true
|
927
|
+
|
928
|
+
Style/MultilineAssignmentLayout:
|
929
|
+
Description: 'Check for a newline after the assignment operator in multi-line assignments.'
|
930
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#indent-conditional-assignment'
|
931
|
+
Enabled: false
|
932
|
+
# The types of assignments which are subject to this rule.
|
933
|
+
SupportedTypes:
|
934
|
+
- block
|
935
|
+
- case
|
936
|
+
- class
|
937
|
+
- if
|
938
|
+
- kwbegin
|
939
|
+
- module
|
940
|
+
EnforcedStyle: new_line
|
941
|
+
SupportedStyles:
|
942
|
+
# Ensures that the assignment operator and the rhs are on the same line for
|
943
|
+
# the set of supported types.
|
944
|
+
- same_line
|
945
|
+
# Ensures that the assignment operator and the rhs are on separate lines
|
946
|
+
# for the set of supported types.
|
947
|
+
- new_line
|
948
|
+
|
949
|
+
Style/MultilineBlockChain:
|
950
|
+
Description: 'Avoid multi-line chains of blocks.'
|
951
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#single-line-blocks'
|
952
|
+
Enabled: true
|
953
|
+
|
954
|
+
Style/MultilineBlockLayout:
|
955
|
+
Description: 'Ensures newlines after multiline block do statements.'
|
956
|
+
Enabled: true
|
957
|
+
|
958
|
+
Style/MultilineIfThen:
|
959
|
+
Description: 'Do not use then for multi-line if/unless.'
|
960
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-then'
|
961
|
+
Enabled: true
|
962
|
+
|
963
|
+
Style/MultilineOperationIndentation:
|
964
|
+
Description: >-
|
965
|
+
Checks indentation of binary operations that span more than
|
966
|
+
one line.
|
967
|
+
Enabled: true
|
968
|
+
EnforcedStyle: indented
|
969
|
+
SupportedStyles:
|
970
|
+
- aligned
|
971
|
+
- indented
|
972
|
+
# By default, the indentation width from Style/IndentationWidth is used
|
973
|
+
# But it can be overridden by setting this parameter
|
974
|
+
IndentationWidth: ~
|
975
|
+
|
976
|
+
Style/MultilineMethodCallIndentation:
|
977
|
+
Description: >-
|
978
|
+
Checks indentation of method calls with the dot operator
|
979
|
+
that span more than one line.
|
980
|
+
Enabled: true
|
981
|
+
EnforcedStyle: indented
|
982
|
+
SupportedStyles:
|
983
|
+
- aligned
|
984
|
+
- indented
|
985
|
+
# By default, the indentation width from Style/IndentationWidth is used
|
986
|
+
# But it can be overridden by setting this parameter
|
987
|
+
IndentationWidth: ~
|
988
|
+
|
989
|
+
Style/MultilineTernaryOperator:
|
990
|
+
Description: >-
|
991
|
+
Avoid multi-line ?: (the ternary operator);
|
992
|
+
use if/unless instead.
|
993
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-multiline-ternary'
|
994
|
+
Enabled: true
|
995
|
+
|
996
|
+
Style/MutableConstant:
|
997
|
+
Description: 'Do not assign mutable objects to constants.'
|
998
|
+
Enabled: true
|
999
|
+
|
1000
|
+
Style/NegatedIf:
|
1001
|
+
Description: >-
|
1002
|
+
Favor unless over if for negative conditions
|
1003
|
+
(or control flow or).
|
1004
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#unless-for-negatives'
|
1005
|
+
Enabled: true
|
1006
|
+
|
1007
|
+
Style/NegatedWhile:
|
1008
|
+
Description: 'Favor until over while for negative conditions.'
|
1009
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#until-for-negatives'
|
1010
|
+
Enabled: true
|
1011
|
+
|
1012
|
+
Style/NestedModifier:
|
1013
|
+
Description: 'Avoid using nested modifiers.'
|
1014
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-nested-modifiers'
|
1015
|
+
Enabled: true
|
1016
|
+
|
1017
|
+
Style/NestedParenthesizedCalls:
|
1018
|
+
Description: >-
|
1019
|
+
Parenthesize method calls which are nested inside the
|
1020
|
+
argument list of another parenthesized method call.
|
1021
|
+
Enabled: true
|
1022
|
+
|
1023
|
+
Style/NestedTernaryOperator:
|
1024
|
+
Description: 'Use one expression per branch in a ternary operator.'
|
1025
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-nested-ternary'
|
1026
|
+
Enabled: true
|
1027
|
+
|
1028
|
+
Style/Next:
|
1029
|
+
Description: 'Use `next` to skip iteration instead of a condition at the end.'
|
1030
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-nested-conditionals'
|
1031
|
+
Enabled: true
|
1032
|
+
# With `always` all conditions at the end of an iteration needs to be
|
1033
|
+
# replaced by next - with `skip_modifier_ifs` the modifier if like this one
|
1034
|
+
# are ignored: [1, 2].each { |a| return 'yes' if a == 1 }
|
1035
|
+
EnforcedStyle: skip_modifier_ifs
|
1036
|
+
# `MinBodyLength` defines the number of lines of the a body of an if / unless
|
1037
|
+
# needs to have to trigger this cop
|
1038
|
+
MinBodyLength: 3
|
1039
|
+
SupportedStyles:
|
1040
|
+
- skip_modifier_ifs
|
1041
|
+
- always
|
1042
|
+
|
1043
|
+
Style/NilComparison:
|
1044
|
+
Description: 'Prefer x.nil? to x == nil.'
|
1045
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#predicate-methods'
|
1046
|
+
Enabled: true
|
1047
|
+
|
1048
|
+
Style/NonNilCheck:
|
1049
|
+
Description: 'Checks for redundant nil checks.'
|
1050
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-non-nil-checks'
|
1051
|
+
Enabled: true
|
1052
|
+
# With `IncludeSemanticChanges` set to `true`, this cop reports offenses for
|
1053
|
+
# `!x.nil?` and autocorrects that and `x != nil` to solely `x`, which is
|
1054
|
+
# **usually** OK, but might change behavior.
|
1055
|
+
#
|
1056
|
+
# With `IncludeSemanticChanges` set to `false`, this cop does not report
|
1057
|
+
# offenses for `!x.nil?` and does no changes that might change behavior.
|
1058
|
+
IncludeSemanticChanges: false
|
1059
|
+
|
1060
|
+
Style/Not:
|
1061
|
+
Description: 'Use ! instead of not.'
|
1062
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#bang-not-not'
|
1063
|
+
Enabled: true
|
1064
|
+
|
1065
|
+
Style/NumericLiterals:
|
1066
|
+
Description: >-
|
1067
|
+
Add underscores to large numeric literals to improve their
|
1068
|
+
readability.
|
1069
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#underscores-in-numerics'
|
1070
|
+
Enabled: true
|
1071
|
+
MinDigits: 5
|
1072
|
+
|
1073
|
+
Style/OneLineConditional:
|
1074
|
+
Description: >-
|
1075
|
+
Favor the ternary operator(?:) over
|
1076
|
+
if/then/else/end constructs.
|
1077
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#ternary-operator'
|
1078
|
+
Enabled: true
|
1079
|
+
|
1080
|
+
Style/OpMethod:
|
1081
|
+
Description: 'When defining binary operators, name the argument other.'
|
1082
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#other-arg'
|
1083
|
+
Enabled: true
|
1084
|
+
|
1085
|
+
Style/OptionalArguments:
|
1086
|
+
Description: >-
|
1087
|
+
Checks for optional arguments that do not appear at the end
|
1088
|
+
of the argument list
|
1089
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#optional-arguments'
|
1090
|
+
Enabled: true
|
1091
|
+
|
1092
|
+
Style/OptionHash:
|
1093
|
+
Description: "Don't use option hashes when you can use keyword arguments."
|
1094
|
+
Enabled: false
|
1095
|
+
# A list of parameter names that will be flagged by this cop.
|
1096
|
+
SuspiciousParamNames:
|
1097
|
+
- options
|
1098
|
+
- opts
|
1099
|
+
- args
|
1100
|
+
- params
|
1101
|
+
- parameters
|
1102
|
+
|
1103
|
+
Style/ParallelAssignment:
|
1104
|
+
Description: >-
|
1105
|
+
Check for simple usages of parallel assignment.
|
1106
|
+
It will only warn when the number of variables
|
1107
|
+
matches on both sides of the assignment.
|
1108
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#parallel-assignment'
|
1109
|
+
Enabled: true
|
1110
|
+
|
1111
|
+
# Allow safe assignment in conditions.
|
1112
|
+
Style/ParenthesesAroundCondition:
|
1113
|
+
Description: >-
|
1114
|
+
Don't use parentheses around the condition of an
|
1115
|
+
if/unless/while.
|
1116
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-parens-if'
|
1117
|
+
Enabled: true
|
1118
|
+
AllowSafeAssignment: true
|
1119
|
+
|
1120
|
+
Style/PercentLiteralDelimiters:
|
1121
|
+
Description: 'Use `%`-literal delimiters consistently'
|
1122
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#percent-literal-braces'
|
1123
|
+
Enabled: true
|
1124
|
+
PreferredDelimiters:
|
1125
|
+
'%': ()
|
1126
|
+
'%i': ()
|
1127
|
+
'%q': ()
|
1128
|
+
'%Q': ()
|
1129
|
+
'%r': '{}'
|
1130
|
+
'%s': ()
|
1131
|
+
'%w': []
|
1132
|
+
'%W': ()
|
1133
|
+
'%x': ()
|
1134
|
+
|
1135
|
+
Style/PercentQLiterals:
|
1136
|
+
Description: 'Checks if uses of %Q/%q match the configured preference.'
|
1137
|
+
Enabled: true
|
1138
|
+
EnforcedStyle: lower_case_q
|
1139
|
+
SupportedStyles:
|
1140
|
+
- lower_case_q # Use %q when possible, %Q when necessary
|
1141
|
+
- upper_case_q # Always use %Q
|
1142
|
+
|
1143
|
+
Style/PerlBackrefs:
|
1144
|
+
Description: 'Avoid Perl-style regex back references.'
|
1145
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-perl-regexp-last-matchers'
|
1146
|
+
Enabled: true
|
1147
|
+
|
1148
|
+
Style/PredicateName:
|
1149
|
+
Description: 'Check the names of predicate methods.'
|
1150
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#bool-methods-qmark'
|
1151
|
+
Enabled: true
|
1152
|
+
# Predicate name prefixes.
|
1153
|
+
NamePrefix:
|
1154
|
+
- is_
|
1155
|
+
- has_
|
1156
|
+
- have_
|
1157
|
+
# Predicate name prefixes that should be removed.
|
1158
|
+
NamePrefixBlacklist:
|
1159
|
+
- is_
|
1160
|
+
- has_
|
1161
|
+
- have_
|
1162
|
+
# Predicate names which, despite having a blacklisted prefix, or no ?,
|
1163
|
+
# should still be accepted
|
1164
|
+
NameWhitelist:
|
1165
|
+
- is_a?
|
1166
|
+
|
1167
|
+
Style/Proc:
|
1168
|
+
Description: 'Use proc instead of Proc.new.'
|
1169
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#proc'
|
1170
|
+
Enabled: true
|
1171
|
+
|
1172
|
+
Style/RaiseArgs:
|
1173
|
+
Description: 'Checks the arguments passed to raise/fail.'
|
1174
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#exception-class-messages'
|
1175
|
+
Enabled: true
|
1176
|
+
EnforcedStyle: exploded
|
1177
|
+
SupportedStyles:
|
1178
|
+
- compact # raise Exception.new(msg)
|
1179
|
+
- exploded # raise Exception, msg
|
1180
|
+
|
1181
|
+
Style/RedundantBegin:
|
1182
|
+
Description: "Don't use begin blocks when they are not needed."
|
1183
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#begin-implicit'
|
1184
|
+
Enabled: true
|
1185
|
+
|
1186
|
+
Style/RedundantException:
|
1187
|
+
Description: "Checks for an obsolete RuntimeException argument in raise/fail."
|
1188
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-explicit-runtimeerror'
|
1189
|
+
Enabled: true
|
1190
|
+
|
1191
|
+
Style/RedundantFreeze:
|
1192
|
+
Description: "Checks usages of Object#freeze on immutable objects."
|
1193
|
+
Enabled: true
|
1194
|
+
|
1195
|
+
Style/RedundantParentheses:
|
1196
|
+
Description: "Checks for parentheses that seem not to serve any purpose."
|
1197
|
+
Enabled: true
|
1198
|
+
|
1199
|
+
Style/RedundantReturn:
|
1200
|
+
Description: "Don't use return where it's not required."
|
1201
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-explicit-return'
|
1202
|
+
Enabled: true
|
1203
|
+
# When true allows code like `return x, y`.
|
1204
|
+
AllowMultipleReturnValues: false
|
1205
|
+
|
1206
|
+
Style/RedundantSelf:
|
1207
|
+
Description: "Don't use self where it's not needed."
|
1208
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-self-unless-required'
|
1209
|
+
Enabled: true
|
1210
|
+
|
1211
|
+
# Use / or %r around regular expressions.
|
1212
|
+
Style/RegexpLiteral:
|
1213
|
+
Description: 'Use / or %r around regular expressions.'
|
1214
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#percent-r'
|
1215
|
+
Enabled: true
|
1216
|
+
EnforcedStyle: slashes
|
1217
|
+
# slashes: Always use slashes.
|
1218
|
+
# percent_r: Always use %r.
|
1219
|
+
# mixed: Use slashes on single-line regexes, and %r on multi-line regexes.
|
1220
|
+
SupportedStyles:
|
1221
|
+
- slashes
|
1222
|
+
- percent_r
|
1223
|
+
- mixed
|
1224
|
+
# If false, the cop will always recommend using %r if one or more slashes
|
1225
|
+
# are found in the regexp string.
|
1226
|
+
AllowInnerSlashes: false
|
1227
|
+
|
1228
|
+
Style/RescueEnsureAlignment:
|
1229
|
+
Description: 'Align rescues and ensures correctly.'
|
1230
|
+
Enabled: true
|
1231
|
+
|
1232
|
+
Style/RescueModifier:
|
1233
|
+
Description: 'Avoid using rescue in its modifier form.'
|
1234
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-rescue-modifiers'
|
1235
|
+
Enabled: true
|
1236
|
+
|
1237
|
+
Style/SelfAssignment:
|
1238
|
+
Description: >-
|
1239
|
+
Checks for places where self-assignment shorthand should have
|
1240
|
+
been used.
|
1241
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#self-assignment'
|
1242
|
+
Enabled: true
|
1243
|
+
|
1244
|
+
Style/Semicolon:
|
1245
|
+
Description: "Don't use semicolons to terminate expressions."
|
1246
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-semicolon'
|
1247
|
+
Enabled: true
|
1248
|
+
# Allow ; to separate several expressions on the same line.
|
1249
|
+
AllowAsExpressionSeparator: false
|
1250
|
+
|
1251
|
+
Style/SignalException:
|
1252
|
+
Description: 'Checks for proper usage of fail and raise.'
|
1253
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#fail-method'
|
1254
|
+
Enabled: true
|
1255
|
+
EnforcedStyle: only_raise
|
1256
|
+
SupportedStyles:
|
1257
|
+
- only_raise
|
1258
|
+
- only_fail
|
1259
|
+
- semantic
|
1260
|
+
|
1261
|
+
Style/SingleLineBlockParams:
|
1262
|
+
Description: 'Enforces the names of some block params.'
|
1263
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#reduce-blocks'
|
1264
|
+
Enabled: false
|
1265
|
+
Methods:
|
1266
|
+
- reduce:
|
1267
|
+
- a
|
1268
|
+
- e
|
1269
|
+
- inject:
|
1270
|
+
- a
|
1271
|
+
- e
|
1272
|
+
|
1273
|
+
Style/SingleLineMethods:
|
1274
|
+
Description: 'Avoid single-line methods.'
|
1275
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-single-line-methods'
|
1276
|
+
Enabled: true
|
1277
|
+
AllowIfMethodIsEmpty: true
|
1278
|
+
|
1279
|
+
Style/SpaceBeforeFirstArg:
|
1280
|
+
Description: >-
|
1281
|
+
Checks that exactly one space is used between a method name
|
1282
|
+
and the first argument for method calls without parentheses.
|
1283
|
+
Enabled: true
|
1284
|
+
# When true, allows most uses of extra spacing if the intent is to align
|
1285
|
+
# things with the previous or next line, not counting empty lines or comment
|
1286
|
+
# lines.
|
1287
|
+
AllowForAlignment: true
|
1288
|
+
|
1289
|
+
Style/SpaceAfterColon:
|
1290
|
+
Description: 'Use spaces after colons.'
|
1291
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#spaces-operators'
|
1292
|
+
Enabled: true
|
1293
|
+
|
1294
|
+
Style/SpaceAfterComma:
|
1295
|
+
Description: 'Use spaces after commas.'
|
1296
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#spaces-operators'
|
1297
|
+
Enabled: true
|
1298
|
+
|
1299
|
+
Style/SpaceAfterMethodName:
|
1300
|
+
Description: >-
|
1301
|
+
Do not put a space between a method name and the opening
|
1302
|
+
parenthesis in a method definition.
|
1303
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#parens-no-spaces'
|
1304
|
+
Enabled: true
|
1305
|
+
|
1306
|
+
Style/SpaceAfterNot:
|
1307
|
+
Description: Tracks redundant space after the ! operator.
|
1308
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-space-bang'
|
1309
|
+
Enabled: true
|
1310
|
+
|
1311
|
+
Style/SpaceAfterSemicolon:
|
1312
|
+
Description: 'Use spaces after semicolons.'
|
1313
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#spaces-operators'
|
1314
|
+
Enabled: true
|
1315
|
+
|
1316
|
+
Style/SpaceBeforeBlockBraces:
|
1317
|
+
Description: >-
|
1318
|
+
Checks that the left block brace has or doesn't have space
|
1319
|
+
before it.
|
1320
|
+
Enabled: true
|
1321
|
+
EnforcedStyle: space
|
1322
|
+
SupportedStyles:
|
1323
|
+
- space
|
1324
|
+
- no_space
|
1325
|
+
|
1326
|
+
Style/SpaceBeforeComma:
|
1327
|
+
Description: 'No spaces before commas.'
|
1328
|
+
Enabled: true
|
1329
|
+
|
1330
|
+
Style/SpaceBeforeComment:
|
1331
|
+
Description: >-
|
1332
|
+
Checks for missing space between code and a comment on the
|
1333
|
+
same line.
|
1334
|
+
Enabled: true
|
1335
|
+
|
1336
|
+
Style/SpaceBeforeSemicolon:
|
1337
|
+
Description: 'No spaces before semicolons.'
|
1338
|
+
Enabled: true
|
1339
|
+
|
1340
|
+
Style/SpaceInsideBlockBraces:
|
1341
|
+
Description: >-
|
1342
|
+
Checks that block braces have or don't have surrounding space.
|
1343
|
+
For blocks taking parameters, checks that the left brace has
|
1344
|
+
or doesn't have trailing space.
|
1345
|
+
Enabled: true
|
1346
|
+
EnforcedStyle: space
|
1347
|
+
SupportedStyles:
|
1348
|
+
- space
|
1349
|
+
- no_space
|
1350
|
+
# Valid values are: space, no_space
|
1351
|
+
EnforcedStyleForEmptyBraces: no_space
|
1352
|
+
# Space between { and |. Overrides EnforcedStyle if there is a conflict.
|
1353
|
+
SpaceBeforeBlockParameters: true
|
1354
|
+
|
1355
|
+
Style/SpaceAroundBlockParameters:
|
1356
|
+
Description: 'Checks the spacing inside and after block parameters pipes.'
|
1357
|
+
Enabled: true
|
1358
|
+
EnforcedStyleInsidePipes: no_space
|
1359
|
+
SupportedStyles:
|
1360
|
+
- space
|
1361
|
+
- no_space
|
1362
|
+
|
1363
|
+
Style/SpaceAroundEqualsInParameterDefault:
|
1364
|
+
Description: >-
|
1365
|
+
Checks that the equals signs in parameter default assignments
|
1366
|
+
have or don't have surrounding space depending on
|
1367
|
+
configuration.
|
1368
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#spaces-around-equals'
|
1369
|
+
Enabled: true
|
1370
|
+
EnforcedStyle: space
|
1371
|
+
SupportedStyles:
|
1372
|
+
- space
|
1373
|
+
- no_space
|
1374
|
+
|
1375
|
+
Style/SpaceAroundOperators:
|
1376
|
+
Description: 'Use a single space around operators.'
|
1377
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#spaces-operators'
|
1378
|
+
Enabled: true
|
1379
|
+
# When true, allows most uses of extra spacing if the intent is to align
|
1380
|
+
# with an operator on the previous or next line, not counting empty lines
|
1381
|
+
# or comment lines.
|
1382
|
+
AllowForAlignment: true
|
1383
|
+
|
1384
|
+
Style/SpaceInsideHashLiteralBraces:
|
1385
|
+
Description: "Use spaces inside hash literal braces - or don't."
|
1386
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#spaces-operators'
|
1387
|
+
Enabled: true
|
1388
|
+
EnforcedStyle: space
|
1389
|
+
EnforcedStyleForEmptyBraces: no_space
|
1390
|
+
SupportedStyles:
|
1391
|
+
- space
|
1392
|
+
- no_space
|
1393
|
+
|
1394
|
+
Style/SpaceInsideRangeLiteral:
|
1395
|
+
Description: 'No spaces inside range literals.'
|
1396
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-space-inside-range-literals'
|
1397
|
+
Enabled: true
|
1398
|
+
|
1399
|
+
Style/SpaceInsideStringInterpolation:
|
1400
|
+
Description: 'Checks for padding/surrounding spaces inside string interpolation.'
|
1401
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#string-interpolation'
|
1402
|
+
Enabled: true
|
1403
|
+
EnforcedStyle: no_space
|
1404
|
+
SupportedStyles:
|
1405
|
+
- space
|
1406
|
+
- no_space
|
1407
|
+
|
1408
|
+
Style/SpecialGlobalVars:
|
1409
|
+
Description: 'Avoid Perl-style global variables.'
|
1410
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-cryptic-perlisms'
|
1411
|
+
Enabled: true
|
1412
|
+
EnforcedStyle: use_english_names
|
1413
|
+
SupportedStyles:
|
1414
|
+
- use_perl_names
|
1415
|
+
- use_english_names
|
1416
|
+
|
1417
|
+
Style/StabbyLambdaParentheses:
|
1418
|
+
Description: 'Check for the usage of parentheses around stabby lambda arguments.'
|
1419
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#stabby-lambda-with-args'
|
1420
|
+
Enabled: true
|
1421
|
+
EnforcedStyle: require_parentheses
|
1422
|
+
SupportedStyles:
|
1423
|
+
- require_parentheses
|
1424
|
+
- require_no_parentheses
|
1425
|
+
|
1426
|
+
Style/StringLiterals:
|
1427
|
+
Description: 'Checks if uses of quotes match the configured preference.'
|
1428
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#consistent-string-literals'
|
1429
|
+
Enabled: false
|
1430
|
+
EnforcedStyle: single_quotes
|
1431
|
+
SupportedStyles:
|
1432
|
+
- single_quotes
|
1433
|
+
- double_quotes
|
1434
|
+
# If true, strings which span multiple lines using \ for continuation must
|
1435
|
+
# use the same type of quotes on each line.
|
1436
|
+
ConsistentQuotesInMultiline: false
|
1437
|
+
|
1438
|
+
Style/StringLiteralsInInterpolation:
|
1439
|
+
Description: >-
|
1440
|
+
Checks if uses of quotes inside expressions in interpolated
|
1441
|
+
strings match the configured preference.
|
1442
|
+
Enabled: true
|
1443
|
+
EnforcedStyle: single_quotes
|
1444
|
+
SupportedStyles:
|
1445
|
+
- single_quotes
|
1446
|
+
- double_quotes
|
1447
|
+
|
1448
|
+
Style/StringMethods:
|
1449
|
+
Description: 'Checks if configured preferred methods are used over non-preferred.'
|
1450
|
+
Enabled: false
|
1451
|
+
# Mapping from undesired method to desired_method
|
1452
|
+
# e.g. to use `to_sym` over `intern`:
|
1453
|
+
#
|
1454
|
+
# StringMethods:
|
1455
|
+
# PreferredMethods:
|
1456
|
+
# intern: to_sym
|
1457
|
+
PreferredMethods:
|
1458
|
+
intern: to_sym
|
1459
|
+
|
1460
|
+
Style/StructInheritance:
|
1461
|
+
Description: 'Checks for inheritance from Struct.new.'
|
1462
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-extend-struct-new'
|
1463
|
+
Enabled: true
|
1464
|
+
|
1465
|
+
Style/SymbolArray:
|
1466
|
+
Description: 'Use %i or %I for arrays of symbols.'
|
1467
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#percent-i'
|
1468
|
+
Enabled: false
|
1469
|
+
EnforcedStyle: percent
|
1470
|
+
SupportedStyles:
|
1471
|
+
- percent
|
1472
|
+
- brackets
|
1473
|
+
|
1474
|
+
Style/SymbolProc:
|
1475
|
+
# A list of method names to be ignored by the check.
|
1476
|
+
# The names should be fairly unique, otherwise you'll end up ignoring lots of code.
|
1477
|
+
IgnoredMethods:
|
1478
|
+
- respond_to
|
1479
|
+
|
1480
|
+
Style/Tab:
|
1481
|
+
Description: 'No hard tabs.'
|
1482
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#spaces-indentation'
|
1483
|
+
Enabled: true
|
1484
|
+
|
1485
|
+
Style/TrailingBlankLines:
|
1486
|
+
Description: 'Checks trailing blank lines and final newline.'
|
1487
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#newline-eof'
|
1488
|
+
Enabled: true
|
1489
|
+
EnforcedStyle: final_newline
|
1490
|
+
SupportedStyles:
|
1491
|
+
- final_newline
|
1492
|
+
- final_blank_line
|
1493
|
+
|
1494
|
+
Style/TrailingCommaInArguments:
|
1495
|
+
Description: 'Checks for trailing comma in argument lists.'
|
1496
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas'
|
1497
|
+
Enabled: true
|
1498
|
+
# If `comma`, the cop requires a comma after the last argument, but only for
|
1499
|
+
# parenthesized method calls where each argument is on its own line.
|
1500
|
+
# If `consistent_comma`, the cop requires a comma after the last argument,
|
1501
|
+
# for all parenthesized method calls with arguments.
|
1502
|
+
EnforcedStyleForMultiline: no_comma
|
1503
|
+
SupportedStyles:
|
1504
|
+
- comma
|
1505
|
+
- consistent_comma
|
1506
|
+
- no_comma
|
1507
|
+
|
1508
|
+
Style/TrailingCommaInLiteral:
|
1509
|
+
Description: 'Checks for trailing comma in array and hash literals.'
|
1510
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas'
|
1511
|
+
Enabled: true
|
1512
|
+
# If `comma`, the cop requires a comma after the last item in an array or
|
1513
|
+
# hash, but only when each item is on its own line.
|
1514
|
+
# If `consistent_comma`, the cop requires a comma after the last item of all
|
1515
|
+
# non-empty array and hash literals.
|
1516
|
+
EnforcedStyleForMultiline: no_comma
|
1517
|
+
SupportedStyles:
|
1518
|
+
- comma
|
1519
|
+
- consistent_comma
|
1520
|
+
- no_comma
|
1521
|
+
|
1522
|
+
Style/TrailingUnderscoreVariable:
|
1523
|
+
Description: >-
|
1524
|
+
Checks for the usage of unneeded trailing underscores at the
|
1525
|
+
end of parallel variable assignment.
|
1526
|
+
AllowNamedUnderscoreVariables: true
|
1527
|
+
Enabled: true
|
1528
|
+
|
1529
|
+
Style/TrailingWhitespace:
|
1530
|
+
Description: 'Avoid trailing whitespace.'
|
1531
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-whitespace'
|
1532
|
+
Enabled: true
|
1533
|
+
|
1534
|
+
# TrivialAccessors requires exact name matches and doesn't allow
|
1535
|
+
# predicated methods by default.
|
1536
|
+
Style/TrivialAccessors:
|
1537
|
+
Description: 'Prefer attr_* methods to trivial readers/writers.'
|
1538
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#attr_family'
|
1539
|
+
Enabled: true
|
1540
|
+
# When set to false the cop will suggest the use of accessor methods
|
1541
|
+
# in situations like:
|
1542
|
+
#
|
1543
|
+
# def name
|
1544
|
+
# @other_name
|
1545
|
+
# end
|
1546
|
+
#
|
1547
|
+
# This way you can uncover "hidden" attributes in your code.
|
1548
|
+
ExactNameMatch: true
|
1549
|
+
AllowPredicates: false
|
1550
|
+
# Allows trivial writers that don't end in an equal sign. e.g.
|
1551
|
+
#
|
1552
|
+
# def on_exception(action)
|
1553
|
+
# @on_exception=action
|
1554
|
+
# end
|
1555
|
+
# on_exception :restart
|
1556
|
+
#
|
1557
|
+
# Commonly used in DSLs
|
1558
|
+
AllowDSLWriters: false
|
1559
|
+
IgnoreClassMethods: false
|
1560
|
+
Whitelist:
|
1561
|
+
- to_ary
|
1562
|
+
- to_a
|
1563
|
+
- to_c
|
1564
|
+
- to_enum
|
1565
|
+
- to_h
|
1566
|
+
- to_hash
|
1567
|
+
- to_i
|
1568
|
+
- to_int
|
1569
|
+
- to_io
|
1570
|
+
- to_open
|
1571
|
+
- to_path
|
1572
|
+
- to_proc
|
1573
|
+
- to_r
|
1574
|
+
- to_regexp
|
1575
|
+
- to_str
|
1576
|
+
- to_s
|
1577
|
+
- to_sym
|
1578
|
+
|
1579
|
+
Style/UnlessElse:
|
1580
|
+
Description: >-
|
1581
|
+
Do not use unless with else. Rewrite these with the positive
|
1582
|
+
case first.
|
1583
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-else-with-unless'
|
1584
|
+
Enabled: true
|
1585
|
+
|
1586
|
+
Style/UnneededCapitalW:
|
1587
|
+
Description: 'Checks for %W when interpolation is not needed.'
|
1588
|
+
Enabled: true
|
1589
|
+
|
1590
|
+
Style/UnneededInterpolation:
|
1591
|
+
Description: 'Checks for strings that are just an interpolated expression.'
|
1592
|
+
Enabled: true
|
1593
|
+
|
1594
|
+
Style/UnneededPercentQ:
|
1595
|
+
Description: 'Checks for %q/%Q when single quotes or double quotes would do.'
|
1596
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#percent-q'
|
1597
|
+
Enabled: true
|
1598
|
+
|
1599
|
+
Style/VariableName:
|
1600
|
+
Description: 'Use the configured style when naming variables.'
|
1601
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#snake-case-symbols-methods-vars'
|
1602
|
+
Enabled: true
|
1603
|
+
EnforcedStyle: snake_case
|
1604
|
+
SupportedStyles:
|
1605
|
+
- snake_case
|
1606
|
+
- camelCase
|
1607
|
+
|
1608
|
+
Style/VariableInterpolation:
|
1609
|
+
Description: >-
|
1610
|
+
Don't interpolate global, instance and class variables
|
1611
|
+
directly in strings.
|
1612
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#curlies-interpolate'
|
1613
|
+
Enabled: true
|
1614
|
+
|
1615
|
+
Style/WhenThen:
|
1616
|
+
Description: 'Use when x then ... for one-line cases.'
|
1617
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#one-line-cases'
|
1618
|
+
Enabled: true
|
1619
|
+
|
1620
|
+
Style/WhileUntilDo:
|
1621
|
+
Description: 'Checks for redundant do after while or until.'
|
1622
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-multiline-while-do'
|
1623
|
+
Enabled: true
|
1624
|
+
|
1625
|
+
Style/WhileUntilModifier:
|
1626
|
+
Description: >-
|
1627
|
+
Favor modifier while/until usage when you have a
|
1628
|
+
single-line body.
|
1629
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#while-as-a-modifier'
|
1630
|
+
Enabled: true
|
1631
|
+
MaxLineLength: 80
|
1632
|
+
|
1633
|
+
Style/WordArray:
|
1634
|
+
Description: 'Use %w or %W for arrays of words.'
|
1635
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#percent-w'
|
1636
|
+
Enabled: true
|
1637
|
+
EnforcedStyle: percent
|
1638
|
+
SupportedStyles:
|
1639
|
+
- percent
|
1640
|
+
- brackets
|
1641
|
+
MinSize: 0
|
1642
|
+
# The regular expression WordRegex decides what is considered a word.
|
1643
|
+
WordRegex: !ruby/regexp '/\A[\p{Word}\n\t]+\z/'
|
1644
|
+
|
1645
|
+
##################### Metrics ##################################
|
1646
|
+
|
1647
|
+
Metrics/AbcSize:
|
1648
|
+
Description: >-
|
1649
|
+
A calculated magnitude based on number of assignments,
|
1650
|
+
branches, and conditions.
|
1651
|
+
Reference: 'http://c2.com/cgi/wiki?AbcMetric'
|
1652
|
+
Enabled: true
|
1653
|
+
# The ABC size is a calculated magnitude, so this number can be a Fixnum or
|
1654
|
+
# a Float.
|
1655
|
+
Exclude:
|
1656
|
+
- "db/migrate/*.rb"
|
1657
|
+
Max: 25
|
1658
|
+
|
1659
|
+
Metrics/BlockNesting:
|
1660
|
+
Description: 'Avoid excessive block nesting'
|
1661
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#three-is-the-number-thou-shalt-count'
|
1662
|
+
Enabled: true
|
1663
|
+
Max: 3
|
1664
|
+
|
1665
|
+
Metrics/ClassLength:
|
1666
|
+
Description: 'Avoid classes longer than 100 lines of code.'
|
1667
|
+
Enabled: true
|
1668
|
+
CountComments: false # count full line comments?
|
1669
|
+
Max: 100
|
1670
|
+
|
1671
|
+
Metrics/ModuleLength:
|
1672
|
+
Description: 'Avoid modules longer than 100 lines of code.'
|
1673
|
+
Enabled: true
|
1674
|
+
CountComments: false # count full line comments?
|
1675
|
+
Max: 100
|
1676
|
+
|
1677
|
+
# Avoid complex methods.
|
1678
|
+
Metrics/CyclomaticComplexity:
|
1679
|
+
Description: >-
|
1680
|
+
A complexity metric that is strongly correlated to the number
|
1681
|
+
of test cases needed to validate a method.
|
1682
|
+
Enabled: true
|
1683
|
+
Max: 6
|
1684
|
+
|
1685
|
+
Metrics/LineLength:
|
1686
|
+
Description: 'Limit lines to 80 characters.'
|
1687
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#80-character-limits'
|
1688
|
+
Enabled: false
|
1689
|
+
# To make it possible to copy or click on URIs in the code, we allow lines
|
1690
|
+
# contaning a URI to be longer than Max.
|
1691
|
+
AllowHeredoc: true
|
1692
|
+
AllowURI: true
|
1693
|
+
URISchemes:
|
1694
|
+
- http
|
1695
|
+
- https
|
1696
|
+
|
1697
|
+
Metrics/MethodLength:
|
1698
|
+
Description: 'Avoid methods longer than 10 lines of code.'
|
1699
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#short-methods'
|
1700
|
+
Enabled: true
|
1701
|
+
CountComments: false # count full line comments?
|
1702
|
+
Max: 20
|
1703
|
+
|
1704
|
+
Metrics/ParameterLists:
|
1705
|
+
Description: 'Avoid parameter lists longer than three or four parameters.'
|
1706
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#too-many-params'
|
1707
|
+
Enabled: true
|
1708
|
+
Max: 5
|
1709
|
+
CountKeywordArgs: true
|
1710
|
+
|
1711
|
+
Metrics/PerceivedComplexity:
|
1712
|
+
Description: >-
|
1713
|
+
A complexity metric geared towards measuring complexity for a
|
1714
|
+
human reader.
|
1715
|
+
Enabled: true
|
1716
|
+
Max: 7
|
1717
|
+
|
1718
|
+
##################### Lint ##################################
|
1719
|
+
|
1720
|
+
Lint/AmbiguousOperator:
|
1721
|
+
Description: >-
|
1722
|
+
Checks for ambiguous operators in the first argument of a
|
1723
|
+
method invocation without parentheses.
|
1724
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#parens-as-args'
|
1725
|
+
Enabled: true
|
1726
|
+
|
1727
|
+
Lint/AmbiguousRegexpLiteral:
|
1728
|
+
Description: >-
|
1729
|
+
Checks for ambiguous regexp literals in the first argument of
|
1730
|
+
a method invocation without parentheses.
|
1731
|
+
Enabled: true
|
1732
|
+
|
1733
|
+
# Allow safe assignment in conditions.
|
1734
|
+
Lint/AssignmentInCondition:
|
1735
|
+
Description: "Don't use assignment in conditions."
|
1736
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#safe-assignment-in-condition'
|
1737
|
+
Enabled: true
|
1738
|
+
AllowSafeAssignment: true
|
1739
|
+
|
1740
|
+
Lint/BlockAlignment:
|
1741
|
+
Description: 'Align block ends correctly.'
|
1742
|
+
Enabled: true
|
1743
|
+
|
1744
|
+
Lint/CircularArgumentReference:
|
1745
|
+
Description: "Default values in optional keyword arguments and optional ordinal arguments should not refer back to the name of the argument."
|
1746
|
+
Enabled: true
|
1747
|
+
|
1748
|
+
Lint/ConditionPosition:
|
1749
|
+
Description: >-
|
1750
|
+
Checks for condition placed in a confusing position relative to
|
1751
|
+
the keyword.
|
1752
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#same-line-condition'
|
1753
|
+
Enabled: true
|
1754
|
+
|
1755
|
+
Lint/Debugger:
|
1756
|
+
Description: 'Check for debugger calls.'
|
1757
|
+
Enabled: true
|
1758
|
+
|
1759
|
+
Lint/DefEndAlignment:
|
1760
|
+
Description: 'Align ends corresponding to defs correctly.'
|
1761
|
+
Enabled: true
|
1762
|
+
# The value `def` means that `end` should be aligned with the def keyword.
|
1763
|
+
# The value `start_of_line` means that `end` should be aligned with method
|
1764
|
+
# calls like `private`, `public`, etc, if present in front of the `def`
|
1765
|
+
# keyword on the same line.
|
1766
|
+
AlignWith: start_of_line
|
1767
|
+
SupportedStyles:
|
1768
|
+
- start_of_line
|
1769
|
+
- def
|
1770
|
+
AutoCorrect: false
|
1771
|
+
|
1772
|
+
Lint/DeprecatedClassMethods:
|
1773
|
+
Description: 'Check for deprecated class method calls.'
|
1774
|
+
Enabled: true
|
1775
|
+
|
1776
|
+
Lint/DuplicateMethods:
|
1777
|
+
Description: 'Check for duplicate method definitions.'
|
1778
|
+
Enabled: true
|
1779
|
+
|
1780
|
+
Lint/DuplicatedKey:
|
1781
|
+
Description: 'Check for duplicate keys in hash literals.'
|
1782
|
+
Enabled: true
|
1783
|
+
|
1784
|
+
# Align ends correctly.
|
1785
|
+
Lint/EndAlignment:
|
1786
|
+
# The value `keyword` means that `end` should be aligned with the matching
|
1787
|
+
# keyword (if, while, etc.).
|
1788
|
+
# The value `variable` means that in assignments, `end` should be aligned
|
1789
|
+
# with the start of the variable on the left hand side of `=`. In all other
|
1790
|
+
# situations, `end` should still be aligned with the keyword.
|
1791
|
+
# The value `start_of_line` means that `end` should be aligned with the start
|
1792
|
+
# of the line which the matching keyword appears on.
|
1793
|
+
Description: 'Align ends correctly.'
|
1794
|
+
Enabled: true
|
1795
|
+
AlignWith: keyword
|
1796
|
+
SupportedStyles:
|
1797
|
+
- keyword
|
1798
|
+
- variable
|
1799
|
+
- start_of_line
|
1800
|
+
AutoCorrect: false
|
1801
|
+
|
1802
|
+
Lint/EachWithObjectArgument:
|
1803
|
+
Description: 'Check for immutable argument given to each_with_object.'
|
1804
|
+
Enabled: true
|
1805
|
+
|
1806
|
+
Lint/ElseLayout:
|
1807
|
+
Description: 'Check for odd code arrangement in an else block.'
|
1808
|
+
Enabled: true
|
1809
|
+
|
1810
|
+
Lint/EmptyEnsure:
|
1811
|
+
Description: 'Checks for empty ensure block.'
|
1812
|
+
Enabled: true
|
1813
|
+
|
1814
|
+
Lint/EmptyInterpolation:
|
1815
|
+
Description: 'Checks for empty string interpolation.'
|
1816
|
+
Enabled: true
|
1817
|
+
|
1818
|
+
Lint/EndInMethod:
|
1819
|
+
Description: 'END blocks should not be placed inside method definitions.'
|
1820
|
+
Enabled: true
|
1821
|
+
|
1822
|
+
Lint/EnsureReturn:
|
1823
|
+
Description: 'Do not use return in an ensure block.'
|
1824
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-return-ensure'
|
1825
|
+
Enabled: true
|
1826
|
+
|
1827
|
+
Lint/Eval:
|
1828
|
+
Description: 'The use of eval represents a serious security risk.'
|
1829
|
+
Enabled: true
|
1830
|
+
|
1831
|
+
Lint/FloatOutOfRange:
|
1832
|
+
Description: >-
|
1833
|
+
Catches floating-point literals too large or small for Ruby to
|
1834
|
+
represent.
|
1835
|
+
Enabled: true
|
1836
|
+
|
1837
|
+
Lint/FormatParameterMismatch:
|
1838
|
+
Description: 'The number of parameters to format/sprint must match the fields.'
|
1839
|
+
Enabled: true
|
1840
|
+
|
1841
|
+
Lint/HandleExceptions:
|
1842
|
+
Description: "Don't suppress exception."
|
1843
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#dont-hide-exceptions'
|
1844
|
+
Enabled: true
|
1845
|
+
|
1846
|
+
Lint/ImplicitStringConcatenation:
|
1847
|
+
Description: >-
|
1848
|
+
Checks for adjacent string literals on the same line, which
|
1849
|
+
could better be represented as a single string literal.
|
1850
|
+
Enabled: true
|
1851
|
+
|
1852
|
+
Lint/IneffectiveAccessModifier:
|
1853
|
+
Description: >-
|
1854
|
+
Checks for attempts to use `private` or `protected` to set
|
1855
|
+
the visibility of a class method, which does not work.
|
1856
|
+
Enabled: true
|
1857
|
+
|
1858
|
+
Lint/InvalidCharacterLiteral:
|
1859
|
+
Description: >-
|
1860
|
+
Checks for invalid character literals with a non-escaped
|
1861
|
+
whitespace character.
|
1862
|
+
Enabled: true
|
1863
|
+
|
1864
|
+
Lint/LiteralInCondition:
|
1865
|
+
Description: 'Checks of literals used in conditions.'
|
1866
|
+
Enabled: true
|
1867
|
+
|
1868
|
+
Lint/LiteralInInterpolation:
|
1869
|
+
Description: 'Checks for literals used in interpolation.'
|
1870
|
+
Enabled: true
|
1871
|
+
Description: 'Avoid interpolating literals in strings'
|
1872
|
+
AutoCorrect: false
|
1873
|
+
|
1874
|
+
Lint/Loop:
|
1875
|
+
Description: >-
|
1876
|
+
Use Kernel#loop with break rather than begin/end/until or
|
1877
|
+
begin/end/while for post-loop tests.
|
1878
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#loop-with-break'
|
1879
|
+
Enabled: true
|
1880
|
+
|
1881
|
+
Lint/NestedMethodDefinition:
|
1882
|
+
Description: 'Do not use nested method definitions.'
|
1883
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-nested-methods'
|
1884
|
+
Enabled: true
|
1885
|
+
|
1886
|
+
Lint/NextWithoutAccumulator:
|
1887
|
+
Description: >-
|
1888
|
+
Do not omit the accumulator when calling `next`
|
1889
|
+
in a `reduce`/`inject` block.
|
1890
|
+
Enabled: true
|
1891
|
+
|
1892
|
+
Lint/NonLocalExitFromIterator:
|
1893
|
+
Description: 'Do not use return in iterator to cause non-local exit.'
|
1894
|
+
Enabled: true
|
1895
|
+
|
1896
|
+
Lint/ParenthesesAsGroupedExpression:
|
1897
|
+
Description: >-
|
1898
|
+
Checks for method calls with a space before the opening
|
1899
|
+
parenthesis.
|
1900
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#parens-no-spaces'
|
1901
|
+
Enabled: true
|
1902
|
+
|
1903
|
+
Lint/RandOne:
|
1904
|
+
Description: >-
|
1905
|
+
Checks for `rand(1)` calls. Such calls always return `0`
|
1906
|
+
and most likely a mistake.
|
1907
|
+
Enabled: true
|
1908
|
+
|
1909
|
+
Lint/RequireParentheses:
|
1910
|
+
Description: >-
|
1911
|
+
Use parentheses in the method call to avoid confusion
|
1912
|
+
about precedence.
|
1913
|
+
Enabled: true
|
1914
|
+
|
1915
|
+
Lint/RescueException:
|
1916
|
+
Description: 'Avoid rescuing the Exception class.'
|
1917
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-blind-rescues'
|
1918
|
+
Enabled: true
|
1919
|
+
|
1920
|
+
Lint/ShadowingOuterLocalVariable:
|
1921
|
+
Description: >-
|
1922
|
+
Do not use the same name as outer local variable
|
1923
|
+
for block arguments or block local variables.
|
1924
|
+
Enabled: true
|
1925
|
+
|
1926
|
+
Lint/StringConversionInInterpolation:
|
1927
|
+
Description: 'Checks for Object#to_s usage in string interpolation.'
|
1928
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-to-s'
|
1929
|
+
Enabled: true
|
1930
|
+
|
1931
|
+
Lint/UnderscorePrefixedVariableName:
|
1932
|
+
Description: 'Do not use prefix `_` for a variable that is used.'
|
1933
|
+
Enabled: true
|
1934
|
+
|
1935
|
+
Lint/UnneededDisable:
|
1936
|
+
Description: >-
|
1937
|
+
Checks for rubocop:disable comments that can be removed.
|
1938
|
+
Note: this cop is not disabled when disabling all cops.
|
1939
|
+
It must be explicitly disabled.
|
1940
|
+
Enabled: true
|
1941
|
+
|
1942
|
+
# Checks for unused block arguments
|
1943
|
+
Lint/UnusedBlockArgument:
|
1944
|
+
Description: 'Checks for unused block arguments.'
|
1945
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#underscore-unused-vars'
|
1946
|
+
Enabled: true
|
1947
|
+
IgnoreEmptyBlocks: true
|
1948
|
+
|
1949
|
+
# Checks for unused method arguments.
|
1950
|
+
Lint/UnusedMethodArgument:
|
1951
|
+
Description: 'Checks for unused method arguments.'
|
1952
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#underscore-unused-vars'
|
1953
|
+
Enabled: true
|
1954
|
+
AllowUnusedKeywordArguments: false
|
1955
|
+
IgnoreEmptyMethods: true
|
1956
|
+
|
1957
|
+
Lint/UnreachableCode:
|
1958
|
+
Description: 'Unreachable code.'
|
1959
|
+
Enabled: true
|
1960
|
+
|
1961
|
+
Lint/UselessAccessModifier:
|
1962
|
+
Description: 'Checks for useless access modifiers.'
|
1963
|
+
Enabled: true
|
1964
|
+
|
1965
|
+
Lint/UselessAssignment:
|
1966
|
+
Description: 'Checks for useless assignment to a local variable.'
|
1967
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#underscore-unused-vars'
|
1968
|
+
Enabled: true
|
1969
|
+
|
1970
|
+
Lint/UselessComparison:
|
1971
|
+
Description: 'Checks for comparison of something with itself.'
|
1972
|
+
Enabled: true
|
1973
|
+
|
1974
|
+
Lint/UselessElseWithoutRescue:
|
1975
|
+
Description: 'Checks for useless `else` in `begin..end` without `rescue`.'
|
1976
|
+
Enabled: true
|
1977
|
+
|
1978
|
+
Lint/UselessSetterCall:
|
1979
|
+
Description: 'Checks for useless setter call to a local variable.'
|
1980
|
+
Enabled: true
|
1981
|
+
|
1982
|
+
Lint/Void:
|
1983
|
+
Description: 'Possible use of operator/literal/variable in void context.'
|
1984
|
+
Enabled: true
|
1985
|
+
|
1986
|
+
##################### Rails ##################################
|
1987
|
+
|
1988
|
+
Rails/ActionFilter:
|
1989
|
+
Description: 'Enforces consistent use of action filter methods.'
|
1990
|
+
Enabled: true
|
1991
|
+
EnforcedStyle: action
|
1992
|
+
SupportedStyles:
|
1993
|
+
- action
|
1994
|
+
- filter
|
1995
|
+
Include:
|
1996
|
+
- app/controllers/**/*.rb
|
1997
|
+
|
1998
|
+
Rails/Date:
|
1999
|
+
Description: >-
|
2000
|
+
Checks the correct usage of date aware methods,
|
2001
|
+
such as Date.today, Date.current etc.
|
2002
|
+
Enabled: true
|
2003
|
+
# The value `strict` disallows usage of `Date.today`, `Date.current`,
|
2004
|
+
# `Date#to_time` etc.
|
2005
|
+
# The value `flexible` allows usage of `Date.current`, `Date.yesterday`, etc
|
2006
|
+
# (but not `Date.today`) which are overriden by ActiveSupport to handle current
|
2007
|
+
# time zone.
|
2008
|
+
EnforcedStyle: flexible
|
2009
|
+
SupportedStyles:
|
2010
|
+
- strict
|
2011
|
+
- flexible
|
2012
|
+
|
2013
|
+
Rails/FindBy:
|
2014
|
+
Description: 'Prefer find_by over where.first.'
|
2015
|
+
Enabled: true
|
2016
|
+
Include:
|
2017
|
+
- app/models/**/*.rb
|
2018
|
+
|
2019
|
+
Rails/FindEach:
|
2020
|
+
Description: 'Prefer all.find_each over all.find.'
|
2021
|
+
Enabled: true
|
2022
|
+
Include:
|
2023
|
+
- app/models/**/*.rb
|
2024
|
+
|
2025
|
+
Rails/HasAndBelongsToMany:
|
2026
|
+
Description: 'Prefer has_many :through to has_and_belongs_to_many.'
|
2027
|
+
Enabled: true
|
2028
|
+
Include:
|
2029
|
+
- app/models/**/*.rb
|
2030
|
+
|
2031
|
+
Rails/Output:
|
2032
|
+
Description: 'Checks for calls to puts, print, etc.'
|
2033
|
+
Enabled: true
|
2034
|
+
Include:
|
2035
|
+
- app/**/*.rb
|
2036
|
+
- config/**/*.rb
|
2037
|
+
- db/**/*.rb
|
2038
|
+
- lib/**/*.rb
|
2039
|
+
|
2040
|
+
Rails/ReadWriteAttribute:
|
2041
|
+
Description: >-
|
2042
|
+
Checks for read_attribute(:attr) and
|
2043
|
+
write_attribute(:attr, val).
|
2044
|
+
Enabled: true
|
2045
|
+
Include:
|
2046
|
+
- app/models/**/*.rb
|
2047
|
+
|
2048
|
+
Rails/ScopeArgs:
|
2049
|
+
Description: 'Checks the arguments of ActiveRecord scopes.'
|
2050
|
+
Enabled: true
|
2051
|
+
Include:
|
2052
|
+
- app/models/**/*.rb
|
2053
|
+
|
2054
|
+
Rails/TimeZone:
|
2055
|
+
Description: 'Checks the correct usage of time zone aware methods.'
|
2056
|
+
StyleGuide: 'https://github.com/bbatsov/rails-style-guide#time'
|
2057
|
+
Reference: 'http://danilenko.org/2012/7/6/rails_timezones'
|
2058
|
+
Enabled: true
|
2059
|
+
# The value `strict` means that `Time` should be used with `zone`.
|
2060
|
+
# The value `flexible` allows usage of `in_time_zone` instead of `zone`.
|
2061
|
+
EnforcedStyle: flexible
|
2062
|
+
SupportedStyles:
|
2063
|
+
- strict
|
2064
|
+
- flexible
|
2065
|
+
|
2066
|
+
Rails/Validation:
|
2067
|
+
Description: 'Use validates :attribute, hash of validations.'
|
2068
|
+
Enabled: true
|
2069
|
+
Include:
|
2070
|
+
- app/models/**/*.rb
|
2071
|
+
|
2072
|
+
|
2073
|
+
# These are all the cops that are disabled in the default configuration.
|
2074
|
+
|
2075
|
+
# By default, the rails cops are not run. Override in project or home
|
2076
|
+
# directory .rubocop.yml files, or by giving the -R/--rails option.
|
2077
|
+
Rails:
|
2078
|
+
Enabled: false
|
2079
|
+
|
2080
|
+
Style/AutoResourceCleanup:
|
2081
|
+
Description: 'Suggests the usage of an auto resource cleanup version of a method (if available).'
|
2082
|
+
Enabled: false
|
2083
|
+
|
2084
|
+
Style/Documentation:
|
2085
|
+
Description: 'Document classes and non-namespace modules.'
|
2086
|
+
Enabled: false
|
2087
|
+
Exclude:
|
2088
|
+
- 'spec/**/*'
|
2089
|
+
- 'test/**/*'
|
2090
|
+
|
2091
|
+
Style/FirstArrayElementLineBreak:
|
2092
|
+
Description: >-
|
2093
|
+
Checks for a line break before the first element in a
|
2094
|
+
multi-line array.
|
2095
|
+
Enabled: false
|
2096
|
+
|
2097
|
+
Style/FirstHashElementLineBreak:
|
2098
|
+
Description: >-
|
2099
|
+
Checks for a line break before the first element in a
|
2100
|
+
multi-line hash.
|
2101
|
+
Enabled: false
|
2102
|
+
|
2103
|
+
Style/FirstMethodArgumentLineBreak:
|
2104
|
+
Description: >-
|
2105
|
+
Checks for a line break before the first argument in a
|
2106
|
+
multi-line method call.
|
2107
|
+
Enabled: false
|
2108
|
+
|
2109
|
+
Style/FirstMethodParameterLineBreak:
|
2110
|
+
Description: >-
|
2111
|
+
Checks for a line break before the first parameter in a
|
2112
|
+
multi-line method parameter definition.
|
2113
|
+
Enabled: false
|
2114
|
+
|
2115
|
+
Style/InlineComment:
|
2116
|
+
Description: 'Avoid inline comments.'
|
2117
|
+
Enabled: false
|
2118
|
+
|
2119
|
+
Style/MethodCalledOnDoEndBlock:
|
2120
|
+
Description: 'Avoid chaining a method call on a do...end block.'
|
2121
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#single-line-blocks'
|
2122
|
+
Enabled: false
|
2123
|
+
|
2124
|
+
Style/MissingElse:
|
2125
|
+
Description: >-
|
2126
|
+
Require if/case expressions to have an else branches.
|
2127
|
+
If enabled, it is recommended that
|
2128
|
+
Style/UnlessElse and Style/EmptyElse be enabled.
|
2129
|
+
This will conflict with Style/EmptyElse if
|
2130
|
+
Style/EmptyElse is configured to style "both"
|
2131
|
+
Enabled: false
|
2132
|
+
EnforcedStyle: both
|
2133
|
+
SupportedStyles:
|
2134
|
+
# if - warn when an if expression is missing an else branch
|
2135
|
+
# case - warn when a case expression is missing an else branch
|
2136
|
+
# both - warn when an if or case expression is missing an else branch
|
2137
|
+
- if
|
2138
|
+
- case
|
2139
|
+
- both
|
2140
|
+
|
2141
|
+
Style/MultilineArrayBraceLayout:
|
2142
|
+
Description: >-
|
2143
|
+
Checks that the closing brace in an array literal is
|
2144
|
+
symmetrical with respect to the opening brace and the
|
2145
|
+
array elements.
|
2146
|
+
Enabled: false
|
2147
|
+
|
2148
|
+
Style/Send:
|
2149
|
+
Description: 'Prefer `Object#__send__` or `Object#public_send` to `send`, as `send` may overlap with existing methods.'
|
2150
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#prefer-public-send'
|
2151
|
+
Enabled: false
|
2152
|
+
|
2153
|
+
Style/SpaceInsideBrackets:
|
2154
|
+
Description: 'No spaces after [ or before ].'
|
2155
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-spaces-braces'
|
2156
|
+
Enabled: false
|
2157
|
+
|
2158
|
+
Style/SpaceInsideParens:
|
2159
|
+
Description: 'No spaces after ( or before ).'
|
2160
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-spaces-braces'
|
2161
|
+
Enabled: false
|
2162
|
+
|
2163
|
+
##################### Performance #############################
|
2164
|
+
|
2165
|
+
Performance/Casecmp:
|
2166
|
+
Description: 'Use `casecmp` rather than `downcase ==`.'
|
2167
|
+
Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringcasecmp-vs-stringdowncase---code'
|
2168
|
+
Enabled: true
|
2169
|
+
|
2170
|
+
Performance/CaseWhenSplat:
|
2171
|
+
Description: >-
|
2172
|
+
Place `when` conditions that use splat at the end
|
2173
|
+
of the list of `when` branches.
|
2174
|
+
Enabled: true
|
2175
|
+
|
2176
|
+
Performance/Count:
|
2177
|
+
Description: >-
|
2178
|
+
Use `count` instead of `select...size`, `reject...size`,
|
2179
|
+
`select...count`, `reject...count`, `select...length`,
|
2180
|
+
and `reject...length`.
|
2181
|
+
Enabled: true
|
2182
|
+
|
2183
|
+
Performance/Detect:
|
2184
|
+
Description: >-
|
2185
|
+
Use `detect` instead of `select.first`, `find_all.first`,
|
2186
|
+
`select.last`, and `find_all.last`.
|
2187
|
+
Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerabledetect-vs-enumerableselectfirst-code'
|
2188
|
+
Enabled: true
|
2189
|
+
|
2190
|
+
Performance/DoubleStartEndWith:
|
2191
|
+
Description: >-
|
2192
|
+
Use `str.{start,end}_with?(x, ..., y, ...)`
|
2193
|
+
instead of `str.{start,end}_with?(x, ...) || str.{start,end}_with?(y, ...)`.
|
2194
|
+
Enabled: true
|
2195
|
+
|
2196
|
+
Performance/EndWith:
|
2197
|
+
Description: 'Use `end_with?` instead of a regex match anchored to the end of a string.'
|
2198
|
+
Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringmatch-vs-stringstart_withstringend_with-code-start-code-end'
|
2199
|
+
Enabled: true
|
2200
|
+
|
2201
|
+
Performance/FixedSize:
|
2202
|
+
Description: 'Do not compute the size of statically sized objects except in constants'
|
2203
|
+
Enabled: true
|
2204
|
+
|
2205
|
+
Performance/FlatMap:
|
2206
|
+
Description: >-
|
2207
|
+
Use `Enumerable#flat_map`
|
2208
|
+
instead of `Enumerable#map...Array#flatten(1)`
|
2209
|
+
or `Enumberable#collect..Array#flatten(1)`
|
2210
|
+
Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerablemaparrayflatten-vs-enumerableflat_map-code'
|
2211
|
+
Enabled: true
|
2212
|
+
EnabledForFlattenWithoutParams: false
|
2213
|
+
# If enabled, this cop will warn about usages of
|
2214
|
+
# `flatten` being called without any parameters.
|
2215
|
+
# This can be dangerous since `flat_map` will only flatten 1 level, and
|
2216
|
+
# `flatten` without any parameters can flatten multiple levels.
|
2217
|
+
|
2218
|
+
Performance/HashEachMethods:
|
2219
|
+
Description: >-
|
2220
|
+
Use `Hash#each_key` and `Hash#each_value` instead of
|
2221
|
+
`Hash#keys.each` and `Hash#values.each`.
|
2222
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#hash-each'
|
2223
|
+
Enabled: true
|
2224
|
+
AutoCorrect: false
|
2225
|
+
|
2226
|
+
Performance/LstripRstrip:
|
2227
|
+
Description: 'Use `strip` instead of `lstrip.rstrip`.'
|
2228
|
+
Enabled: true
|
2229
|
+
|
2230
|
+
Performance/RangeInclude:
|
2231
|
+
Description: 'Use `Range#cover?` instead of `Range#include?`.'
|
2232
|
+
Reference: 'https://github.com/JuanitoFatas/fast-ruby#cover-vs-include-code'
|
2233
|
+
Enabled: true
|
2234
|
+
|
2235
|
+
Performance/RedundantBlockCall:
|
2236
|
+
Description: 'Use `yield` instead of `block.call`.'
|
2237
|
+
Reference: 'https://github.com/JuanitoFatas/fast-ruby#proccall-vs-yield-code'
|
2238
|
+
Enabled: true
|
2239
|
+
|
2240
|
+
Performance/RedundantMatch:
|
2241
|
+
Description: >-
|
2242
|
+
Use `=~` instead of `String#match` or `Regexp#match` in a context where the
|
2243
|
+
returned `MatchData` is not needed.
|
2244
|
+
Enabled: true
|
2245
|
+
|
2246
|
+
Performance/RedundantMerge:
|
2247
|
+
Description: 'Use Hash#[]=, rather than Hash#merge! with a single key-value pair.'
|
2248
|
+
Reference: 'https://github.com/JuanitoFatas/fast-ruby#hashmerge-vs-hash-code'
|
2249
|
+
Enabled: true
|
2250
|
+
|
2251
|
+
Performance/RedundantSortBy:
|
2252
|
+
Description: 'Use `sort` instead of `sort_by { |x| x }`.'
|
2253
|
+
Enabled: true
|
2254
|
+
|
2255
|
+
Performance/ReverseEach:
|
2256
|
+
Description: 'Use `reverse_each` instead of `reverse.each`.'
|
2257
|
+
Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerablereverseeach-vs-enumerablereverse_each-code'
|
2258
|
+
Enabled: true
|
2259
|
+
|
2260
|
+
Performance/Sample:
|
2261
|
+
Description: >-
|
2262
|
+
Use `sample` instead of `shuffle.first`,
|
2263
|
+
`shuffle.last`, and `shuffle[Fixnum]`.
|
2264
|
+
Reference: 'https://github.com/JuanitoFatas/fast-ruby#arrayshufflefirst-vs-arraysample-code'
|
2265
|
+
Enabled: true
|
2266
|
+
|
2267
|
+
Performance/Size:
|
2268
|
+
Description: >-
|
2269
|
+
Use `size` instead of `count` for counting
|
2270
|
+
the number of elements in `Array` and `Hash`.
|
2271
|
+
Reference: 'https://github.com/JuanitoFatas/fast-ruby#arraycount-vs-arraysize-code'
|
2272
|
+
Enabled: true
|
2273
|
+
|
2274
|
+
Performance/StartWith:
|
2275
|
+
Description: 'Use `start_with?` instead of a regex match anchored to the beginning of a string.'
|
2276
|
+
Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringmatch-vs-stringstart_withstringend_with-code-start-code-end'
|
2277
|
+
Enabled: true
|
2278
|
+
|
2279
|
+
Performance/StringReplacement:
|
2280
|
+
Description: >-
|
2281
|
+
Use `tr` instead of `gsub` when you are replacing the same
|
2282
|
+
number of characters. Use `delete` instead of `gsub` when
|
2283
|
+
you are deleting characters.
|
2284
|
+
Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringgsub-vs-stringtr-code'
|
2285
|
+
Enabled: true
|
2286
|
+
|
2287
|
+
Performance/TimesMap:
|
2288
|
+
Description: 'Checks for .times.map calls.'
|
2289
|
+
Enabled: true
|
2290
|
+
|
2291
|
+
##################### Rails ##################################
|
2292
|
+
|
2293
|
+
Rails/Delegate:
|
2294
|
+
Description: 'Prefer delegate method for delegations.'
|
2295
|
+
Enabled: true
|
2296
|
+
|
2297
|
+
Rails/PluralizationGrammar:
|
2298
|
+
Description: 'Checks for incorrect grammar when using methods like `3.day.ago`.'
|
2299
|
+
Enabled: true
|