swagger_api 0.1.48 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.codeclimate.yml +10 -5
- data/.gitignore +2 -1
- data/.gitlab-ci.yml +25 -21
- data/.rubocop.yml +1837 -0
- data/Gemfile +16 -4
- data/Gemfile.lock +40 -0
- data/Rakefile +4 -2
- data/lib/swagger_api/actions.rb +11 -11
- data/lib/swagger_api/column_schema.rb +26 -15
- data/lib/swagger_api/component_schema.rb +7 -3
- data/lib/swagger_api/components.rb +10 -4
- data/lib/swagger_api/concerns/columns.rb +14 -3
- data/lib/swagger_api/concerns/sti_schema.rb +6 -4
- data/lib/swagger_api/operations/base.rb +5 -3
- data/lib/swagger_api/operations/create.rb +4 -2
- data/lib/swagger_api/operations/delete.rb +5 -4
- data/lib/swagger_api/operations/index.rb +8 -6
- data/lib/swagger_api/operations/show.rb +3 -1
- data/lib/swagger_api/operations/update.rb +3 -1
- data/lib/swagger_api/paths.rb +31 -5
- data/lib/swagger_api/railtie.rb +11 -4
- data/lib/swagger_api/request_bodies.rb +3 -1
- data/lib/swagger_api/tasks/swagger.rake +2 -1
- data/lib/swagger_api/version.rb +3 -1
- data/lib/swagger_api.rb +36 -22
- data/swagger_api.gemspec +5 -4
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e6c4d74509f25b7abfbb2457fd81a21134aa3280
|
4
|
+
data.tar.gz: 6d524ced52fd2c329761c8733b58f144847e62bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9fee6658a1bfc2821bbc75034fb3403baffff4eceed765dca266dc5c3e47bd1151651f2fa5fcf2f4e3a652a784d3b930dc61fe8efb65a83fd7e78882cd07891c
|
7
|
+
data.tar.gz: 7ec27603f6e6cbaf2d89695a2befb7327d9d8d59202fd2a066e38a16b818f705316488174ab68393a6cc04ff1f6cb459c4484507c944442c028912c768d78314
|
data/.codeclimate.yml
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
---
|
2
|
-
|
2
|
+
version: '2'
|
3
|
+
plugins:
|
3
4
|
rubocop:
|
4
5
|
enabled: true
|
5
6
|
bundler-audit:
|
@@ -14,7 +15,11 @@ engines:
|
|
14
15
|
mass_threshold: 30
|
15
16
|
fixme:
|
16
17
|
enabled: true
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
18
|
+
exclude_patterns:
|
19
|
+
- spec/
|
20
|
+
- bin/
|
21
|
+
- coverage/
|
22
|
+
- .idea/
|
23
|
+
- swagger_api.gemspec
|
24
|
+
- .rubocop.yml
|
25
|
+
- Rakefile
|
data/.gitignore
CHANGED
data/.gitlab-ci.yml
CHANGED
@@ -1,19 +1,33 @@
|
|
1
1
|
stages:
|
2
|
+
- build
|
2
3
|
- test
|
3
4
|
- deploy
|
4
5
|
|
6
|
+
codequality:
|
7
|
+
stage: build
|
8
|
+
image: docker:latest
|
9
|
+
variables:
|
10
|
+
DOCKER_DRIVER: overlay
|
11
|
+
services:
|
12
|
+
- docker:dind
|
13
|
+
script:
|
14
|
+
- docker pull codeclimate/codeclimate
|
15
|
+
- docker run --env CODECLIMATE_CODE="$PWD" --volume "$PWD":/code --volume /var/run/docker.sock:/var/run/docker.sock --volume /tmp/cc:/tmp/cc codeclimate/codeclimate analyze -f json > codeclimate.json || true
|
16
|
+
artifacts:
|
17
|
+
paths: [codeclimate.json]
|
18
|
+
|
5
19
|
rspec:
|
6
|
-
|
7
|
-
image: registry.gitlab.com/fullmeasure/public/docker/rails-mysql-node:latest
|
20
|
+
image: ruby:2.5.1
|
8
21
|
variables:
|
9
|
-
|
10
|
-
|
22
|
+
POSTGRES_USER: runner
|
23
|
+
POSTGRES_PASSWORD: ""
|
11
24
|
RAILS_ENV: test
|
12
25
|
services:
|
13
|
-
|
14
|
-
|
26
|
+
- docker:dind
|
27
|
+
- postgres:alpine
|
15
28
|
before_script:
|
16
29
|
- bundle install --quiet
|
30
|
+
- cd spec/dummy && RAILS_ENV=test bundle exec rake db:create db:schema:load
|
17
31
|
script:
|
18
32
|
- bundle exec rspec
|
19
33
|
artifacts:
|
@@ -22,23 +36,13 @@ rspec:
|
|
22
36
|
expire_in: 1 week
|
23
37
|
paths:
|
24
38
|
- coverage/
|
25
|
-
only:
|
26
|
-
- /^master$/
|
27
39
|
|
28
|
-
codequality:
|
29
|
-
|
30
|
-
image:
|
31
|
-
variables:
|
32
|
-
DOCKER_DRIVER: overlay
|
33
|
-
services:
|
34
|
-
- docker:dind
|
40
|
+
codequality-verify:
|
41
|
+
retry: 2
|
42
|
+
image: ruby:2.5.1
|
35
43
|
script:
|
36
|
-
-
|
37
|
-
-
|
38
|
-
- docker run --env CODECLIMATE_CODE="$PWD" --volume "$PWD":/code --volume /var/run/docker.sock:/var/run/docker.sock --volume /tmp/cc:/tmp/cc codeclimate/codeclimate:0.69.0 analyze -f json > codeclimate.json || true
|
39
|
-
artifacts:
|
40
|
-
paths: [codeclimate.json]
|
41
|
-
|
44
|
+
- ruby -r json -r yaml -e "puts JSON.parse(File.open('codeclimate.json', 'r', &:read)).to_yaml"
|
45
|
+
- "! grep fingerprint codeclimate.json > /dev/null 2>&1"
|
42
46
|
|
43
47
|
release:
|
44
48
|
stage: deploy
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,1837 @@
|
|
1
|
+
# This is the default configuration file. Enabling and disabling is configured
|
2
|
+
# in separate files. This file adds all other parameters apart from Enabled.
|
3
|
+
|
4
|
+
# Common configuration.
|
5
|
+
AllCops:
|
6
|
+
RubyInterpreters:
|
7
|
+
- ruby
|
8
|
+
- macruby
|
9
|
+
- rake
|
10
|
+
- jruby
|
11
|
+
- rbx
|
12
|
+
# Include common Ruby source files.
|
13
|
+
Include:
|
14
|
+
- '**/*.rb'
|
15
|
+
- '**/*.arb'
|
16
|
+
- '**/*.axlsx'
|
17
|
+
- '**/*.builder'
|
18
|
+
- '**/*.fcgi'
|
19
|
+
- '**/*.gemfile'
|
20
|
+
- '**/*.gemspec'
|
21
|
+
- '**/*.god'
|
22
|
+
- '**/*.jb'
|
23
|
+
- '**/*.jbuilder'
|
24
|
+
- '**/*.mspec'
|
25
|
+
- '**/*.opal'
|
26
|
+
- '**/*.pluginspec'
|
27
|
+
- '**/*.podspec'
|
28
|
+
- '**/*.rabl'
|
29
|
+
- '**/*.rake'
|
30
|
+
- '**/*.rbuild'
|
31
|
+
- '**/*.rbw'
|
32
|
+
- '**/*.rbx'
|
33
|
+
- '**/*.ru'
|
34
|
+
- '**/*.ruby'
|
35
|
+
- '**/*.spec'
|
36
|
+
- '**/*.thor'
|
37
|
+
- '**/*.watchr'
|
38
|
+
- '**/.irbrc'
|
39
|
+
- '**/.pryrc'
|
40
|
+
- '**/buildfile'
|
41
|
+
- '**/config.ru'
|
42
|
+
- '**/Appraisals'
|
43
|
+
- '**/Berksfile'
|
44
|
+
- '**/Brewfile'
|
45
|
+
- '**/Buildfile'
|
46
|
+
- '**/Capfile'
|
47
|
+
- '**/Cheffile'
|
48
|
+
- '**/Dangerfile'
|
49
|
+
- '**/Deliverfile'
|
50
|
+
- '**/Fastfile'
|
51
|
+
- '**/*Fastfile'
|
52
|
+
- '**/Gemfile'
|
53
|
+
- '**/Guardfile'
|
54
|
+
- '**/Jarfile'
|
55
|
+
- '**/Mavenfile'
|
56
|
+
- '**/Podfile'
|
57
|
+
- '**/Puppetfile'
|
58
|
+
- '**/Rakefile'
|
59
|
+
- '**/Snapfile'
|
60
|
+
- '**/Thorfile'
|
61
|
+
- '**/Vagabondfile'
|
62
|
+
- '**/Vagrantfile'
|
63
|
+
Exclude:
|
64
|
+
- 'node_modules/**/*'
|
65
|
+
- 'vendor/**/*'
|
66
|
+
- '.git/**/*'
|
67
|
+
# Default formatter will be used if no `-f/--format` option is given.
|
68
|
+
DefaultFormatter: progress
|
69
|
+
# Cop names are displayed in offense messages by default. Change behavior
|
70
|
+
# by overriding DisplayCopNames, or by giving the `--no-display-cop-names`
|
71
|
+
# option.
|
72
|
+
DisplayCopNames: true
|
73
|
+
# Style guide URLs are not displayed in offense messages by default. Change
|
74
|
+
# behavior by overriding `DisplayStyleGuide`, or by giving the
|
75
|
+
# `-S/--display-style-guide` option.
|
76
|
+
DisplayStyleGuide: false
|
77
|
+
# When specifying style guide URLs, any paths and/or fragments will be
|
78
|
+
# evaluated relative to the base URL.
|
79
|
+
StyleGuideBaseURL: https://github.com/rubocop-hq/ruby-style-guide
|
80
|
+
# Extra details are not displayed in offense messages by default. Change
|
81
|
+
# behavior by overriding ExtraDetails, or by giving the
|
82
|
+
# `-E/--extra-details` option.
|
83
|
+
ExtraDetails: false
|
84
|
+
# Additional cops that do not reference a style guide rule may be enabled by
|
85
|
+
# default. Change behavior by overriding `StyleGuideCopsOnly`, or by giving
|
86
|
+
# the `--only-guide-cops` option.
|
87
|
+
StyleGuideCopsOnly: false
|
88
|
+
# All cops except the ones in disabled.yml are enabled by default. Change
|
89
|
+
# this behavior by overriding either `DisabledByDefault` or `EnabledByDefault`.
|
90
|
+
# When `DisabledByDefault` is `true`, all cops in the default configuration
|
91
|
+
# are disabled, and only cops in user configuration are enabled. This makes
|
92
|
+
# cops opt-in instead of opt-out. Note that when `DisabledByDefault` is `true`,
|
93
|
+
# cops in user configuration will be enabled even if they don't set the
|
94
|
+
# Enabled parameter.
|
95
|
+
# When `EnabledByDefault` is `true`, all cops, even those in disabled.yml,
|
96
|
+
# are enabled by default. Cops can still be disabled in user configuration.
|
97
|
+
# Note that it is invalid to set both EnabledByDefault and DisabledByDefault
|
98
|
+
# to true in the same configuration.
|
99
|
+
EnabledByDefault: false
|
100
|
+
DisabledByDefault: false
|
101
|
+
# Enables the result cache if `true`. Can be overridden by the `--cache` command
|
102
|
+
# line option.
|
103
|
+
UseCache: true
|
104
|
+
# Threshold for how many files can be stored in the result cache before some
|
105
|
+
# of the files are automatically removed.
|
106
|
+
MaxFilesInCache: 20000
|
107
|
+
# The cache will be stored in "rubocop_cache" under this directory. If
|
108
|
+
# CacheRootDirectory is ~ (nil), which it is by default, the root will be
|
109
|
+
# taken from the environment variable `$XDG_CACHE_HOME` if it is set, or if
|
110
|
+
# `$XDG_CACHE_HOME` is not set, it will be `$HOME/.cache/`.
|
111
|
+
CacheRootDirectory: ~
|
112
|
+
# It is possible for a malicious user to know the location of RuboCop's cache
|
113
|
+
# directory by looking at CacheRootDirectory, and create a symlink in its
|
114
|
+
# place that could cause RuboCop to overwrite unintended files, or read
|
115
|
+
# malicious input. If you are certain that your cache location is secure from
|
116
|
+
# this kind of attack, and wish to use a symlinked cache location, set this
|
117
|
+
# value to "true".
|
118
|
+
AllowSymlinksInCacheRootDirectory: false
|
119
|
+
# What MRI version of the Ruby interpreter is the inspected code intended to
|
120
|
+
# run on? (If there is more than one, set this to the lowest version.)
|
121
|
+
# If a value is specified for TargetRubyVersion then it is used. Acceptable
|
122
|
+
# values are specificed as a float (i.e. 2.5); the teeny version of Ruby
|
123
|
+
# should not be included. If the project specifies a Ruby version in the
|
124
|
+
# .ruby-version file, Gemfile or gems.rb file, RuboCop will try to determine
|
125
|
+
# the desired version of Ruby by inspecting the .ruby-version file first,
|
126
|
+
# followed by the Gemfile.lock or gems.locked file. (Although the Ruby version
|
127
|
+
# is specified in the Gemfile or gems.rb file, RuboCop reads the final value
|
128
|
+
# from the lock file.) If the Ruby version is still unresolved, RuboCop will
|
129
|
+
# use the oldest officially supported Ruby version (currently Ruby 2.2).
|
130
|
+
TargetRubyVersion: ~
|
131
|
+
# What version of Rails is the inspected code using? If a value is specified
|
132
|
+
# for TargetRailsVersion then it is used. Acceptable values are specificed
|
133
|
+
# as a float (i.e. 5.1); the patch version of Rails should not be included.
|
134
|
+
# If TargetRailsVersion is not set, RuboCop will parse the Gemfile.lock or
|
135
|
+
# gems.locked file to find the version of Rails that has been bound to the
|
136
|
+
# application. If neither of those files exist, RuboCop will use Rails 5.0
|
137
|
+
# as the default.
|
138
|
+
TargetRailsVersion: ~
|
139
|
+
|
140
|
+
#################### Layout ###########################
|
141
|
+
|
142
|
+
# Indent private/protected/public as deep as method definitions
|
143
|
+
Layout/AccessModifierIndentation:
|
144
|
+
EnforcedStyle: indent
|
145
|
+
SupportedStyles:
|
146
|
+
- outdent
|
147
|
+
- indent
|
148
|
+
# By default, the indentation width from Layout/IndentationWidth is used
|
149
|
+
# But it can be overridden by setting this parameter
|
150
|
+
IndentationWidth: ~
|
151
|
+
|
152
|
+
# Align the elements of a hash literal if they span more than one line.
|
153
|
+
Layout/AlignHash:
|
154
|
+
# Alignment of entries using hash rocket as separator. Valid values are:
|
155
|
+
#
|
156
|
+
# key - left alignment of keys
|
157
|
+
# 'a' => 2
|
158
|
+
# 'bb' => 3
|
159
|
+
# separator - alignment of hash rockets, keys are right aligned
|
160
|
+
# 'a' => 2
|
161
|
+
# 'bb' => 3
|
162
|
+
# table - left alignment of keys, hash rockets, and values
|
163
|
+
# 'a' => 2
|
164
|
+
# 'bb' => 3
|
165
|
+
EnforcedHashRocketStyle: key
|
166
|
+
SupportedHashRocketStyles:
|
167
|
+
- key
|
168
|
+
- separator
|
169
|
+
- table
|
170
|
+
# Alignment of entries using colon as separator. Valid values are:
|
171
|
+
#
|
172
|
+
# key - left alignment of keys
|
173
|
+
# a: 0
|
174
|
+
# bb: 1
|
175
|
+
# separator - alignment of colons, keys are right aligned
|
176
|
+
# a: 0
|
177
|
+
# bb: 1
|
178
|
+
# table - left alignment of keys and values
|
179
|
+
# a: 0
|
180
|
+
# bb: 1
|
181
|
+
EnforcedColonStyle: key
|
182
|
+
SupportedColonStyles:
|
183
|
+
- key
|
184
|
+
- separator
|
185
|
+
- table
|
186
|
+
# Select whether hashes that are the last argument in a method call should be
|
187
|
+
# inspected? Valid values are:
|
188
|
+
#
|
189
|
+
# always_inspect - Inspect both implicit and explicit hashes.
|
190
|
+
# Registers an offense for:
|
191
|
+
# function(a: 1,
|
192
|
+
# b: 2)
|
193
|
+
# Registers an offense for:
|
194
|
+
# function({a: 1,
|
195
|
+
# b: 2})
|
196
|
+
# always_ignore - Ignore both implicit and explicit hashes.
|
197
|
+
# Accepts:
|
198
|
+
# function(a: 1,
|
199
|
+
# b: 2)
|
200
|
+
# Accepts:
|
201
|
+
# function({a: 1,
|
202
|
+
# b: 2})
|
203
|
+
# ignore_implicit - Ignore only implicit hashes.
|
204
|
+
# Accepts:
|
205
|
+
# function(a: 1,
|
206
|
+
# b: 2)
|
207
|
+
# Registers an offense for:
|
208
|
+
# function({a: 1,
|
209
|
+
# b: 2})
|
210
|
+
# ignore_explicit - Ignore only explicit hashes.
|
211
|
+
# Accepts:
|
212
|
+
# function({a: 1,
|
213
|
+
# b: 2})
|
214
|
+
# Registers an offense for:
|
215
|
+
# function(a: 1,
|
216
|
+
# b: 2)
|
217
|
+
EnforcedLastArgumentHashStyle: always_inspect
|
218
|
+
SupportedLastArgumentHashStyles:
|
219
|
+
- always_inspect
|
220
|
+
- always_ignore
|
221
|
+
- ignore_implicit
|
222
|
+
- ignore_explicit
|
223
|
+
|
224
|
+
Layout/AlignParameters:
|
225
|
+
# Alignment of parameters in multi-line method calls.
|
226
|
+
#
|
227
|
+
# The `with_first_parameter` style aligns the following lines along the same
|
228
|
+
# column as the first parameter.
|
229
|
+
#
|
230
|
+
# method_call(a,
|
231
|
+
# b)
|
232
|
+
#
|
233
|
+
# The `with_fixed_indentation` style aligns the following lines with one
|
234
|
+
# level of indentation relative to the start of the line with the method call.
|
235
|
+
#
|
236
|
+
# method_call(a,
|
237
|
+
# b)
|
238
|
+
EnforcedStyle: with_first_parameter
|
239
|
+
SupportedStyles:
|
240
|
+
- with_first_parameter
|
241
|
+
- with_fixed_indentation
|
242
|
+
# By default, the indentation width from Layout/IndentationWidth is used
|
243
|
+
# But it can be overridden by setting this parameter
|
244
|
+
IndentationWidth: ~
|
245
|
+
|
246
|
+
# checks whether the end keywords are aligned properly for `do` `end` blocks.
|
247
|
+
Lint/BlockAlignment:
|
248
|
+
# The value `start_of_block` means that the `end` should be aligned with line
|
249
|
+
# where the `do` keyword appears.
|
250
|
+
# The value `start_of_line` means it should be aligned with the whole
|
251
|
+
# expression's starting line.
|
252
|
+
# The value `either` means both are allowed.
|
253
|
+
EnforcedStyleAlignWith: either
|
254
|
+
SupportedStylesAlignWith:
|
255
|
+
- either
|
256
|
+
- start_of_block
|
257
|
+
- start_of_line
|
258
|
+
|
259
|
+
# Indentation of `when`.
|
260
|
+
Layout/CaseIndentation:
|
261
|
+
EnforcedStyle: case
|
262
|
+
SupportedStyles:
|
263
|
+
- case
|
264
|
+
- end
|
265
|
+
IndentOneStep: false
|
266
|
+
# By default, the indentation width from `Layout/IndentationWidth` is used.
|
267
|
+
# But it can be overridden by setting this parameter.
|
268
|
+
# This only matters if `IndentOneStep` is `true`
|
269
|
+
IndentationWidth: ~
|
270
|
+
|
271
|
+
Lint/DefEndAlignment:
|
272
|
+
# The value `def` means that `end` should be aligned with the def keyword.
|
273
|
+
# The value `start_of_line` means that `end` should be aligned with method
|
274
|
+
# calls like `private`, `public`, etc, if present in front of the `def`
|
275
|
+
# keyword on the same line.
|
276
|
+
EnforcedStyleAlignWith: start_of_line
|
277
|
+
SupportedStylesAlignWith:
|
278
|
+
- start_of_line
|
279
|
+
- def
|
280
|
+
AutoCorrect: false
|
281
|
+
Severity: warning
|
282
|
+
|
283
|
+
# Multi-line method chaining should be done with leading dots.
|
284
|
+
Layout/DotPosition:
|
285
|
+
EnforcedStyle: leading
|
286
|
+
SupportedStyles:
|
287
|
+
- leading
|
288
|
+
- trailing
|
289
|
+
|
290
|
+
Layout/EmptyComment:
|
291
|
+
AllowBorderComment: true
|
292
|
+
AllowMarginComment: true
|
293
|
+
|
294
|
+
# Use empty lines between defs.
|
295
|
+
Layout/EmptyLineBetweenDefs:
|
296
|
+
# If `true`, this parameter means that single line method definitions don't
|
297
|
+
# need an empty line between them.
|
298
|
+
AllowAdjacentOneLineDefs: false
|
299
|
+
# Can be array to specify minimum and maximum number of empty lines, e.g. [1, 2]
|
300
|
+
NumberOfEmptyLines: 1
|
301
|
+
|
302
|
+
Layout/EmptyLinesAroundBlockBody:
|
303
|
+
EnforcedStyle: no_empty_lines
|
304
|
+
SupportedStyles:
|
305
|
+
- empty_lines
|
306
|
+
- no_empty_lines
|
307
|
+
|
308
|
+
Layout/EmptyLinesAroundClassBody:
|
309
|
+
EnforcedStyle: no_empty_lines
|
310
|
+
SupportedStyles:
|
311
|
+
- empty_lines
|
312
|
+
- empty_lines_except_namespace
|
313
|
+
- empty_lines_special
|
314
|
+
- no_empty_lines
|
315
|
+
- beginning_only
|
316
|
+
- ending_only
|
317
|
+
|
318
|
+
Layout/EmptyLinesAroundModuleBody:
|
319
|
+
EnforcedStyle: no_empty_lines
|
320
|
+
SupportedStyles:
|
321
|
+
- empty_lines
|
322
|
+
- empty_lines_except_namespace
|
323
|
+
- empty_lines_special
|
324
|
+
- no_empty_lines
|
325
|
+
|
326
|
+
# Align ends correctly.
|
327
|
+
Lint/EndAlignment:
|
328
|
+
# The value `keyword` means that `end` should be aligned with the matching
|
329
|
+
# keyword (`if`, `while`, etc.).
|
330
|
+
# The value `variable` means that in assignments, `end` should be aligned
|
331
|
+
# with the start of the variable on the left hand side of `=`. In all other
|
332
|
+
# situations, `end` should still be aligned with the keyword.
|
333
|
+
# The value `start_of_line` means that `end` should be aligned with the start
|
334
|
+
# of the line which the matching keyword appears on.
|
335
|
+
EnforcedStyleAlignWith: keyword
|
336
|
+
SupportedStylesAlignWith:
|
337
|
+
- keyword
|
338
|
+
- variable
|
339
|
+
- start_of_line
|
340
|
+
AutoCorrect: false
|
341
|
+
Severity: warning
|
342
|
+
|
343
|
+
Layout/EndOfLine:
|
344
|
+
# The `native` style means that CR+LF (Carriage Return + Line Feed) is
|
345
|
+
# enforced on Windows, and LF is enforced on other platforms. The other styles
|
346
|
+
# mean LF and CR+LF, respectively.
|
347
|
+
EnforcedStyle: native
|
348
|
+
SupportedStyles:
|
349
|
+
- native
|
350
|
+
- lf
|
351
|
+
- crlf
|
352
|
+
|
353
|
+
Layout/ExtraSpacing:
|
354
|
+
# When true, allows most uses of extra spacing if the intent is to align
|
355
|
+
# things with the previous or next line, not counting empty lines or comment
|
356
|
+
# lines.
|
357
|
+
AllowForAlignment: true
|
358
|
+
# When true, forces the alignment of `=` in assignments on consecutive lines.
|
359
|
+
ForceEqualSignAlignment: false
|
360
|
+
|
361
|
+
Layout/FirstParameterIndentation:
|
362
|
+
EnforcedStyle: special_for_inner_method_call_in_parentheses
|
363
|
+
SupportedStyles:
|
364
|
+
# The first parameter should always be indented one step more than the
|
365
|
+
# preceding line.
|
366
|
+
- consistent
|
367
|
+
# The first parameter should always be indented one level relative to the
|
368
|
+
# parent that is receiving the parameter
|
369
|
+
- consistent_relative_to_receiver
|
370
|
+
# The first parameter should normally be indented one step more than the
|
371
|
+
# preceding line, but if it's a parameter for a method call that is itself
|
372
|
+
# a parameter in a method call, then the inner parameter should be indented
|
373
|
+
# relative to the inner method.
|
374
|
+
- special_for_inner_method_call
|
375
|
+
# Same as `special_for_inner_method_call` except that the special rule only
|
376
|
+
# applies if the outer method call encloses its arguments in parentheses.
|
377
|
+
- special_for_inner_method_call_in_parentheses
|
378
|
+
# By default, the indentation width from `Layout/IndentationWidth` is used
|
379
|
+
# But it can be overridden by setting this parameter
|
380
|
+
IndentationWidth: ~
|
381
|
+
|
382
|
+
Layout/IndentationConsistency:
|
383
|
+
# The difference between `rails` and `normal` is that the `rails` style
|
384
|
+
# prescribes that in classes and modules the `protected` and `private`
|
385
|
+
# modifier keywords shall be indented the same as public methods and that
|
386
|
+
# protected and private members shall be indented one step more than the
|
387
|
+
# modifiers. Other than that, both styles mean that entities on the same
|
388
|
+
# logical depth shall have the same indentation.
|
389
|
+
EnforcedStyle: normal
|
390
|
+
SupportedStyles:
|
391
|
+
- normal
|
392
|
+
- rails
|
393
|
+
|
394
|
+
Layout/IndentationWidth:
|
395
|
+
# Number of spaces for each indentation level.
|
396
|
+
Width: 2
|
397
|
+
IgnoredPatterns: []
|
398
|
+
|
399
|
+
# Checks the indentation of the first element in an array literal.
|
400
|
+
Layout/IndentArray:
|
401
|
+
# The value `special_inside_parentheses` means that array literals with
|
402
|
+
# brackets that have their opening bracket on the same line as a surrounding
|
403
|
+
# opening round parenthesis, shall have their first element indented relative
|
404
|
+
# to the first position inside the parenthesis.
|
405
|
+
#
|
406
|
+
# The value `consistent` means that the indentation of the first element shall
|
407
|
+
# always be relative to the first position of the line where the opening
|
408
|
+
# bracket is.
|
409
|
+
#
|
410
|
+
# The value `align_brackets` means that the indentation of the first element
|
411
|
+
# shall always be relative to the position of the opening bracket.
|
412
|
+
EnforcedStyle: special_inside_parentheses
|
413
|
+
SupportedStyles:
|
414
|
+
- special_inside_parentheses
|
415
|
+
- consistent
|
416
|
+
- align_brackets
|
417
|
+
# By default, the indentation width from `Layout/IndentationWidth` is used
|
418
|
+
# But it can be overridden by setting this parameter
|
419
|
+
IndentationWidth: ~
|
420
|
+
|
421
|
+
# Checks the indentation of assignment RHS, when on a different line from LHS
|
422
|
+
Layout/IndentAssignment:
|
423
|
+
# By default, the indentation width from `Layout/IndentationWidth` is used
|
424
|
+
# But it can be overridden by setting this parameter
|
425
|
+
IndentationWidth: ~
|
426
|
+
|
427
|
+
# Checks the indentation of the first key in a hash literal.
|
428
|
+
Layout/IndentHash:
|
429
|
+
# The value `special_inside_parentheses` means that hash literals with braces
|
430
|
+
# that have their opening brace on the same line as a surrounding opening
|
431
|
+
# round parenthesis, shall have their first key indented relative to the
|
432
|
+
# first position inside the parenthesis.
|
433
|
+
#
|
434
|
+
# The value `consistent` means that the indentation of the first key shall
|
435
|
+
# always be relative to the first position of the line where the opening
|
436
|
+
# brace is.
|
437
|
+
#
|
438
|
+
# The value `align_braces` means that the indentation of the first key shall
|
439
|
+
# always be relative to the position of the opening brace.
|
440
|
+
EnforcedStyle: special_inside_parentheses
|
441
|
+
SupportedStyles:
|
442
|
+
- special_inside_parentheses
|
443
|
+
- consistent
|
444
|
+
- align_braces
|
445
|
+
# By default, the indentation width from `Layout/IndentationWidth` is used
|
446
|
+
# But it can be overridden by setting this parameter
|
447
|
+
IndentationWidth: ~
|
448
|
+
|
449
|
+
Layout/IndentHeredoc:
|
450
|
+
EnforcedStyle: auto_detection
|
451
|
+
SupportedStyles:
|
452
|
+
- auto_detection
|
453
|
+
- squiggly
|
454
|
+
- active_support
|
455
|
+
- powerpack
|
456
|
+
- unindent
|
457
|
+
|
458
|
+
Layout/SpaceInLambdaLiteral:
|
459
|
+
EnforcedStyle: require_no_space
|
460
|
+
SupportedStyles:
|
461
|
+
- require_no_space
|
462
|
+
- require_space
|
463
|
+
|
464
|
+
Layout/MultilineArrayBraceLayout:
|
465
|
+
EnforcedStyle: symmetrical
|
466
|
+
SupportedStyles:
|
467
|
+
# symmetrical: closing brace is positioned in same way as opening brace
|
468
|
+
# new_line: closing brace is always on a new line
|
469
|
+
# same_line: closing brace is always on the same line as last element
|
470
|
+
- symmetrical
|
471
|
+
- new_line
|
472
|
+
- same_line
|
473
|
+
|
474
|
+
Layout/MultilineAssignmentLayout:
|
475
|
+
# The types of assignments which are subject to this rule.
|
476
|
+
SupportedTypes:
|
477
|
+
- block
|
478
|
+
- case
|
479
|
+
- class
|
480
|
+
- if
|
481
|
+
- kwbegin
|
482
|
+
- module
|
483
|
+
EnforcedStyle: new_line
|
484
|
+
SupportedStyles:
|
485
|
+
# Ensures that the assignment operator and the rhs are on the same line for
|
486
|
+
# the set of supported types.
|
487
|
+
- same_line
|
488
|
+
# Ensures that the assignment operator and the rhs are on separate lines
|
489
|
+
# for the set of supported types.
|
490
|
+
- new_line
|
491
|
+
|
492
|
+
Layout/MultilineHashBraceLayout:
|
493
|
+
EnforcedStyle: symmetrical
|
494
|
+
SupportedStyles:
|
495
|
+
# symmetrical: closing brace is positioned in same way as opening brace
|
496
|
+
# new_line: closing brace is always on a new line
|
497
|
+
# same_line: closing brace is always on same line as last element
|
498
|
+
- symmetrical
|
499
|
+
- new_line
|
500
|
+
- same_line
|
501
|
+
|
502
|
+
Layout/MultilineMethodCallBraceLayout:
|
503
|
+
EnforcedStyle: symmetrical
|
504
|
+
SupportedStyles:
|
505
|
+
# symmetrical: closing brace is positioned in same way as opening brace
|
506
|
+
# new_line: closing brace is always on a new line
|
507
|
+
# same_line: closing brace is always on the same line as last argument
|
508
|
+
- symmetrical
|
509
|
+
- new_line
|
510
|
+
- same_line
|
511
|
+
|
512
|
+
Layout/MultilineMethodCallIndentation:
|
513
|
+
EnforcedStyle: aligned
|
514
|
+
SupportedStyles:
|
515
|
+
- aligned
|
516
|
+
- indented
|
517
|
+
- indented_relative_to_receiver
|
518
|
+
# By default, the indentation width from Layout/IndentationWidth is used
|
519
|
+
# But it can be overridden by setting this parameter
|
520
|
+
IndentationWidth: ~
|
521
|
+
|
522
|
+
Layout/MultilineMethodDefinitionBraceLayout:
|
523
|
+
EnforcedStyle: symmetrical
|
524
|
+
SupportedStyles:
|
525
|
+
# symmetrical: closing brace is positioned in same way as opening brace
|
526
|
+
# new_line: closing brace is always on a new line
|
527
|
+
# same_line: closing brace is always on the same line as last parameter
|
528
|
+
- symmetrical
|
529
|
+
- new_line
|
530
|
+
- same_line
|
531
|
+
|
532
|
+
Layout/MultilineOperationIndentation:
|
533
|
+
EnforcedStyle: aligned
|
534
|
+
SupportedStyles:
|
535
|
+
- aligned
|
536
|
+
- indented
|
537
|
+
# By default, the indentation width from `Layout/IndentationWidth` is used
|
538
|
+
# But it can be overridden by setting this parameter
|
539
|
+
IndentationWidth: ~
|
540
|
+
|
541
|
+
Layout/SpaceAroundBlockParameters:
|
542
|
+
EnforcedStyleInsidePipes: no_space
|
543
|
+
SupportedStylesInsidePipes:
|
544
|
+
- space
|
545
|
+
- no_space
|
546
|
+
|
547
|
+
Layout/SpaceAroundEqualsInParameterDefault:
|
548
|
+
EnforcedStyle: space
|
549
|
+
SupportedStyles:
|
550
|
+
- space
|
551
|
+
- no_space
|
552
|
+
|
553
|
+
Layout/SpaceAroundOperators:
|
554
|
+
# When `true`, allows most uses of extra spacing if the intent is to align
|
555
|
+
# with an operator on the previous or next line, not counting empty lines
|
556
|
+
# or comment lines.
|
557
|
+
AllowForAlignment: true
|
558
|
+
|
559
|
+
Layout/SpaceBeforeBlockBraces:
|
560
|
+
EnforcedStyle: space
|
561
|
+
SupportedStyles:
|
562
|
+
- space
|
563
|
+
- no_space
|
564
|
+
EnforcedStyleForEmptyBraces: space
|
565
|
+
SupportedStylesForEmptyBraces:
|
566
|
+
- space
|
567
|
+
- no_space
|
568
|
+
|
569
|
+
Layout/SpaceBeforeFirstArg:
|
570
|
+
# When `true`, allows most uses of extra spacing if the intent is to align
|
571
|
+
# things with the previous or next line, not counting empty lines or comment
|
572
|
+
# lines.
|
573
|
+
AllowForAlignment: true
|
574
|
+
|
575
|
+
Layout/SpaceInsideArrayLiteralBrackets:
|
576
|
+
EnforcedStyle: no_space
|
577
|
+
SupportedStyles:
|
578
|
+
- space
|
579
|
+
- no_space
|
580
|
+
# 'compact' normally requires a space inside the brackets, with the exception
|
581
|
+
# that successive left brackets or right brackets are collapsed together
|
582
|
+
- compact
|
583
|
+
EnforcedStyleForEmptyBrackets: no_space
|
584
|
+
SupportedStylesForEmptyBrackets:
|
585
|
+
- space
|
586
|
+
- no_space
|
587
|
+
|
588
|
+
Layout/SpaceInsideBlockBraces:
|
589
|
+
EnforcedStyle: space
|
590
|
+
SupportedStyles:
|
591
|
+
- space
|
592
|
+
- no_space
|
593
|
+
EnforcedStyleForEmptyBraces: no_space
|
594
|
+
SupportedStylesForEmptyBraces:
|
595
|
+
- space
|
596
|
+
- no_space
|
597
|
+
# Space between `{` and `|`. Overrides `EnforcedStyle` if there is a conflict.
|
598
|
+
SpaceBeforeBlockParameters: true
|
599
|
+
|
600
|
+
Layout/SpaceInsideHashLiteralBraces:
|
601
|
+
EnforcedStyle: space
|
602
|
+
SupportedStyles:
|
603
|
+
- space
|
604
|
+
- no_space
|
605
|
+
# 'compact' normally requires a space inside hash braces, with the exception
|
606
|
+
# that successive left braces or right braces are collapsed together
|
607
|
+
- compact
|
608
|
+
EnforcedStyleForEmptyBraces: no_space
|
609
|
+
SupportedStylesForEmptyBraces:
|
610
|
+
- space
|
611
|
+
- no_space
|
612
|
+
|
613
|
+
Layout/SpaceInsideParens:
|
614
|
+
EnforcedStyle: no_space
|
615
|
+
SupportedStyles:
|
616
|
+
- space
|
617
|
+
- no_space
|
618
|
+
|
619
|
+
Layout/SpaceInsideReferenceBrackets:
|
620
|
+
EnforcedStyle: no_space
|
621
|
+
SupportedStyles:
|
622
|
+
- space
|
623
|
+
- no_space
|
624
|
+
EnforcedStyleForEmptyBrackets: no_space
|
625
|
+
SupportedStylesForEmptyBrackets:
|
626
|
+
- space
|
627
|
+
- no_space
|
628
|
+
|
629
|
+
Layout/SpaceInsideStringInterpolation:
|
630
|
+
EnforcedStyle: no_space
|
631
|
+
SupportedStyles:
|
632
|
+
- space
|
633
|
+
- no_space
|
634
|
+
|
635
|
+
Layout/ClassStructure:
|
636
|
+
Categories:
|
637
|
+
module_inclusion:
|
638
|
+
- include
|
639
|
+
- prepend
|
640
|
+
- extend
|
641
|
+
ExpectedOrder:
|
642
|
+
- module_inclusion
|
643
|
+
- constants
|
644
|
+
- public_class_methods
|
645
|
+
- initializer
|
646
|
+
- public_methods
|
647
|
+
- protected_methods
|
648
|
+
- private_methods
|
649
|
+
|
650
|
+
Layout/Tab:
|
651
|
+
# By default, the indentation width from Layout/IndentationWidth is used
|
652
|
+
# But it can be overridden by setting this parameter
|
653
|
+
# It is used during auto-correction to determine how many spaces should
|
654
|
+
# replace each tab.
|
655
|
+
IndentationWidth: ~
|
656
|
+
|
657
|
+
Layout/TrailingBlankLines:
|
658
|
+
EnforcedStyle: final_newline
|
659
|
+
SupportedStyles:
|
660
|
+
- final_newline
|
661
|
+
- final_blank_line
|
662
|
+
|
663
|
+
Layout/TrailingWhitespace:
|
664
|
+
AllowInHeredoc: false
|
665
|
+
|
666
|
+
#################### Naming ##########################
|
667
|
+
|
668
|
+
Naming/FileName:
|
669
|
+
# File names listed in `AllCops:Include` are excluded by default. Add extra
|
670
|
+
# excludes here.
|
671
|
+
Exclude: []
|
672
|
+
# When `true`, requires that each source file should define a class or module
|
673
|
+
# with a name which matches the file name (converted to ... case).
|
674
|
+
# It further expects it to be nested inside modules which match the names
|
675
|
+
# of subdirectories in its path.
|
676
|
+
ExpectMatchingDefinition: false
|
677
|
+
# If non-`nil`, expect all source file names to match the following regex.
|
678
|
+
# Only the file name itself is matched, not the entire file path.
|
679
|
+
# Use anchors as necessary if you want to match the entire name rather than
|
680
|
+
# just a part of it.
|
681
|
+
Regex: ~
|
682
|
+
# With `IgnoreExecutableScripts` set to `true`, this cop does not
|
683
|
+
# report offending filenames for executable scripts (i.e. source
|
684
|
+
# files with a shebang in the first line).
|
685
|
+
IgnoreExecutableScripts: true
|
686
|
+
AllowedAcronyms:
|
687
|
+
- CLI
|
688
|
+
- DSL
|
689
|
+
- ACL
|
690
|
+
- API
|
691
|
+
- ASCII
|
692
|
+
- CPU
|
693
|
+
- CSS
|
694
|
+
- DNS
|
695
|
+
- EOF
|
696
|
+
- GUID
|
697
|
+
- HTML
|
698
|
+
- HTTP
|
699
|
+
- HTTPS
|
700
|
+
- ID
|
701
|
+
- IP
|
702
|
+
- JSON
|
703
|
+
- LHS
|
704
|
+
- QPS
|
705
|
+
- RAM
|
706
|
+
- RHS
|
707
|
+
- RPC
|
708
|
+
- SLA
|
709
|
+
- SMTP
|
710
|
+
- SQL
|
711
|
+
- SSH
|
712
|
+
- TCP
|
713
|
+
- TLS
|
714
|
+
- TTL
|
715
|
+
- UDP
|
716
|
+
- UI
|
717
|
+
- UID
|
718
|
+
- UUID
|
719
|
+
- URI
|
720
|
+
- URL
|
721
|
+
- UTF8
|
722
|
+
- VM
|
723
|
+
- XML
|
724
|
+
- XMPP
|
725
|
+
- XSRF
|
726
|
+
- XSS
|
727
|
+
|
728
|
+
Naming/HeredocDelimiterNaming:
|
729
|
+
Blacklist:
|
730
|
+
- !ruby/regexp '/(^|\s)(EO[A-Z]{1}|END)(\s|$)/'
|
731
|
+
|
732
|
+
Naming/HeredocDelimiterCase:
|
733
|
+
EnforcedStyle: uppercase
|
734
|
+
SupportedStyles:
|
735
|
+
- lowercase
|
736
|
+
- uppercase
|
737
|
+
|
738
|
+
Naming/MemoizedInstanceVariableName:
|
739
|
+
EnforcedStyleForLeadingUnderscores: disallowed
|
740
|
+
SupportedStylesForLeadingUnderscores:
|
741
|
+
- disallowed
|
742
|
+
- required
|
743
|
+
- optional
|
744
|
+
|
745
|
+
Naming/MethodName:
|
746
|
+
EnforcedStyle: snake_case
|
747
|
+
SupportedStyles:
|
748
|
+
- snake_case
|
749
|
+
- camelCase
|
750
|
+
|
751
|
+
Naming/PredicateName:
|
752
|
+
# Predicate name prefixes.
|
753
|
+
NamePrefix:
|
754
|
+
- is_
|
755
|
+
- has_
|
756
|
+
- have_
|
757
|
+
# Predicate name prefixes that should be removed.
|
758
|
+
NamePrefixBlacklist:
|
759
|
+
- is_
|
760
|
+
- has_
|
761
|
+
- have_
|
762
|
+
# Predicate names which, despite having a blacklisted prefix, or no `?`,
|
763
|
+
# should still be accepted
|
764
|
+
NameWhitelist:
|
765
|
+
- is_a?
|
766
|
+
# Method definition macros for dynamically generated methods.
|
767
|
+
MethodDefinitionMacros:
|
768
|
+
- define_method
|
769
|
+
- define_singleton_method
|
770
|
+
# Exclude Rspec specs because there is a strong convention to write spec
|
771
|
+
# helpers in the form of `have_something` or `be_something`.
|
772
|
+
Exclude:
|
773
|
+
- 'spec/**/*'
|
774
|
+
|
775
|
+
Naming/UncommunicativeBlockParamName:
|
776
|
+
# Parameter names may be equal to or greater than this value
|
777
|
+
MinNameLength: 1
|
778
|
+
AllowNamesEndingInNumbers: true
|
779
|
+
# Whitelisted names that will not register an offense
|
780
|
+
AllowedNames: []
|
781
|
+
# Blacklisted names that will register an offense
|
782
|
+
ForbiddenNames: []
|
783
|
+
|
784
|
+
Naming/UncommunicativeMethodParamName:
|
785
|
+
# Parameter names may be equal to or greater than this value
|
786
|
+
MinNameLength: 3
|
787
|
+
AllowNamesEndingInNumbers: true
|
788
|
+
# Whitelisted names that will not register an offense
|
789
|
+
AllowedNames:
|
790
|
+
- io
|
791
|
+
- id
|
792
|
+
- to
|
793
|
+
- by
|
794
|
+
- 'on'
|
795
|
+
- in
|
796
|
+
- at
|
797
|
+
# Blacklisted names that will register an offense
|
798
|
+
ForbiddenNames: []
|
799
|
+
|
800
|
+
Naming/VariableName:
|
801
|
+
EnforcedStyle: snake_case
|
802
|
+
SupportedStyles:
|
803
|
+
- snake_case
|
804
|
+
- camelCase
|
805
|
+
|
806
|
+
Naming/VariableNumber:
|
807
|
+
EnforcedStyle: normalcase
|
808
|
+
SupportedStyles:
|
809
|
+
- snake_case
|
810
|
+
- normalcase
|
811
|
+
- non_integer
|
812
|
+
|
813
|
+
#################### Style ###########################
|
814
|
+
|
815
|
+
Style/AccessModifierDeclarations:
|
816
|
+
EnforcedStyle: group
|
817
|
+
SupportedStyles:
|
818
|
+
- inline
|
819
|
+
- group
|
820
|
+
|
821
|
+
Style/Alias:
|
822
|
+
EnforcedStyle: prefer_alias
|
823
|
+
SupportedStyles:
|
824
|
+
- prefer_alias
|
825
|
+
- prefer_alias_method
|
826
|
+
|
827
|
+
Style/AndOr:
|
828
|
+
# Whether `and` and `or` are banned only in conditionals (conditionals)
|
829
|
+
# or completely (always).
|
830
|
+
EnforcedStyle: always
|
831
|
+
SupportedStyles:
|
832
|
+
- always
|
833
|
+
- conditionals
|
834
|
+
|
835
|
+
Style/AsciiComments:
|
836
|
+
AllowedChars: []
|
837
|
+
|
838
|
+
# Checks if usage of `%()` or `%Q()` matches configuration.
|
839
|
+
Style/BarePercentLiterals:
|
840
|
+
EnforcedStyle: bare_percent
|
841
|
+
SupportedStyles:
|
842
|
+
- percent_q
|
843
|
+
- bare_percent
|
844
|
+
|
845
|
+
Style/BlockDelimiters:
|
846
|
+
EnforcedStyle: line_count_based
|
847
|
+
SupportedStyles:
|
848
|
+
# The `line_count_based` style enforces braces around single line blocks and
|
849
|
+
# do..end around multi-line blocks.
|
850
|
+
- line_count_based
|
851
|
+
# The `semantic` style enforces braces around functional blocks, where the
|
852
|
+
# primary purpose of the block is to return a value and do..end for
|
853
|
+
# procedural blocks, where the primary purpose of the block is its
|
854
|
+
# side-effects.
|
855
|
+
#
|
856
|
+
# This looks at the usage of a block's method to determine its type (e.g. is
|
857
|
+
# the result of a `map` assigned to a variable or passed to another
|
858
|
+
# method) but exceptions are permitted in the `ProceduralMethods`,
|
859
|
+
# `FunctionalMethods` and `IgnoredMethods` sections below.
|
860
|
+
- semantic
|
861
|
+
# The `braces_for_chaining` style enforces braces around single line blocks
|
862
|
+
# and do..end around multi-line blocks, except for multi-line blocks whose
|
863
|
+
# return value is being chained with another method (in which case braces
|
864
|
+
# are enforced).
|
865
|
+
- braces_for_chaining
|
866
|
+
ProceduralMethods:
|
867
|
+
# Methods that are known to be procedural in nature but look functional from
|
868
|
+
# their usage, e.g.
|
869
|
+
#
|
870
|
+
# time = Benchmark.realtime do
|
871
|
+
# foo.bar
|
872
|
+
# end
|
873
|
+
#
|
874
|
+
# Here, the return value of the block is discarded but the return value of
|
875
|
+
# `Benchmark.realtime` is used.
|
876
|
+
- benchmark
|
877
|
+
- bm
|
878
|
+
- bmbm
|
879
|
+
- create
|
880
|
+
- each_with_object
|
881
|
+
- measure
|
882
|
+
- new
|
883
|
+
- realtime
|
884
|
+
- tap
|
885
|
+
- with_object
|
886
|
+
FunctionalMethods:
|
887
|
+
# Methods that are known to be functional in nature but look procedural from
|
888
|
+
# their usage, e.g.
|
889
|
+
#
|
890
|
+
# let(:foo) { Foo.new }
|
891
|
+
#
|
892
|
+
# Here, the return value of `Foo.new` is used to define a `foo` helper but
|
893
|
+
# doesn't appear to be used from the return value of `let`.
|
894
|
+
- let
|
895
|
+
- let!
|
896
|
+
- subject
|
897
|
+
- watch
|
898
|
+
IgnoredMethods:
|
899
|
+
# Methods that can be either procedural or functional and cannot be
|
900
|
+
# categorised from their usage alone, e.g.
|
901
|
+
#
|
902
|
+
# foo = lambda do |x|
|
903
|
+
# puts "Hello, #{x}"
|
904
|
+
# end
|
905
|
+
#
|
906
|
+
# foo = lambda do |x|
|
907
|
+
# x * 100
|
908
|
+
# end
|
909
|
+
#
|
910
|
+
# Here, it is impossible to tell from the return value of `lambda` whether
|
911
|
+
# the inner block's return value is significant.
|
912
|
+
- lambda
|
913
|
+
- proc
|
914
|
+
- it
|
915
|
+
|
916
|
+
Style/BracesAroundHashParameters:
|
917
|
+
EnforcedStyle: no_braces
|
918
|
+
SupportedStyles:
|
919
|
+
# The `braces` style enforces braces around all method parameters that are
|
920
|
+
# hashes.
|
921
|
+
- braces
|
922
|
+
# The `no_braces` style checks that the last parameter doesn't have braces
|
923
|
+
# around it.
|
924
|
+
- no_braces
|
925
|
+
# The `context_dependent` style checks that the last parameter doesn't have
|
926
|
+
# braces around it, but requires braces if the second to last parameter is
|
927
|
+
# also a hash literal.
|
928
|
+
- context_dependent
|
929
|
+
|
930
|
+
Style/ClassAndModuleChildren:
|
931
|
+
# Checks the style of children definitions at classes and modules.
|
932
|
+
#
|
933
|
+
# Basically there are two different styles:
|
934
|
+
#
|
935
|
+
# `nested` - have each child on a separate line
|
936
|
+
# class Foo
|
937
|
+
# class Bar
|
938
|
+
# end
|
939
|
+
# end
|
940
|
+
#
|
941
|
+
# `compact` - combine definitions as much as possible
|
942
|
+
# class Foo::Bar
|
943
|
+
# end
|
944
|
+
#
|
945
|
+
# The compact style is only forced, for classes or modules with one child.
|
946
|
+
EnforcedStyle: nested
|
947
|
+
SupportedStyles:
|
948
|
+
- nested
|
949
|
+
- compact
|
950
|
+
|
951
|
+
Style/ClassCheck:
|
952
|
+
EnforcedStyle: is_a?
|
953
|
+
SupportedStyles:
|
954
|
+
- is_a?
|
955
|
+
- kind_of?
|
956
|
+
|
957
|
+
# Align with the style guide.
|
958
|
+
Style/CollectionMethods:
|
959
|
+
# Mapping from undesired method to desired_method
|
960
|
+
# e.g. to use `detect` over `find`:
|
961
|
+
#
|
962
|
+
# CollectionMethods:
|
963
|
+
# PreferredMethods:
|
964
|
+
# find: detect
|
965
|
+
PreferredMethods:
|
966
|
+
collect: 'map'
|
967
|
+
collect!: 'map!'
|
968
|
+
inject: 'reduce'
|
969
|
+
detect: 'find'
|
970
|
+
find_all: 'select'
|
971
|
+
|
972
|
+
# Use '`' or '%x' around command literals.
|
973
|
+
Style/CommandLiteral:
|
974
|
+
EnforcedStyle: backticks
|
975
|
+
# backticks: Always use backticks.
|
976
|
+
# percent_x: Always use `%x`.
|
977
|
+
# mixed: Use backticks on single-line commands, and `%x` on multi-line commands.
|
978
|
+
SupportedStyles:
|
979
|
+
- backticks
|
980
|
+
- percent_x
|
981
|
+
- mixed
|
982
|
+
# If `false`, the cop will always recommend using `%x` if one or more backticks
|
983
|
+
# are found in the command string.
|
984
|
+
AllowInnerBackticks: false
|
985
|
+
|
986
|
+
# Checks formatting of special comments
|
987
|
+
Style/CommentAnnotation:
|
988
|
+
Keywords:
|
989
|
+
- TODO
|
990
|
+
- FIXME
|
991
|
+
- OPTIMIZE
|
992
|
+
- HACK
|
993
|
+
- REVIEW
|
994
|
+
|
995
|
+
Style/ConditionalAssignment:
|
996
|
+
EnforcedStyle: assign_to_condition
|
997
|
+
SupportedStyles:
|
998
|
+
- assign_to_condition
|
999
|
+
- assign_inside_condition
|
1000
|
+
# When configured to `assign_to_condition`, `SingleLineConditionsOnly`
|
1001
|
+
# will only register an offense when all branches of a condition are
|
1002
|
+
# a single line.
|
1003
|
+
# When configured to `assign_inside_condition`, `SingleLineConditionsOnly`
|
1004
|
+
# will only register an offense for assignment to a condition that has
|
1005
|
+
# at least one multiline branch.
|
1006
|
+
SingleLineConditionsOnly: true
|
1007
|
+
IncludeTernaryExpressions: true
|
1008
|
+
|
1009
|
+
# Checks that you have put a copyright in a comment before any code.
|
1010
|
+
#
|
1011
|
+
# You can override the default Notice in your .rubocop.yml file.
|
1012
|
+
#
|
1013
|
+
# In order to use autocorrect, you must supply a value for the
|
1014
|
+
# `AutocorrectNotice` key that matches the regexp Notice. A blank
|
1015
|
+
# `AutocorrectNotice` will cause an error during autocorrect.
|
1016
|
+
#
|
1017
|
+
# Autocorrect will add a copyright notice in a comment at the top
|
1018
|
+
# of the file immediately after any shebang or encoding comments.
|
1019
|
+
#
|
1020
|
+
# Example rubocop.yml:
|
1021
|
+
#
|
1022
|
+
# Style/Copyright:
|
1023
|
+
# Enabled: true
|
1024
|
+
# Notice: 'Copyright (\(c\) )?2015 Yahoo! Inc'
|
1025
|
+
# AutocorrectNotice: '# Copyright (c) 2015 Yahoo! Inc.'
|
1026
|
+
#
|
1027
|
+
Style/Copyright:
|
1028
|
+
Notice: '^Copyright (\(c\) )?2[0-9]{3} .+'
|
1029
|
+
AutocorrectNotice: ''
|
1030
|
+
|
1031
|
+
Style/Documentation:
|
1032
|
+
Enabled: false
|
1033
|
+
|
1034
|
+
# Warn on empty else statements
|
1035
|
+
# empty - warn only on empty `else`
|
1036
|
+
# nil - warn on `else` with nil in it
|
1037
|
+
# both - warn on empty `else` and `else` with `nil` in it
|
1038
|
+
Style/EmptyElse:
|
1039
|
+
EnforcedStyle: both
|
1040
|
+
SupportedStyles:
|
1041
|
+
- empty
|
1042
|
+
- nil
|
1043
|
+
- both
|
1044
|
+
|
1045
|
+
Style/EmptyMethod:
|
1046
|
+
EnforcedStyle: compact
|
1047
|
+
SupportedStyles:
|
1048
|
+
- compact
|
1049
|
+
- expanded
|
1050
|
+
|
1051
|
+
# Checks use of for or each in multiline loops.
|
1052
|
+
Style/For:
|
1053
|
+
EnforcedStyle: each
|
1054
|
+
SupportedStyles:
|
1055
|
+
- each
|
1056
|
+
- for
|
1057
|
+
|
1058
|
+
# Enforce the method used for string formatting.
|
1059
|
+
Style/FormatString:
|
1060
|
+
EnforcedStyle: format
|
1061
|
+
SupportedStyles:
|
1062
|
+
- format
|
1063
|
+
- sprintf
|
1064
|
+
- percent
|
1065
|
+
|
1066
|
+
# Enforce using either `%<token>s` or `%{token}`
|
1067
|
+
Style/FormatStringToken:
|
1068
|
+
EnforcedStyle: annotated
|
1069
|
+
SupportedStyles:
|
1070
|
+
# Prefer tokens which contain a sprintf like type annotation like
|
1071
|
+
# `%<name>s`, `%<age>d`, `%<score>f`
|
1072
|
+
- annotated
|
1073
|
+
# Prefer simple looking "template" style tokens like `%{name}`, `%{age}`
|
1074
|
+
- template
|
1075
|
+
- unannotated
|
1076
|
+
|
1077
|
+
Style/FrozenStringLiteralComment:
|
1078
|
+
EnforcedStyle: when_needed
|
1079
|
+
SupportedStyles:
|
1080
|
+
# `when_needed` will add the frozen string literal comment to files
|
1081
|
+
# only when the `TargetRubyVersion` is set to 2.3+.
|
1082
|
+
- when_needed
|
1083
|
+
# `always` will always add the frozen string literal comment to a file
|
1084
|
+
# regardless of the Ruby version or if `freeze` or `<<` are called on a
|
1085
|
+
# string literal. If you run code against multiple versions of Ruby, it is
|
1086
|
+
# possible that this will create errors in Ruby 2.3.0+.
|
1087
|
+
- always
|
1088
|
+
# `never` will enforce that the frozen string literal comment does not
|
1089
|
+
# exist in a file.
|
1090
|
+
- never
|
1091
|
+
|
1092
|
+
# Built-in global variables are allowed by default.
|
1093
|
+
Style/GlobalVars:
|
1094
|
+
AllowedVariables: []
|
1095
|
+
|
1096
|
+
# `MinBodyLength` defines the number of lines of the a body of an `if` or `unless`
|
1097
|
+
# needs to have to trigger this cop
|
1098
|
+
Style/GuardClause:
|
1099
|
+
MinBodyLength: 1
|
1100
|
+
|
1101
|
+
Style/HashSyntax:
|
1102
|
+
EnforcedStyle: ruby19
|
1103
|
+
SupportedStyles:
|
1104
|
+
# checks for 1.9 syntax (e.g. {a: 1}) for all symbol keys
|
1105
|
+
- ruby19
|
1106
|
+
# checks for hash rocket syntax for all hashes
|
1107
|
+
- hash_rockets
|
1108
|
+
# forbids mixed key syntaxes (e.g. {a: 1, :b => 2})
|
1109
|
+
- no_mixed_keys
|
1110
|
+
# enforces both ruby19 and no_mixed_keys styles
|
1111
|
+
- ruby19_no_mixed_keys
|
1112
|
+
# Force hashes that have a symbol value to use hash rockets
|
1113
|
+
UseHashRocketsWithSymbolValues: false
|
1114
|
+
# Do not suggest { a?: 1 } over { :a? => 1 } in ruby19 style
|
1115
|
+
PreferHashRocketsForNonAlnumEndingSymbols: false
|
1116
|
+
|
1117
|
+
Style/InverseMethods:
|
1118
|
+
# `InverseMethods` are methods that can be inverted by a not (`not` or `!`)
|
1119
|
+
# The relationship of inverse methods only needs to be defined in one direction.
|
1120
|
+
# Keys and values both need to be defined as symbols.
|
1121
|
+
InverseMethods:
|
1122
|
+
:any?: :none?
|
1123
|
+
:even?: :odd?
|
1124
|
+
:==: :!=
|
1125
|
+
:=~: :!~
|
1126
|
+
:<: :>=
|
1127
|
+
:>: :<=
|
1128
|
+
# `ActiveSupport` defines some common inverse methods. They are listed below,
|
1129
|
+
# and not enabled by default.
|
1130
|
+
#:present?: :blank?,
|
1131
|
+
#:include?: :exclude?
|
1132
|
+
# `InverseBlocks` are methods that are inverted by inverting the return
|
1133
|
+
# of the block that is passed to the method
|
1134
|
+
InverseBlocks:
|
1135
|
+
:select: :reject
|
1136
|
+
:select!: :reject!
|
1137
|
+
|
1138
|
+
Style/Lambda:
|
1139
|
+
EnforcedStyle: line_count_dependent
|
1140
|
+
SupportedStyles:
|
1141
|
+
- line_count_dependent
|
1142
|
+
- lambda
|
1143
|
+
- literal
|
1144
|
+
|
1145
|
+
Style/LambdaCall:
|
1146
|
+
EnforcedStyle: call
|
1147
|
+
SupportedStyles:
|
1148
|
+
- call
|
1149
|
+
- braces
|
1150
|
+
|
1151
|
+
Style/MethodCallWithArgsParentheses:
|
1152
|
+
IgnoreMacros: true
|
1153
|
+
IgnoredMethods: []
|
1154
|
+
|
1155
|
+
Style/MethodCallWithoutArgsParentheses:
|
1156
|
+
IgnoredMethods: []
|
1157
|
+
|
1158
|
+
Style/MethodDefParentheses:
|
1159
|
+
EnforcedStyle: require_parentheses
|
1160
|
+
SupportedStyles:
|
1161
|
+
- require_parentheses
|
1162
|
+
- require_no_parentheses
|
1163
|
+
- require_no_parentheses_except_multiline
|
1164
|
+
|
1165
|
+
Style/MissingElse:
|
1166
|
+
EnforcedStyle: both
|
1167
|
+
SupportedStyles:
|
1168
|
+
# if - warn when an if expression is missing an else branch
|
1169
|
+
# case - warn when a case expression is missing an else branch
|
1170
|
+
# both - warn when an if or case expression is missing an else branch
|
1171
|
+
- if
|
1172
|
+
- case
|
1173
|
+
- both
|
1174
|
+
|
1175
|
+
# Checks the grouping of mixins (`include`, `extend`, `prepend`) in `class` and
|
1176
|
+
# `module` bodies.
|
1177
|
+
Style/MixinGrouping:
|
1178
|
+
EnforcedStyle: separated
|
1179
|
+
SupportedStyles:
|
1180
|
+
# separated: each mixed in module goes in a separate statement.
|
1181
|
+
# grouped: mixed in modules are grouped into a single statement.
|
1182
|
+
- separated
|
1183
|
+
- grouped
|
1184
|
+
|
1185
|
+
Style/ModuleFunction:
|
1186
|
+
EnforcedStyle: module_function
|
1187
|
+
SupportedStyles:
|
1188
|
+
- module_function
|
1189
|
+
- extend_self
|
1190
|
+
|
1191
|
+
Style/MultilineMemoization:
|
1192
|
+
EnforcedStyle: keyword
|
1193
|
+
SupportedStyles:
|
1194
|
+
- keyword
|
1195
|
+
- braces
|
1196
|
+
|
1197
|
+
Style/NegatedIf:
|
1198
|
+
EnforcedStyle: both
|
1199
|
+
SupportedStyles:
|
1200
|
+
# both: prefix and postfix negated `if` should both use `unless`
|
1201
|
+
# prefix: only use `unless` for negated `if` statements positioned before the body of the statement
|
1202
|
+
# postfix: only use `unless` for negated `if` statements positioned after the body of the statement
|
1203
|
+
- both
|
1204
|
+
- prefix
|
1205
|
+
- postfix
|
1206
|
+
|
1207
|
+
Style/NestedParenthesizedCalls:
|
1208
|
+
Whitelist:
|
1209
|
+
- be
|
1210
|
+
- be_a
|
1211
|
+
- be_an
|
1212
|
+
- be_between
|
1213
|
+
- be_falsey
|
1214
|
+
- be_kind_of
|
1215
|
+
- be_instance_of
|
1216
|
+
- be_truthy
|
1217
|
+
- be_within
|
1218
|
+
- eq
|
1219
|
+
- eql
|
1220
|
+
- end_with
|
1221
|
+
- include
|
1222
|
+
- match
|
1223
|
+
- raise_error
|
1224
|
+
- respond_to
|
1225
|
+
- start_with
|
1226
|
+
|
1227
|
+
Style/Next:
|
1228
|
+
# With `always` all conditions at the end of an iteration needs to be
|
1229
|
+
# replaced by next - with `skip_modifier_ifs` the modifier if like this one
|
1230
|
+
# are ignored: [1, 2].each { |a| return 'yes' if a == 1 }
|
1231
|
+
EnforcedStyle: skip_modifier_ifs
|
1232
|
+
# `MinBodyLength` defines the number of lines of the a body of an `if` or `unless`
|
1233
|
+
# needs to have to trigger this cop
|
1234
|
+
MinBodyLength: 3
|
1235
|
+
SupportedStyles:
|
1236
|
+
- skip_modifier_ifs
|
1237
|
+
- always
|
1238
|
+
|
1239
|
+
Style/NonNilCheck:
|
1240
|
+
# With `IncludeSemanticChanges` set to `true`, this cop reports offenses for
|
1241
|
+
# `!x.nil?` and autocorrects that and `x != nil` to solely `x`, which is
|
1242
|
+
# **usually** OK, but might change behavior.
|
1243
|
+
#
|
1244
|
+
# With `IncludeSemanticChanges` set to `false`, this cop does not report
|
1245
|
+
# offenses for `!x.nil?` and does no changes that might change behavior.
|
1246
|
+
IncludeSemanticChanges: false
|
1247
|
+
|
1248
|
+
Style/NumericLiterals:
|
1249
|
+
MinDigits: 5
|
1250
|
+
Strict: false
|
1251
|
+
|
1252
|
+
Style/NumericLiteralPrefix:
|
1253
|
+
EnforcedOctalStyle: zero_with_o
|
1254
|
+
SupportedOctalStyles:
|
1255
|
+
- zero_with_o
|
1256
|
+
- zero_only
|
1257
|
+
|
1258
|
+
Style/NumericPredicate:
|
1259
|
+
EnforcedStyle: predicate
|
1260
|
+
SupportedStyles:
|
1261
|
+
- predicate
|
1262
|
+
- comparison
|
1263
|
+
# Exclude RSpec specs because assertions like `expect(1).to be > 0` cause
|
1264
|
+
# false positives.
|
1265
|
+
Exclude:
|
1266
|
+
- 'spec/**/*'
|
1267
|
+
|
1268
|
+
Style/OptionHash:
|
1269
|
+
# A list of parameter names that will be flagged by this cop.
|
1270
|
+
SuspiciousParamNames:
|
1271
|
+
- options
|
1272
|
+
- opts
|
1273
|
+
- args
|
1274
|
+
- params
|
1275
|
+
- parameters
|
1276
|
+
|
1277
|
+
# Allow safe assignment in conditions.
|
1278
|
+
Style/ParenthesesAroundCondition:
|
1279
|
+
AllowSafeAssignment: true
|
1280
|
+
AllowInMultilineConditions: false
|
1281
|
+
|
1282
|
+
Style/PercentLiteralDelimiters:
|
1283
|
+
# Specify the default preferred delimiter for all types with the 'default' key
|
1284
|
+
# Override individual delimiters (even with default specified) by specifying
|
1285
|
+
# an individual key
|
1286
|
+
PreferredDelimiters:
|
1287
|
+
default: ()
|
1288
|
+
'%i': '[]'
|
1289
|
+
'%I': '[]'
|
1290
|
+
'%r': '{}'
|
1291
|
+
'%w': '[]'
|
1292
|
+
'%W': '[]'
|
1293
|
+
|
1294
|
+
Style/PercentQLiterals:
|
1295
|
+
EnforcedStyle: lower_case_q
|
1296
|
+
SupportedStyles:
|
1297
|
+
- lower_case_q # Use `%q` when possible, `%Q` when necessary
|
1298
|
+
- upper_case_q # Always use `%Q`
|
1299
|
+
|
1300
|
+
Style/PreferredHashMethods:
|
1301
|
+
EnforcedStyle: short
|
1302
|
+
SupportedStyles:
|
1303
|
+
- short
|
1304
|
+
- verbose
|
1305
|
+
|
1306
|
+
Style/RaiseArgs:
|
1307
|
+
EnforcedStyle: exploded
|
1308
|
+
SupportedStyles:
|
1309
|
+
- compact # raise Exception.new(msg)
|
1310
|
+
- exploded # raise Exception, msg
|
1311
|
+
|
1312
|
+
Style/RedundantReturn:
|
1313
|
+
# When `true` allows code like `return x, y`.
|
1314
|
+
AllowMultipleReturnValues: false
|
1315
|
+
|
1316
|
+
# Use `/` or `%r` around regular expressions.
|
1317
|
+
Style/RegexpLiteral:
|
1318
|
+
EnforcedStyle: slashes
|
1319
|
+
# slashes: Always use slashes.
|
1320
|
+
# percent_r: Always use `%r`.
|
1321
|
+
# mixed: Use slashes on single-line regexes, and `%r` on multi-line regexes.
|
1322
|
+
SupportedStyles:
|
1323
|
+
- slashes
|
1324
|
+
- percent_r
|
1325
|
+
- mixed
|
1326
|
+
# If `false`, the cop will always recommend using `%r` if one or more slashes
|
1327
|
+
# are found in the regexp string.
|
1328
|
+
AllowInnerSlashes: false
|
1329
|
+
|
1330
|
+
Style/RescueStandardError:
|
1331
|
+
EnforcedStyle: explicit
|
1332
|
+
# implicit: Do not include the error class, `rescue`
|
1333
|
+
# explicit: Require an error class `rescue StandardError`
|
1334
|
+
SupportedStyles:
|
1335
|
+
- implicit
|
1336
|
+
- explicit
|
1337
|
+
|
1338
|
+
Style/ReturnNil:
|
1339
|
+
EnforcedStyle: return
|
1340
|
+
SupportedStyles:
|
1341
|
+
- return
|
1342
|
+
- return_nil
|
1343
|
+
|
1344
|
+
Style/SafeNavigation:
|
1345
|
+
# Safe navigation may cause a statement to start returning `nil` in addition
|
1346
|
+
# to whatever it used to return.
|
1347
|
+
ConvertCodeThatCanStartToReturnNil: false
|
1348
|
+
Whitelist:
|
1349
|
+
- present?
|
1350
|
+
- blank?
|
1351
|
+
- presence
|
1352
|
+
- try
|
1353
|
+
- try!
|
1354
|
+
|
1355
|
+
Style/Semicolon:
|
1356
|
+
# Allow `;` to separate several expressions on the same line.
|
1357
|
+
AllowAsExpressionSeparator: false
|
1358
|
+
|
1359
|
+
Style/SignalException:
|
1360
|
+
EnforcedStyle: only_raise
|
1361
|
+
SupportedStyles:
|
1362
|
+
- only_raise
|
1363
|
+
- only_fail
|
1364
|
+
- semantic
|
1365
|
+
|
1366
|
+
Style/SingleLineBlockParams:
|
1367
|
+
Methods:
|
1368
|
+
- reduce:
|
1369
|
+
- acc
|
1370
|
+
- elem
|
1371
|
+
- inject:
|
1372
|
+
- acc
|
1373
|
+
- elem
|
1374
|
+
|
1375
|
+
Style/SingleLineMethods:
|
1376
|
+
AllowIfMethodIsEmpty: true
|
1377
|
+
|
1378
|
+
Style/SpecialGlobalVars:
|
1379
|
+
EnforcedStyle: use_english_names
|
1380
|
+
SupportedStyles:
|
1381
|
+
- use_perl_names
|
1382
|
+
- use_english_names
|
1383
|
+
|
1384
|
+
Style/StabbyLambdaParentheses:
|
1385
|
+
EnforcedStyle: require_parentheses
|
1386
|
+
SupportedStyles:
|
1387
|
+
- require_parentheses
|
1388
|
+
- require_no_parentheses
|
1389
|
+
|
1390
|
+
Style/StringLiterals:
|
1391
|
+
EnforcedStyle: single_quotes
|
1392
|
+
SupportedStyles:
|
1393
|
+
- single_quotes
|
1394
|
+
- double_quotes
|
1395
|
+
# If `true`, strings which span multiple lines using `\` for continuation must
|
1396
|
+
# use the same type of quotes on each line.
|
1397
|
+
ConsistentQuotesInMultiline: false
|
1398
|
+
|
1399
|
+
Style/StringLiteralsInInterpolation:
|
1400
|
+
EnforcedStyle: single_quotes
|
1401
|
+
SupportedStyles:
|
1402
|
+
- single_quotes
|
1403
|
+
- double_quotes
|
1404
|
+
|
1405
|
+
Style/StringMethods:
|
1406
|
+
# Mapping from undesired method to desired_method
|
1407
|
+
# e.g. to use `to_sym` over `intern`:
|
1408
|
+
#
|
1409
|
+
# StringMethods:
|
1410
|
+
# PreferredMethods:
|
1411
|
+
# intern: to_sym
|
1412
|
+
PreferredMethods:
|
1413
|
+
intern: to_sym
|
1414
|
+
|
1415
|
+
Style/SymbolArray:
|
1416
|
+
EnforcedStyle: percent
|
1417
|
+
MinSize: 2
|
1418
|
+
SupportedStyles:
|
1419
|
+
- percent
|
1420
|
+
- brackets
|
1421
|
+
|
1422
|
+
Style/SymbolProc:
|
1423
|
+
# A list of method names to be ignored by the check.
|
1424
|
+
# The names should be fairly unique, otherwise you'll end up ignoring lots of code.
|
1425
|
+
IgnoredMethods:
|
1426
|
+
- respond_to
|
1427
|
+
- define_method
|
1428
|
+
|
1429
|
+
Style/TernaryParentheses:
|
1430
|
+
EnforcedStyle: require_no_parentheses
|
1431
|
+
SupportedStyles:
|
1432
|
+
- require_parentheses
|
1433
|
+
- require_no_parentheses
|
1434
|
+
- require_parentheses_when_complex
|
1435
|
+
AllowSafeAssignment: true
|
1436
|
+
|
1437
|
+
Style/TrailingCommaInArguments:
|
1438
|
+
# If `comma`, the cop requires a comma after the last argument, but only for
|
1439
|
+
# parenthesized method calls where each argument is on its own line.
|
1440
|
+
# If `consistent_comma`, the cop requires a comma after the last argument,
|
1441
|
+
# for all parenthesized method calls with arguments.
|
1442
|
+
EnforcedStyleForMultiline: no_comma
|
1443
|
+
SupportedStylesForMultiline:
|
1444
|
+
- comma
|
1445
|
+
- consistent_comma
|
1446
|
+
- no_comma
|
1447
|
+
|
1448
|
+
Style/TrailingCommaInArrayLiteral:
|
1449
|
+
# If `comma`, the cop requires a comma after the last item in an array,
|
1450
|
+
# but only when each item is on its own line.
|
1451
|
+
# If `consistent_comma`, the cop requires a comma after the last item of all
|
1452
|
+
# non-empty array literals.
|
1453
|
+
EnforcedStyleForMultiline: no_comma
|
1454
|
+
SupportedStylesForMultiline:
|
1455
|
+
- comma
|
1456
|
+
- consistent_comma
|
1457
|
+
- no_comma
|
1458
|
+
|
1459
|
+
Style/TrailingCommaInHashLiteral:
|
1460
|
+
# If `comma`, the cop requires a comma after the last item in a hash,
|
1461
|
+
# but only when each item is on its own line.
|
1462
|
+
# If `consistent_comma`, the cop requires a comma after the last item of all
|
1463
|
+
# non-empty hash literals.
|
1464
|
+
EnforcedStyleForMultiline: no_comma
|
1465
|
+
SupportedStylesForMultiline:
|
1466
|
+
- comma
|
1467
|
+
- consistent_comma
|
1468
|
+
- no_comma
|
1469
|
+
|
1470
|
+
# `TrivialAccessors` requires exact name matches and doesn't allow
|
1471
|
+
# predicated methods by default.
|
1472
|
+
Style/TrivialAccessors:
|
1473
|
+
# When set to `false` the cop will suggest the use of accessor methods
|
1474
|
+
# in situations like:
|
1475
|
+
#
|
1476
|
+
# def name
|
1477
|
+
# @other_name
|
1478
|
+
# end
|
1479
|
+
#
|
1480
|
+
# This way you can uncover "hidden" attributes in your code.
|
1481
|
+
ExactNameMatch: true
|
1482
|
+
AllowPredicates: true
|
1483
|
+
# Allows trivial writers that don't end in an equal sign. e.g.
|
1484
|
+
#
|
1485
|
+
# def on_exception(action)
|
1486
|
+
# @on_exception=action
|
1487
|
+
# end
|
1488
|
+
# on_exception :restart
|
1489
|
+
#
|
1490
|
+
# Commonly used in DSLs
|
1491
|
+
AllowDSLWriters: false
|
1492
|
+
IgnoreClassMethods: false
|
1493
|
+
Whitelist:
|
1494
|
+
- to_ary
|
1495
|
+
- to_a
|
1496
|
+
- to_c
|
1497
|
+
- to_enum
|
1498
|
+
- to_h
|
1499
|
+
- to_hash
|
1500
|
+
- to_i
|
1501
|
+
- to_int
|
1502
|
+
- to_io
|
1503
|
+
- to_open
|
1504
|
+
- to_path
|
1505
|
+
- to_proc
|
1506
|
+
- to_r
|
1507
|
+
- to_regexp
|
1508
|
+
- to_str
|
1509
|
+
- to_s
|
1510
|
+
- to_sym
|
1511
|
+
|
1512
|
+
# `WordArray` enforces how array literals of word-like strings should be expressed.
|
1513
|
+
Style/WordArray:
|
1514
|
+
EnforcedStyle: percent
|
1515
|
+
SupportedStyles:
|
1516
|
+
# percent style: %w(word1 word2)
|
1517
|
+
- percent
|
1518
|
+
# bracket style: ['word1', 'word2']
|
1519
|
+
- brackets
|
1520
|
+
# The `MinSize` option causes the `WordArray` rule to be ignored for arrays
|
1521
|
+
# smaller than a certain size. The rule is only applied to arrays
|
1522
|
+
# whose element count is greater than or equal to `MinSize`.
|
1523
|
+
MinSize: 2
|
1524
|
+
# The regular expression `WordRegex` decides what is considered a word.
|
1525
|
+
WordRegex: !ruby/regexp '/\A[\p{Word}\n\t]+\z/'
|
1526
|
+
|
1527
|
+
Style/YodaCondition:
|
1528
|
+
EnforcedStyle: all_comparison_operators
|
1529
|
+
SupportedStyles:
|
1530
|
+
# check all comparison operators
|
1531
|
+
- all_comparison_operators
|
1532
|
+
# check only equality operators: `!=` and `==`
|
1533
|
+
- equality_operators_only
|
1534
|
+
|
1535
|
+
#################### Metrics ###############################
|
1536
|
+
|
1537
|
+
Metrics/AbcSize:
|
1538
|
+
# The ABC size is a calculated magnitude, so this number can be an Integer or
|
1539
|
+
# a Float.
|
1540
|
+
Max: 15
|
1541
|
+
|
1542
|
+
Metrics/BlockLength:
|
1543
|
+
CountComments: false # count full line comments?
|
1544
|
+
Max: 25
|
1545
|
+
ExcludedMethods: []
|
1546
|
+
|
1547
|
+
Metrics/BlockNesting:
|
1548
|
+
CountBlocks: false
|
1549
|
+
Max: 3
|
1550
|
+
|
1551
|
+
Metrics/ClassLength:
|
1552
|
+
CountComments: false # count full line comments?
|
1553
|
+
Max: 150
|
1554
|
+
|
1555
|
+
# Avoid complex methods.
|
1556
|
+
Metrics/CyclomaticComplexity:
|
1557
|
+
Max: 6
|
1558
|
+
|
1559
|
+
Metrics/LineLength:
|
1560
|
+
Enabled: false
|
1561
|
+
|
1562
|
+
Metrics/MethodLength:
|
1563
|
+
Enabled: false
|
1564
|
+
|
1565
|
+
Metrics/ModuleLength:
|
1566
|
+
CountComments: false # count full line comments?
|
1567
|
+
Max: 100
|
1568
|
+
|
1569
|
+
Metrics/ParameterLists:
|
1570
|
+
Max: 5
|
1571
|
+
CountKeywordArgs: true
|
1572
|
+
|
1573
|
+
Metrics/PerceivedComplexity:
|
1574
|
+
Max: 7
|
1575
|
+
|
1576
|
+
#################### Lint ##################################
|
1577
|
+
|
1578
|
+
# Allow safe assignment in conditions.
|
1579
|
+
Lint/AssignmentInCondition:
|
1580
|
+
AllowSafeAssignment: true
|
1581
|
+
|
1582
|
+
Lint/InheritException:
|
1583
|
+
# The default base class in favour of `Exception`.
|
1584
|
+
EnforcedStyle: runtime_error
|
1585
|
+
SupportedStyles:
|
1586
|
+
- runtime_error
|
1587
|
+
- standard_error
|
1588
|
+
|
1589
|
+
Lint/MissingCopEnableDirective:
|
1590
|
+
# Maximum number of consecutive lines the cop can be disabled for.
|
1591
|
+
# 0 allows only single-line disables
|
1592
|
+
# 1 would mean the maximum allowed is the following:
|
1593
|
+
# # rubocop:disable SomeCop
|
1594
|
+
# a = 1
|
1595
|
+
# # rubocop:enable SomeCop
|
1596
|
+
# .inf for any size
|
1597
|
+
MaximumRangeSize: .inf
|
1598
|
+
|
1599
|
+
Lint/SafeNavigationChain:
|
1600
|
+
Whitelist:
|
1601
|
+
- present?
|
1602
|
+
- blank?
|
1603
|
+
- presence
|
1604
|
+
- try
|
1605
|
+
- try!
|
1606
|
+
|
1607
|
+
Lint/SafeNavigationConsistency:
|
1608
|
+
Whitelist:
|
1609
|
+
- present?
|
1610
|
+
- blank?
|
1611
|
+
- presence
|
1612
|
+
- try
|
1613
|
+
- try!
|
1614
|
+
|
1615
|
+
# Checks for shadowed arguments
|
1616
|
+
Lint/ShadowedArgument:
|
1617
|
+
IgnoreImplicitReferences: false
|
1618
|
+
|
1619
|
+
# Checks for unused block arguments
|
1620
|
+
Lint/UnusedBlockArgument:
|
1621
|
+
IgnoreEmptyBlocks: true
|
1622
|
+
AllowUnusedKeywordArguments: false
|
1623
|
+
|
1624
|
+
# Checks for unused method arguments.
|
1625
|
+
Lint/UnusedMethodArgument:
|
1626
|
+
AllowUnusedKeywordArguments: false
|
1627
|
+
IgnoreEmptyMethods: true
|
1628
|
+
|
1629
|
+
Lint/Void:
|
1630
|
+
CheckForMethodsWithNoSideEffects: false
|
1631
|
+
|
1632
|
+
#################### Performance ###########################
|
1633
|
+
|
1634
|
+
Performance/DoubleStartEndWith:
|
1635
|
+
# Used to check for `starts_with?` and `ends_with?`.
|
1636
|
+
# These methods are defined by `ActiveSupport`.
|
1637
|
+
IncludeActiveSupportAliases: false
|
1638
|
+
|
1639
|
+
Performance/RedundantMerge:
|
1640
|
+
# Max number of key-value pairs to consider an offense
|
1641
|
+
MaxKeyValuePairs: 2
|
1642
|
+
|
1643
|
+
#################### Rails #################################
|
1644
|
+
|
1645
|
+
Rails/ActionFilter:
|
1646
|
+
EnforcedStyle: action
|
1647
|
+
SupportedStyles:
|
1648
|
+
- action
|
1649
|
+
- filter
|
1650
|
+
Include:
|
1651
|
+
- app/controllers/**/*.rb
|
1652
|
+
|
1653
|
+
Rails/AssertNot:
|
1654
|
+
Include:
|
1655
|
+
- '**/test/**/*'
|
1656
|
+
|
1657
|
+
Rails/Blank:
|
1658
|
+
# Convert usages of `nil? || empty?` to `blank?`
|
1659
|
+
NilOrEmpty: true
|
1660
|
+
# Convert usages of `!present?` to `blank?`
|
1661
|
+
NotPresent: true
|
1662
|
+
# Convert usages of `unless present?` to `if blank?`
|
1663
|
+
UnlessPresent: true
|
1664
|
+
|
1665
|
+
Rails/BulkChangeTable:
|
1666
|
+
Database: null
|
1667
|
+
SupportedDatabases:
|
1668
|
+
- mysql
|
1669
|
+
- postgresql
|
1670
|
+
Include:
|
1671
|
+
- db/migrate/*.rb
|
1672
|
+
|
1673
|
+
Rails/CreateTableWithTimestamps:
|
1674
|
+
Include:
|
1675
|
+
- db/migrate/*.rb
|
1676
|
+
|
1677
|
+
Rails/Date:
|
1678
|
+
# The value `strict` disallows usage of `Date.today`, `Date.current`,
|
1679
|
+
# `Date#to_time` etc.
|
1680
|
+
# The value `flexible` allows usage of `Date.current`, `Date.yesterday`, etc
|
1681
|
+
# (but not `Date.today`) which are overridden by ActiveSupport to handle current
|
1682
|
+
# time zone.
|
1683
|
+
EnforcedStyle: flexible
|
1684
|
+
SupportedStyles:
|
1685
|
+
- strict
|
1686
|
+
- flexible
|
1687
|
+
|
1688
|
+
Rails/Delegate:
|
1689
|
+
# When set to true, using the target object as a prefix of the
|
1690
|
+
# method name without using the `delegate` method will be a
|
1691
|
+
# violation. When set to false, this case is legal.
|
1692
|
+
EnforceForPrefixed: true
|
1693
|
+
|
1694
|
+
Rails/DynamicFindBy:
|
1695
|
+
Whitelist:
|
1696
|
+
- find_by_sql
|
1697
|
+
|
1698
|
+
Rails/EnumUniqueness:
|
1699
|
+
Include:
|
1700
|
+
- app/models/**/*.rb
|
1701
|
+
|
1702
|
+
Rails/Exit:
|
1703
|
+
Include:
|
1704
|
+
- app/**/*.rb
|
1705
|
+
- config/**/*.rb
|
1706
|
+
- lib/**/*.rb
|
1707
|
+
Exclude:
|
1708
|
+
- lib/**/*.rake
|
1709
|
+
|
1710
|
+
Rails/FilePath:
|
1711
|
+
EnforcedStyle: arguments
|
1712
|
+
SupportedStyles:
|
1713
|
+
- slashes
|
1714
|
+
- arguments
|
1715
|
+
|
1716
|
+
Rails/FindBy:
|
1717
|
+
Include:
|
1718
|
+
- app/models/**/*.rb
|
1719
|
+
|
1720
|
+
Rails/FindEach:
|
1721
|
+
Include:
|
1722
|
+
- app/models/**/*.rb
|
1723
|
+
|
1724
|
+
Rails/HasAndBelongsToMany:
|
1725
|
+
Include:
|
1726
|
+
- app/models/**/*.rb
|
1727
|
+
|
1728
|
+
Rails/HasManyOrHasOneDependent:
|
1729
|
+
Include:
|
1730
|
+
- app/models/**/*.rb
|
1731
|
+
|
1732
|
+
Rails/HttpStatus:
|
1733
|
+
EnforcedStyle: symbolic
|
1734
|
+
SupportedStyles:
|
1735
|
+
- numeric
|
1736
|
+
- symbolic
|
1737
|
+
|
1738
|
+
Rails/InverseOf:
|
1739
|
+
Include:
|
1740
|
+
- app/models/**/*.rb
|
1741
|
+
|
1742
|
+
Rails/LexicallyScopedActionFilter:
|
1743
|
+
Include:
|
1744
|
+
- app/controllers/**/*.rb
|
1745
|
+
|
1746
|
+
Rails/NotNullColumn:
|
1747
|
+
Include:
|
1748
|
+
- db/migrate/*.rb
|
1749
|
+
|
1750
|
+
Rails/Output:
|
1751
|
+
Include:
|
1752
|
+
- app/**/*.rb
|
1753
|
+
- config/**/*.rb
|
1754
|
+
- db/**/*.rb
|
1755
|
+
- lib/**/*.rb
|
1756
|
+
|
1757
|
+
Rails/Present:
|
1758
|
+
# Convert usages of `!nil? && !empty?` to `present?`
|
1759
|
+
NotNilAndNotEmpty: true
|
1760
|
+
# Convert usages of `!blank?` to `present?`
|
1761
|
+
NotBlank: true
|
1762
|
+
# Convert usages of `unless blank?` to `if present?`
|
1763
|
+
UnlessBlank: true
|
1764
|
+
|
1765
|
+
Rails/ReadWriteAttribute:
|
1766
|
+
Include:
|
1767
|
+
- app/models/**/*.rb
|
1768
|
+
|
1769
|
+
Rails/RefuteMethods:
|
1770
|
+
Include:
|
1771
|
+
- '**/test/**/*'
|
1772
|
+
|
1773
|
+
Rails/RequestReferer:
|
1774
|
+
EnforcedStyle: referer
|
1775
|
+
SupportedStyles:
|
1776
|
+
- referer
|
1777
|
+
- referrer
|
1778
|
+
|
1779
|
+
Rails/ReversibleMigration:
|
1780
|
+
Include:
|
1781
|
+
- db/migrate/*.rb
|
1782
|
+
|
1783
|
+
Rails/SafeNavigation:
|
1784
|
+
# This will convert usages of `try` to use safe navigation as well as `try!`.
|
1785
|
+
# `try` and `try!` work slightly differently. `try!` and safe navigation will
|
1786
|
+
# both raise a `NoMethodError` if the receiver of the method call does not
|
1787
|
+
# implement the intended method. `try` will not raise an exception for this.
|
1788
|
+
ConvertTry: false
|
1789
|
+
|
1790
|
+
Rails/ScopeArgs:
|
1791
|
+
Include:
|
1792
|
+
- app/models/**/*.rb
|
1793
|
+
|
1794
|
+
Rails/TimeZone:
|
1795
|
+
# The value `strict` means that `Time` should be used with `zone`.
|
1796
|
+
# The value `flexible` allows usage of `in_time_zone` instead of `zone`.
|
1797
|
+
EnforcedStyle: flexible
|
1798
|
+
SupportedStyles:
|
1799
|
+
- strict
|
1800
|
+
- flexible
|
1801
|
+
|
1802
|
+
Rails/UniqBeforePluck:
|
1803
|
+
EnforcedStyle: conservative
|
1804
|
+
SupportedStyles:
|
1805
|
+
- conservative
|
1806
|
+
- aggressive
|
1807
|
+
AutoCorrect: false
|
1808
|
+
|
1809
|
+
Rails/UnknownEnv:
|
1810
|
+
Environments:
|
1811
|
+
- development
|
1812
|
+
- test
|
1813
|
+
- production
|
1814
|
+
|
1815
|
+
Rails/SkipsModelValidations:
|
1816
|
+
Blacklist:
|
1817
|
+
- decrement!
|
1818
|
+
- decrement_counter
|
1819
|
+
- increment!
|
1820
|
+
- increment_counter
|
1821
|
+
- toggle!
|
1822
|
+
- touch
|
1823
|
+
- update_all
|
1824
|
+
- update_attribute
|
1825
|
+
- update_column
|
1826
|
+
- update_columns
|
1827
|
+
- update_counters
|
1828
|
+
|
1829
|
+
Rails/Validation:
|
1830
|
+
Include:
|
1831
|
+
- app/models/**/*.rb
|
1832
|
+
|
1833
|
+
Bundler/OrderedGems:
|
1834
|
+
TreatCommentsAsGroupSeparators: true
|
1835
|
+
|
1836
|
+
Gemspec/OrderedDependencies:
|
1837
|
+
TreatCommentsAsGroupSeparators: true
|