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