supa 0.2.3 → 0.3.0
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 -11
- data/.reek +128 -0
- data/.rspec +2 -0
- data/.rubocop.yml +1197 -1011
- data/.travis.yml +12 -4
- data/Gemfile +0 -1
- data/README.md +142 -57
- data/Rakefile +3 -11
- data/bin/console +4 -4
- data/lib/supa.rb +9 -1
- data/lib/supa/builder.rb +14 -25
- data/lib/supa/command.rb +25 -28
- data/lib/supa/commands/append.rb +3 -11
- data/lib/supa/commands/attribute.rb +1 -3
- data/lib/supa/commands/collection.rb +26 -6
- data/lib/supa/commands/namespace.rb +2 -6
- data/lib/supa/commands/object.rb +23 -4
- data/lib/supa/commands/virtual.rb +7 -3
- data/lib/supa/representable.rb +1 -1
- data/lib/supa/version.rb +1 -1
- data/supa.gemspec +23 -14
- metadata +73 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8368930840dc4d4f13caeebed1c39874729f171b
|
4
|
+
data.tar.gz: f43ae08a91fc09e14b3e8094c8441402971461a5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7440feb89f238add3e25ea2d0530827ab43bc58c8a23fffb0ae7e38348867d89f5159cadd7d5d29d10e72fdc6cc9fbdbe8863aecf3a5b76be77f5ed73cefa5dd
|
7
|
+
data.tar.gz: fee29a4bb5555ad0653fe08fe5cc1d7a4250b15100c11a8648fee5daf3ad79b748e9c583dce6676953691c73e55d4eeb411e4bdf033e482c58d72b498e3e1dbc
|
data/.codeclimate.yml
CHANGED
@@ -2,22 +2,21 @@
|
|
2
2
|
engines:
|
3
3
|
duplication:
|
4
4
|
enabled: true
|
5
|
-
exclude_fingerprints:
|
6
|
-
- 8fafabb5096a8bf78bd572e945af11c7
|
7
|
-
- ae15dfea2e23ace8e7ac8f970d624a67
|
8
|
-
- 47ba1ed25f6c2341a41c4be35a5575c5
|
9
|
-
- 3bde68650c7c2b328cb49485ce794235
|
10
|
-
- 190256b661c5354e34dc7a770e65da42
|
11
|
-
- 190256b661c5354e34dc7a770e65da42
|
12
5
|
config:
|
13
6
|
languages:
|
14
|
-
|
15
|
-
|
16
|
-
|
7
|
+
ruby:
|
8
|
+
mass_threshold: 30
|
9
|
+
exclude_paths:
|
10
|
+
- spec/
|
17
11
|
rubocop:
|
18
12
|
enabled: true
|
13
|
+
reek:
|
14
|
+
enabled: true
|
15
|
+
exclude_paths:
|
16
|
+
- spec/
|
19
17
|
ratings:
|
20
18
|
paths:
|
19
|
+
- Gemfile.lock
|
21
20
|
- "**.rb"
|
22
21
|
exclude_paths:
|
23
|
-
-
|
22
|
+
- tmp/
|
data/.reek
ADDED
@@ -0,0 +1,128 @@
|
|
1
|
+
---
|
2
|
+
Attribute:
|
3
|
+
enabled: false
|
4
|
+
exclude: []
|
5
|
+
BooleanParameter:
|
6
|
+
enabled: true
|
7
|
+
exclude: []
|
8
|
+
ClassVariable:
|
9
|
+
enabled: true
|
10
|
+
exclude: []
|
11
|
+
ControlParameter:
|
12
|
+
enabled: true
|
13
|
+
exclude: []
|
14
|
+
DataClump:
|
15
|
+
enabled: true
|
16
|
+
exclude: []
|
17
|
+
max_copies: 2
|
18
|
+
min_clump_size: 2
|
19
|
+
DuplicateMethodCall:
|
20
|
+
enabled: false
|
21
|
+
exclude: []
|
22
|
+
max_calls: 1
|
23
|
+
allow_calls: []
|
24
|
+
FeatureEnvy:
|
25
|
+
enabled: true
|
26
|
+
exclude: []
|
27
|
+
InstanceVariableAssumption:
|
28
|
+
enabled: false
|
29
|
+
exclude: []
|
30
|
+
IrresponsibleModule:
|
31
|
+
enabled: false
|
32
|
+
exclude: []
|
33
|
+
LongParameterList:
|
34
|
+
enabled: true
|
35
|
+
exclude: []
|
36
|
+
max_params: 3
|
37
|
+
overrides:
|
38
|
+
initialize:
|
39
|
+
max_params: 5
|
40
|
+
LongYieldList:
|
41
|
+
enabled: true
|
42
|
+
exclude: []
|
43
|
+
max_params: 3
|
44
|
+
ManualDispatch:
|
45
|
+
enabled: true
|
46
|
+
exclude: []
|
47
|
+
ModuleInitialize:
|
48
|
+
enabled: true
|
49
|
+
exclude: []
|
50
|
+
NestedIterators:
|
51
|
+
enabled: true
|
52
|
+
exclude: []
|
53
|
+
max_allowed_nesting: 2
|
54
|
+
ignore_iterators:
|
55
|
+
- tap
|
56
|
+
NilCheck:
|
57
|
+
enabled: true
|
58
|
+
exclude: []
|
59
|
+
PrimaDonnaMethod:
|
60
|
+
enabled: true
|
61
|
+
exclude: []
|
62
|
+
RepeatedConditional:
|
63
|
+
enabled: true
|
64
|
+
exclude: []
|
65
|
+
max_ifs: 2
|
66
|
+
SubclassedFromCoreClass:
|
67
|
+
enabled: true
|
68
|
+
exclude: []
|
69
|
+
TooManyConstants:
|
70
|
+
enabled: true
|
71
|
+
exclude: []
|
72
|
+
max_constants: 10
|
73
|
+
TooManyInstanceVariables:
|
74
|
+
enabled: true
|
75
|
+
exclude: []
|
76
|
+
max_instance_variables: 4
|
77
|
+
TooManyMethods:
|
78
|
+
enabled: true
|
79
|
+
exclude: []
|
80
|
+
max_methods: 15
|
81
|
+
TooManyStatements:
|
82
|
+
enabled: true
|
83
|
+
exclude:
|
84
|
+
- initialize
|
85
|
+
max_statements: 10
|
86
|
+
UncommunicativeMethodName:
|
87
|
+
enabled: true
|
88
|
+
exclude: []
|
89
|
+
reject:
|
90
|
+
- !ruby/regexp /^[a-z]$/
|
91
|
+
- !ruby/regexp /[0-9]$/
|
92
|
+
- !ruby/regexp /[A-Z]/
|
93
|
+
accept: []
|
94
|
+
UncommunicativeModuleName:
|
95
|
+
enabled: true
|
96
|
+
exclude: []
|
97
|
+
reject:
|
98
|
+
- !ruby/regexp /^.$/
|
99
|
+
- !ruby/regexp /[0-9]$/
|
100
|
+
accept: []
|
101
|
+
UncommunicativeParameterName:
|
102
|
+
enabled: true
|
103
|
+
exclude: []
|
104
|
+
reject:
|
105
|
+
- !ruby/regexp /^.$/
|
106
|
+
- !ruby/regexp /[0-9]$/
|
107
|
+
- !ruby/regexp /[A-Z]/
|
108
|
+
- !ruby/regexp /^_/
|
109
|
+
accept: []
|
110
|
+
UncommunicativeVariableName:
|
111
|
+
enabled: true
|
112
|
+
exclude: []
|
113
|
+
reject:
|
114
|
+
- !ruby/regexp /^.$/
|
115
|
+
- !ruby/regexp /[0-9]$/
|
116
|
+
- !ruby/regexp /[A-Z]/
|
117
|
+
accept:
|
118
|
+
- !ruby/regexp /^_$/
|
119
|
+
UnusedParameters:
|
120
|
+
enabled: true
|
121
|
+
exclude: []
|
122
|
+
UnusedPrivateMethod:
|
123
|
+
enabled: false
|
124
|
+
exclude: []
|
125
|
+
UtilityFunction:
|
126
|
+
enabled: true
|
127
|
+
exclude: []
|
128
|
+
public_methods_only: true
|
data/.rspec
ADDED
data/.rubocop.yml
CHANGED
@@ -1,1156 +1,1342 @@
|
|
1
|
+
#########################################################
|
2
|
+
# THIS CONFIGURATION FILE IS GENERATED BY STANDARDS GEM #
|
3
|
+
# https://github.com/distribusion/standards #
|
4
|
+
# #
|
5
|
+
# PLEASE DO NOT MODIFY THIS FILE #
|
6
|
+
#########################################################
|
7
|
+
---
|
1
8
|
AllCops:
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
Description: 'Checks for empty string interpolation.'
|
69
|
-
Enabled: true
|
70
|
-
|
71
|
-
Lint/EndAlignment:
|
72
|
-
Description: 'Align ends correctly.'
|
73
|
-
Enabled: true
|
74
|
-
|
75
|
-
Lint/EndInMethod:
|
76
|
-
Description: 'END blocks should not be placed inside method definitions.'
|
77
|
-
Enabled: true
|
78
|
-
|
79
|
-
Lint/EnsureReturn:
|
80
|
-
Description: 'Do not use return in an ensure block.'
|
81
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-return-ensure'
|
82
|
-
Enabled: true
|
83
|
-
|
84
|
-
Lint/Eval:
|
85
|
-
Description: 'The use of eval represents a serious security risk.'
|
86
|
-
Enabled: true
|
87
|
-
|
88
|
-
Lint/FormatParameterMismatch:
|
89
|
-
Description: 'The number of parameters to format/sprint must match the fields.'
|
90
|
-
Enabled: true
|
91
|
-
|
92
|
-
Lint/HandleExceptions:
|
93
|
-
Description: "Don't suppress exception."
|
94
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#dont-hide-exceptions'
|
95
|
-
Enabled: true
|
96
|
-
|
97
|
-
Lint/InvalidCharacterLiteral:
|
98
|
-
Description: >-
|
99
|
-
Checks for invalid character literals with a non-escaped
|
100
|
-
whitespace character.
|
101
|
-
Enabled: true
|
102
|
-
|
103
|
-
Lint/LiteralInCondition:
|
104
|
-
Description: 'Checks of literals used in conditions.'
|
105
|
-
Enabled: true
|
106
|
-
|
107
|
-
Lint/LiteralInInterpolation:
|
108
|
-
Description: 'Checks for literals used in interpolation.'
|
109
|
-
Enabled: true
|
110
|
-
|
111
|
-
Lint/Loop:
|
112
|
-
Description: >-
|
113
|
-
Use Kernel#loop with break rather than begin/end/until or
|
114
|
-
begin/end/while for post-loop tests.
|
115
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#loop-with-break'
|
116
|
-
Enabled: true
|
117
|
-
|
118
|
-
Lint/NestedMethodDefinition:
|
119
|
-
Description: 'Do not use nested method definitions.'
|
120
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-nested-methods'
|
121
|
-
Enabled: true
|
122
|
-
|
123
|
-
Lint/NonLocalExitFromIterator:
|
124
|
-
Description: 'Do not use return in iterator to cause non-local exit.'
|
125
|
-
Enabled: true
|
126
|
-
|
127
|
-
Lint/ParenthesesAsGroupedExpression:
|
128
|
-
Description: >-
|
129
|
-
Checks for method calls with a space before the opening
|
130
|
-
parenthesis.
|
131
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#parens-no-spaces'
|
132
|
-
Enabled: true
|
133
|
-
|
134
|
-
Lint/RequireParentheses:
|
135
|
-
Description: >-
|
136
|
-
Use parentheses in the method call to avoid confusion
|
137
|
-
about precedence.
|
138
|
-
Enabled: true
|
139
|
-
|
140
|
-
Lint/RescueException:
|
141
|
-
Description: 'Avoid rescuing the Exception class.'
|
142
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-blind-rescues'
|
143
|
-
Enabled: true
|
144
|
-
|
145
|
-
Lint/ShadowingOuterLocalVariable:
|
146
|
-
Description: >-
|
147
|
-
Do not use the same name as outer local variable
|
148
|
-
for block arguments or block local variables.
|
149
|
-
Enabled: true
|
150
|
-
|
151
|
-
Lint/StringConversionInInterpolation:
|
152
|
-
Description: 'Checks for Object#to_s usage in string interpolation.'
|
153
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-to-s'
|
154
|
-
Enabled: true
|
155
|
-
|
156
|
-
Lint/UnderscorePrefixedVariableName:
|
157
|
-
Description: 'Do not use prefix `_` for a variable that is used.'
|
158
|
-
Enabled: true
|
159
|
-
|
160
|
-
Lint/UnneededDisable:
|
161
|
-
Description: >-
|
162
|
-
Checks for rubocop:disable comments that can be removed.
|
163
|
-
Note: this cop is not disabled when disabling all cops.
|
164
|
-
It must be explicitly disabled.
|
165
|
-
Enabled: true
|
166
|
-
|
167
|
-
Lint/UnusedBlockArgument:
|
168
|
-
Description: 'Checks for unused block arguments.'
|
169
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#underscore-unused-vars'
|
170
|
-
Enabled: true
|
171
|
-
|
172
|
-
Lint/UnusedMethodArgument:
|
173
|
-
Description: 'Checks for unused method arguments.'
|
174
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#underscore-unused-vars'
|
175
|
-
Enabled: true
|
176
|
-
|
177
|
-
Lint/UnreachableCode:
|
178
|
-
Description: 'Unreachable code.'
|
179
|
-
Enabled: true
|
180
|
-
|
181
|
-
Lint/UselessAccessModifier:
|
182
|
-
Description: 'Checks for useless access modifiers.'
|
183
|
-
Enabled: true
|
184
|
-
|
185
|
-
Lint/UselessAssignment:
|
186
|
-
Description: 'Checks for useless assignment to a local variable.'
|
187
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#underscore-unused-vars'
|
188
|
-
Enabled: true
|
189
|
-
|
190
|
-
Lint/UselessComparison:
|
191
|
-
Description: 'Checks for comparison of something with itself.'
|
192
|
-
Enabled: true
|
193
|
-
|
194
|
-
Lint/UselessElseWithoutRescue:
|
195
|
-
Description: 'Checks for useless `else` in `begin..end` without `rescue`.'
|
196
|
-
Enabled: true
|
197
|
-
|
198
|
-
Lint/UselessSetterCall:
|
199
|
-
Description: 'Checks for useless setter call to a local variable.'
|
200
|
-
Enabled: true
|
201
|
-
|
202
|
-
Lint/Void:
|
203
|
-
Description: 'Possible use of operator/literal/variable in void context.'
|
204
|
-
Enabled: true
|
205
|
-
|
206
|
-
###################### Metrics ####################################
|
207
|
-
|
208
|
-
Metrics/AbcSize:
|
209
|
-
Description: >-
|
210
|
-
A calculated magnitude based on number of assignments,
|
211
|
-
branches, and conditions.
|
212
|
-
Reference: 'http://c2.com/cgi/wiki?AbcMetric'
|
213
|
-
Enabled: false
|
214
|
-
Max: 20
|
215
|
-
|
216
|
-
Metrics/BlockNesting:
|
217
|
-
Description: 'Avoid excessive block nesting'
|
218
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#three-is-the-number-thou-shalt-count'
|
219
|
-
Enabled: true
|
220
|
-
Max: 4
|
221
|
-
|
222
|
-
Metrics/ClassLength:
|
223
|
-
Description: 'Avoid classes longer than 250 lines of code.'
|
224
|
-
Enabled: true
|
225
|
-
Max: 250
|
226
|
-
|
227
|
-
Metrics/CyclomaticComplexity:
|
228
|
-
Description: >-
|
229
|
-
A complexity metric that is strongly correlated to the number
|
230
|
-
of test cases needed to validate a method.
|
231
|
-
Enabled: true
|
232
|
-
|
233
|
-
Metrics/LineLength:
|
234
|
-
Description: 'Limit lines to 80 characters.'
|
235
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#80-character-limits'
|
236
|
-
Enabled: false
|
237
|
-
|
238
|
-
Metrics/MethodLength:
|
239
|
-
Description: 'Avoid methods longer than 30 lines of code.'
|
240
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#short-methods'
|
241
|
-
Enabled: true
|
242
|
-
Max: 30
|
243
|
-
|
244
|
-
Metrics/ModuleLength:
|
245
|
-
Description: 'Avoid modules longer than 250 lines of code.'
|
246
|
-
Enabled: true
|
247
|
-
Max: 250
|
248
|
-
|
249
|
-
Metrics/ParameterLists:
|
250
|
-
Description: 'Avoid parameter lists longer than three or four parameters.'
|
251
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#too-many-params'
|
252
|
-
Enabled: true
|
253
|
-
|
254
|
-
Metrics/PerceivedComplexity:
|
255
|
-
Description: >-
|
256
|
-
A complexity metric geared towards measuring complexity for a
|
257
|
-
human reader.
|
258
|
-
Enabled: false
|
259
|
-
|
260
|
-
##################### Performance #############################
|
261
|
-
|
262
|
-
Performance/Count:
|
263
|
-
Description: >-
|
264
|
-
Use `count` instead of `select...size`, `reject...size`,
|
265
|
-
`select...count`, `reject...count`, `select...length`,
|
266
|
-
and `reject...length`.
|
267
|
-
Enabled: true
|
268
|
-
|
269
|
-
Performance/Detect:
|
270
|
-
Description: >-
|
271
|
-
Use `detect` instead of `select.first`, `find_all.first`,
|
272
|
-
`select.last`, and `find_all.last`.
|
273
|
-
Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerabledetect-vs-enumerableselectfirst-code'
|
274
|
-
Enabled: true
|
275
|
-
|
276
|
-
Performance/FlatMap:
|
277
|
-
Description: >-
|
278
|
-
Use `Enumerable#flat_map`
|
279
|
-
instead of `Enumerable#map...Array#flatten(1)`
|
280
|
-
or `Enumberable#collect..Array#flatten(1)`
|
281
|
-
Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerablemaparrayflatten-vs-enumerableflat_map-code'
|
282
|
-
Enabled: true
|
283
|
-
EnabledForFlattenWithoutParams: false
|
284
|
-
# If enabled, this cop will warn about usages of
|
285
|
-
# `flatten` being called without any parameters.
|
286
|
-
# This can be dangerous since `flat_map` will only flatten 1 level, and
|
287
|
-
# `flatten` without any parameters can flatten multiple levels.
|
288
|
-
|
289
|
-
Performance/ReverseEach:
|
290
|
-
Description: 'Use `reverse_each` instead of `reverse.each`.'
|
291
|
-
Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerablereverseeach-vs-enumerablereverse_each-code'
|
292
|
-
Enabled: true
|
293
|
-
|
294
|
-
Performance/Sample:
|
295
|
-
Description: >-
|
296
|
-
Use `sample` instead of `shuffle.first`,
|
297
|
-
`shuffle.last`, and `shuffle[Fixnum]`.
|
298
|
-
Reference: 'https://github.com/JuanitoFatas/fast-ruby#arrayshufflefirst-vs-arraysample-code'
|
299
|
-
Enabled: true
|
300
|
-
|
301
|
-
Performance/Size:
|
302
|
-
Description: >-
|
303
|
-
Use `size` instead of `count` for counting
|
304
|
-
the number of elements in `Array` and `Hash`.
|
305
|
-
Reference: 'https://github.com/JuanitoFatas/fast-ruby#arraycount-vs-arraysize-code'
|
306
|
-
Enabled: true
|
307
|
-
|
308
|
-
Performance/StringReplacement:
|
309
|
-
Description: >-
|
310
|
-
Use `tr` instead of `gsub` when you are replacing the same
|
311
|
-
number of characters. Use `delete` instead of `gsub` when
|
312
|
-
you are deleting characters.
|
313
|
-
Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringgsub-vs-stringtr-code'
|
314
|
-
Enabled: true
|
315
|
-
|
316
|
-
##################### Rails ##################################
|
317
|
-
|
318
|
-
Rails/ActionFilter:
|
319
|
-
Description: 'Enforces consistent use of action filter methods.'
|
320
|
-
Enabled: false
|
321
|
-
|
322
|
-
Rails/Date:
|
323
|
-
Description: >-
|
324
|
-
Checks the correct usage of date aware methods,
|
325
|
-
such as Date.today, Date.current etc.
|
326
|
-
Enabled: false
|
327
|
-
|
328
|
-
Rails/Delegate:
|
329
|
-
Description: 'Prefer delegate method for delegations.'
|
330
|
-
Enabled: false
|
331
|
-
|
332
|
-
Rails/FindBy:
|
333
|
-
Description: 'Prefer find_by over where.first.'
|
334
|
-
Enabled: false
|
335
|
-
|
336
|
-
Rails/FindEach:
|
337
|
-
Description: 'Prefer all.find_each over all.find.'
|
338
|
-
Enabled: false
|
339
|
-
|
340
|
-
Rails/HasAndBelongsToMany:
|
341
|
-
Description: 'Prefer has_many :through to has_and_belongs_to_many.'
|
342
|
-
Enabled: false
|
343
|
-
|
344
|
-
Rails/Output:
|
345
|
-
Description: 'Checks for calls to puts, print, etc.'
|
346
|
-
Enabled: false
|
347
|
-
|
348
|
-
Rails/ReadWriteAttribute:
|
349
|
-
Description: >-
|
350
|
-
Checks for read_attribute(:attr) and
|
351
|
-
write_attribute(:attr, val).
|
352
|
-
Enabled: false
|
353
|
-
|
354
|
-
Rails/ScopeArgs:
|
355
|
-
Description: 'Checks the arguments of ActiveRecord scopes.'
|
356
|
-
Enabled: false
|
357
|
-
|
358
|
-
Rails/TimeZone:
|
359
|
-
Description: 'Checks the correct usage of time zone aware methods.'
|
360
|
-
StyleGuide: 'https://github.com/bbatsov/rails-style-guide#time'
|
361
|
-
Reference: 'http://danilenko.org/2012/7/6/rails_timezones'
|
362
|
-
Enabled: false
|
363
|
-
|
364
|
-
Rails/Validation:
|
365
|
-
Description: 'Use validates :attribute, hash of validations.'
|
366
|
-
Enabled: false
|
367
|
-
|
368
|
-
################## Style #################################
|
369
|
-
|
9
|
+
# Include common Ruby source files.
|
10
|
+
Include:
|
11
|
+
- '**/*.gemspec'
|
12
|
+
- '**/*.rake'
|
13
|
+
- '**/config.ru'
|
14
|
+
- '**/Gemfile'
|
15
|
+
- '**/Rakefile'
|
16
|
+
- '**/Capfile'
|
17
|
+
- '**/Guardfile'
|
18
|
+
Exclude:
|
19
|
+
- 'vendor/**/*'
|
20
|
+
# Default formatter will be used if no -f/--format option is given.
|
21
|
+
DefaultFormatter: progress
|
22
|
+
# Cop names are not displayed in offense messages by default. Change behavior
|
23
|
+
# by overriding DisplayCopNames, or by giving the -D/--display-cop-names
|
24
|
+
# option.
|
25
|
+
DisplayCopNames: false
|
26
|
+
# Style guide URLs are not displayed in offense messages by default. Change
|
27
|
+
# behavior by overriding DisplayStyleGuide, or by giving the
|
28
|
+
# -S/--display-style-guide option.
|
29
|
+
DisplayStyleGuide: false
|
30
|
+
# When specifying style guide URLs, any paths and/or fragments will be
|
31
|
+
# evaluated relative to the base URL.
|
32
|
+
StyleGuideBaseURL: https://github.com/bbatsov/ruby-style-guide
|
33
|
+
# Extra details are not displayed in offense messages by default. Change
|
34
|
+
# behavior by overriding ExtraDetails, or by giving the
|
35
|
+
# -E/--extra-details option.
|
36
|
+
ExtraDetails: false
|
37
|
+
# Additional cops that do not reference a style guide rule may be enabled by
|
38
|
+
# default. Change behavior by overriding StyleGuideCopsOnly, or by giving
|
39
|
+
# the --only-guide-cops option.
|
40
|
+
StyleGuideCopsOnly: false
|
41
|
+
# All cops except the ones in disabled.yml are enabled by default. Change
|
42
|
+
# this behavior by overriding DisabledByDefault. When DisabledByDefault is
|
43
|
+
# true, all cops in the default configuration are disabled, and and only cops
|
44
|
+
# in user configuration are enabled. This makes cops opt-in instead of
|
45
|
+
# opt-out. Note that when DisabledByDefault is true, cops in user
|
46
|
+
# configuration will be enabled even if they don't set the Enabled parameter.
|
47
|
+
DisabledByDefault: false
|
48
|
+
# Enables the result cache if true. Can be overridden by the --cache command
|
49
|
+
# line option.
|
50
|
+
UseCache: true
|
51
|
+
# Threshold for how many files can be stored in the result cache before some
|
52
|
+
# of the files are automatically removed.
|
53
|
+
MaxFilesInCache: 20000
|
54
|
+
# The cache will be stored in "rubocop_cache" under this directory. The name
|
55
|
+
# "/tmp" is special and will be converted to the system temporary directory,
|
56
|
+
# which is "/tmp" on Unix-like systems, but could be something else on other
|
57
|
+
# systems.
|
58
|
+
CacheRootDirectory: /tmp
|
59
|
+
# The default cache root directory is /tmp, which on most systems is
|
60
|
+
# writable by any system user. This means that it is possible for a
|
61
|
+
# malicious user to anticipate the location of Rubocop's cache directory,
|
62
|
+
# and create a symlink in its place that could cause Rubocop to overwrite
|
63
|
+
# unintended files, or read malicious input. If you are certain that your
|
64
|
+
# cache location is secure from this kind of attack, and wish to use a
|
65
|
+
# symlinked cache location, set this value to "true".
|
66
|
+
AllowSymlinksInCacheRootDirectory: false
|
67
|
+
# What MRI version of the Ruby interpreter is the inspected code intended to
|
68
|
+
# run on? (If there is more than one, set this to the lowest version.)
|
69
|
+
# If a value is specified for TargetRubyVersion then it is used.
|
70
|
+
# Else if .ruby-version exists and it contains an MRI version it is used.
|
71
|
+
# Otherwise we fallback to the oldest officially supported Ruby version (2.1).
|
72
|
+
TargetRubyVersion: ~
|
73
|
+
|
74
|
+
# Indent private/protected/public as deep as method definitions
|
370
75
|
Style/AccessModifierIndentation:
|
371
|
-
|
372
|
-
|
373
|
-
|
76
|
+
EnforcedStyle: indent
|
77
|
+
SupportedStyles:
|
78
|
+
- outdent
|
79
|
+
- indent
|
80
|
+
# By default, the indentation width from Style/IndentationWidth is used
|
81
|
+
# But it can be overridden by setting this parameter
|
82
|
+
IndentationWidth: ~
|
374
83
|
|
375
84
|
Style/AccessorMethodName:
|
376
85
|
Description: Check the naming of accessor methods for get_/set_.
|
377
|
-
|
86
|
+
StyleGuide: '#accessor_mutator_method_names'
|
378
87
|
|
379
88
|
Style/Alias:
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
Style/AlignArray:
|
385
|
-
Description: >-
|
386
|
-
Align the elements of an array literal if they span more than
|
387
|
-
one line.
|
388
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#align-multiline-arrays'
|
389
|
-
Enabled: false
|
89
|
+
EnforcedStyle: prefer_alias_method
|
90
|
+
SupportedStyles:
|
91
|
+
- prefer_alias
|
92
|
+
- prefer_alias_method
|
390
93
|
|
94
|
+
# Align the elements of a hash literal if they span more than one line.
|
391
95
|
Style/AlignHash:
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
96
|
+
# Alignment of entries using hash rocket as separator. Valid values are:
|
97
|
+
#
|
98
|
+
# key - left alignment of keys
|
99
|
+
# 'a' => 2
|
100
|
+
# 'bb' => 3
|
101
|
+
# separator - alignment of hash rockets, keys are right aligned
|
102
|
+
# 'a' => 2
|
103
|
+
# 'bb' => 3
|
104
|
+
# table - left alignment of keys, hash rockets, and values
|
105
|
+
# 'a' => 2
|
106
|
+
# 'bb' => 3
|
107
|
+
EnforcedHashRocketStyle: key
|
108
|
+
# Alignment of entries using colon as separator. Valid values are:
|
109
|
+
#
|
110
|
+
# key - left alignment of keys
|
111
|
+
# a: 0
|
112
|
+
# bb: 1
|
113
|
+
# separator - alignment of colons, keys are right aligned
|
114
|
+
# a: 0
|
115
|
+
# bb: 1
|
116
|
+
# table - left alignment of keys and values
|
117
|
+
# a: 0
|
118
|
+
# bb: 1
|
119
|
+
EnforcedColonStyle: key
|
120
|
+
# Select whether hashes that are the last argument in a method call should be
|
121
|
+
# inspected? Valid values are:
|
122
|
+
#
|
123
|
+
# always_inspect - Inspect both implicit and explicit hashes.
|
124
|
+
# Registers an offense for:
|
125
|
+
# function(a: 1,
|
126
|
+
# b: 2)
|
127
|
+
# Registers an offense for:
|
128
|
+
# function({a: 1,
|
129
|
+
# b: 2})
|
130
|
+
# always_ignore - Ignore both implicit and explicit hashes.
|
131
|
+
# Accepts:
|
132
|
+
# function(a: 1,
|
133
|
+
# b: 2)
|
134
|
+
# Accepts:
|
135
|
+
# function({a: 1,
|
136
|
+
# b: 2})
|
137
|
+
# ignore_implicit - Ignore only implicit hashes.
|
138
|
+
# Accepts:
|
139
|
+
# function(a: 1,
|
140
|
+
# b: 2)
|
141
|
+
# Registers an offense for:
|
142
|
+
# function({a: 1,
|
143
|
+
# b: 2})
|
144
|
+
# ignore_explicit - Ignore only explicit hashes.
|
145
|
+
# Accepts:
|
146
|
+
# function({a: 1,
|
147
|
+
# b: 2})
|
148
|
+
# Registers an offense for:
|
149
|
+
# function(a: 1,
|
150
|
+
# b: 2)
|
151
|
+
EnforcedLastArgumentHashStyle: always_inspect
|
152
|
+
SupportedLastArgumentHashStyles:
|
153
|
+
- always_inspect
|
154
|
+
- always_ignore
|
155
|
+
- ignore_implicit
|
156
|
+
- ignore_explicit
|
396
157
|
|
397
158
|
Style/AlignParameters:
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
159
|
+
# Alignment of parameters in multi-line method calls.
|
160
|
+
#
|
161
|
+
# The `with_first_parameter` style aligns the following lines along the same
|
162
|
+
# column as the first parameter.
|
163
|
+
#
|
164
|
+
# method_call(a,
|
165
|
+
# b)
|
166
|
+
#
|
167
|
+
# The `with_fixed_indentation` style aligns the following lines with one
|
168
|
+
# level of indentation relative to the start of the line with the method call.
|
169
|
+
#
|
170
|
+
# method_call(a,
|
171
|
+
# b)
|
172
|
+
EnforcedStyle: with_fixed_indentation
|
173
|
+
SupportedStyles:
|
174
|
+
- with_first_parameter
|
175
|
+
- with_fixed_indentation
|
176
|
+
# By default, the indentation width from Style/IndentationWidth is used
|
177
|
+
# But it can be overridden by setting this parameter
|
178
|
+
IndentationWidth: ~
|
403
179
|
|
404
180
|
Style/AndOr:
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#array-join'
|
412
|
-
Enabled: false
|
413
|
-
|
414
|
-
Style/AsciiComments:
|
415
|
-
Description: 'Use only ascii symbols in comments.'
|
416
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#english-comments'
|
417
|
-
Enabled: false
|
418
|
-
|
419
|
-
Style/AsciiIdentifiers:
|
420
|
-
Description: 'Use only ascii symbols in identifiers.'
|
421
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#english-identifiers'
|
422
|
-
Enabled: false
|
181
|
+
# Whether `and` and `or` are banned only in conditionals (conditionals)
|
182
|
+
# or completely (always).
|
183
|
+
EnforcedStyle: conditionals
|
184
|
+
SupportedStyles:
|
185
|
+
- always
|
186
|
+
- conditionals
|
423
187
|
|
424
|
-
Style/Attr:
|
425
|
-
Description: 'Checks for uses of Module#attr.'
|
426
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#attr'
|
427
|
-
Enabled: false
|
428
|
-
|
429
|
-
Style/BeginBlock:
|
430
|
-
Description: 'Avoid the use of BEGIN blocks.'
|
431
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-BEGIN-blocks'
|
432
|
-
Enabled: false
|
433
188
|
|
189
|
+
# Checks if usage of %() or %Q() matches configuration.
|
434
190
|
Style/BarePercentLiterals:
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
Style/BlockComments:
|
440
|
-
Description: 'Do not use block comments.'
|
441
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-block-comments'
|
442
|
-
Enabled: false
|
443
|
-
|
444
|
-
Style/BlockEndNewline:
|
445
|
-
Description: 'Put end statement of multiline block on its own line.'
|
446
|
-
Enabled: false
|
191
|
+
EnforcedStyle: bare_percent
|
192
|
+
SupportedStyles:
|
193
|
+
- percent_q
|
194
|
+
- bare_percent
|
447
195
|
|
448
196
|
Style/BlockDelimiters:
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
197
|
+
EnforcedStyle: line_count_based
|
198
|
+
SupportedStyles:
|
199
|
+
# The `line_count_based` style enforces braces around single line blocks and
|
200
|
+
# do..end around multi-line blocks.
|
201
|
+
- line_count_based
|
202
|
+
# The `semantic` style enforces braces around functional blocks, where the
|
203
|
+
# primary purpose of the block is to return a value and do..end for
|
204
|
+
# procedural blocks, where the primary purpose of the block is its
|
205
|
+
# side-effects.
|
206
|
+
#
|
207
|
+
# This looks at the usage of a block's method to determine its type (e.g. is
|
208
|
+
# the result of a `map` assigned to a variable or passed to another
|
209
|
+
# method) but exceptions are permitted in the `ProceduralMethods`,
|
210
|
+
# `FunctionalMethods` and `IgnoredMethods` sections below.
|
211
|
+
- semantic
|
212
|
+
# The `braces_for_chaining` style enforces braces around single line blocks
|
213
|
+
# and do..end around multi-line blocks, except for multi-line blocks whose
|
214
|
+
# return value is being chained with another method (in which case braces
|
215
|
+
# are enforced).
|
216
|
+
- braces_for_chaining
|
217
|
+
ProceduralMethods:
|
218
|
+
# Methods that are known to be procedural in nature but look functional from
|
219
|
+
# their usage, e.g.
|
220
|
+
#
|
221
|
+
# time = Benchmark.realtime do
|
222
|
+
# foo.bar
|
223
|
+
# end
|
224
|
+
#
|
225
|
+
# Here, the return value of the block is discarded but the return value of
|
226
|
+
# `Benchmark.realtime` is used.
|
227
|
+
- benchmark
|
228
|
+
- bm
|
229
|
+
- bmbm
|
230
|
+
- create
|
231
|
+
- each_with_object
|
232
|
+
- measure
|
233
|
+
- new
|
234
|
+
- realtime
|
235
|
+
- tap
|
236
|
+
- with_object
|
237
|
+
FunctionalMethods:
|
238
|
+
# Methods that are known to be functional in nature but look procedural from
|
239
|
+
# their usage, e.g.
|
240
|
+
#
|
241
|
+
# let(:foo) { Foo.new }
|
242
|
+
#
|
243
|
+
# Here, the return value of `Foo.new` is used to define a `foo` helper but
|
244
|
+
# doesn't appear to be used from the return value of `let`.
|
245
|
+
- let
|
246
|
+
- let!
|
247
|
+
- subject
|
248
|
+
- watch
|
249
|
+
IgnoredMethods:
|
250
|
+
# Methods that can be either procedural or functional and cannot be
|
251
|
+
# categorised from their usage alone, e.g.
|
252
|
+
#
|
253
|
+
# foo = lambda do |x|
|
254
|
+
# puts "Hello, #{x}"
|
255
|
+
# end
|
256
|
+
#
|
257
|
+
# foo = lambda do |x|
|
258
|
+
# x * 100
|
259
|
+
# end
|
260
|
+
#
|
261
|
+
# Here, it is impossible to tell from the return value of `lambda` whether
|
262
|
+
# the inner block's return value is significant.
|
263
|
+
- lambda
|
264
|
+
- proc
|
265
|
+
- it
|
455
266
|
|
456
267
|
Style/BracesAroundHashParameters:
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
268
|
+
EnforcedStyle: no_braces
|
269
|
+
SupportedStyles:
|
270
|
+
# The `braces` style enforces braces around all method parameters that are
|
271
|
+
# hashes.
|
272
|
+
- braces
|
273
|
+
# The `no_braces` style checks that the last parameter doesn't have braces
|
274
|
+
# around it.
|
275
|
+
- no_braces
|
276
|
+
# The `context_dependent` style checks that the last parameter doesn't have
|
277
|
+
# braces around it, but requires braces if the second to last parameter is
|
278
|
+
# also a hash literal.
|
279
|
+
- context_dependent
|
280
|
+
|
281
|
+
# Indentation of `when`.
|
465
282
|
Style/CaseIndentation:
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
Style/ClassAndModuleCamelCase:
|
476
|
-
Description: 'Use CamelCase for classes and modules.'
|
477
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#camelcase-classes'
|
478
|
-
Enabled: false
|
283
|
+
IndentWhenRelativeTo: case
|
284
|
+
SupportedStyles:
|
285
|
+
- case
|
286
|
+
- end
|
287
|
+
IndentOneStep: false
|
288
|
+
# By default, the indentation width from Style/IndentationWidth is used
|
289
|
+
# But it can be overridden by setting this parameter
|
290
|
+
# This only matters if IndentOneStep is true
|
291
|
+
IndentationWidth: ~
|
479
292
|
|
480
293
|
Style/ClassAndModuleChildren:
|
481
|
-
|
482
|
-
|
294
|
+
# Checks the style of children definitions at classes and modules.
|
295
|
+
#
|
296
|
+
# Basically there are two different styles:
|
297
|
+
#
|
298
|
+
# `nested` - have each child on a separate line
|
299
|
+
# class Foo
|
300
|
+
# class Bar
|
301
|
+
# end
|
302
|
+
# end
|
303
|
+
#
|
304
|
+
# `compact` - combine definitions as much as possible
|
305
|
+
# class Foo::Bar
|
306
|
+
# end
|
307
|
+
#
|
308
|
+
# The compact style is only forced, for classes / modules with one child.
|
309
|
+
EnforcedStyle: nested
|
310
|
+
SupportedStyles:
|
311
|
+
- nested
|
312
|
+
- compact
|
483
313
|
|
484
314
|
Style/ClassCheck:
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
315
|
+
EnforcedStyle: is_a?
|
316
|
+
SupportedStyles:
|
317
|
+
- is_a?
|
318
|
+
- kind_of?
|
319
|
+
|
320
|
+
# Align with the style guide.
|
321
|
+
Style/CollectionMethods:
|
322
|
+
# Mapping from undesired method to desired_method
|
323
|
+
# e.g. to use `detect` over `find`:
|
324
|
+
#
|
325
|
+
# CollectionMethods:
|
326
|
+
# PreferredMethods:
|
327
|
+
# find: detect
|
328
|
+
PreferredMethods:
|
329
|
+
collect: 'map'
|
330
|
+
collect!: 'map!'
|
331
|
+
inject: 'reduce'
|
332
|
+
detect: 'find'
|
333
|
+
find_all: 'select'
|
334
|
+
|
335
|
+
# Use ` or %x around command literals.
|
507
336
|
Style/CommandLiteral:
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
337
|
+
EnforcedStyle: mixed
|
338
|
+
# backticks: Always use backticks.
|
339
|
+
# percent_x: Always use %x.
|
340
|
+
# mixed: Use backticks on single-line commands, and %x on multi-line commands.
|
341
|
+
SupportedStyles:
|
342
|
+
- backticks
|
343
|
+
- percent_x
|
344
|
+
- mixed
|
345
|
+
# If false, the cop will always recommend using %x if one or more backticks
|
346
|
+
# are found in the command string.
|
347
|
+
AllowInnerBackticks: false
|
348
|
+
|
349
|
+
# Checks formatting of special comments
|
512
350
|
Style/CommentAnnotation:
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
351
|
+
Keywords:
|
352
|
+
- TODO
|
353
|
+
- FIXME
|
354
|
+
- OPTIMIZE
|
355
|
+
- HACK
|
356
|
+
- REVIEW
|
357
|
+
|
358
|
+
Style/ConditionalAssignment:
|
359
|
+
EnforcedStyle: assign_to_condition
|
360
|
+
SupportedStyles:
|
361
|
+
- assign_to_condition
|
362
|
+
- assign_inside_condition
|
363
|
+
# When configured to `assign_to_condition`, `SingleLineConditionsOnly`
|
364
|
+
# will only register an offense when all branches of a condition are
|
365
|
+
# a single line.
|
366
|
+
# When configured to `assign_inside_condition`, `SingleLineConditionsOnly`
|
367
|
+
# will only register an offense for assignment to a condition that has
|
368
|
+
# at least one multiline branch.
|
369
|
+
SingleLineConditionsOnly: true
|
370
|
+
|
371
|
+
# Checks that you have put a copyright in a comment before any code.
|
372
|
+
#
|
373
|
+
# You can override the default Notice in your .rubocop.yml file.
|
374
|
+
#
|
375
|
+
# In order to use autocorrect, you must supply a value for the
|
376
|
+
# AutocorrectNotice key that matches the regexp Notice. A blank
|
377
|
+
# AutocorrectNotice will cause an error during autocorrect.
|
378
|
+
#
|
379
|
+
# Autocorrect will add a copyright notice in a comment at the top
|
380
|
+
# of the file immediately after any shebang or encoding comments.
|
381
|
+
#
|
382
|
+
# Example rubocop.yml:
|
383
|
+
#
|
384
|
+
# Style/Copyright:
|
385
|
+
# Enabled: true
|
386
|
+
# Notice: 'Copyright (\(c\) )?2015 Yahoo! Inc'
|
387
|
+
# AutocorrectNotice: '# Copyright (c) 2015 Yahoo! Inc.'
|
388
|
+
#
|
389
|
+
Style/Copyright:
|
390
|
+
Notice: '^Copyright (\(c\) )?2[0-9]{3} .+'
|
391
|
+
AutocorrectNotice: ''
|
535
392
|
|
536
393
|
Style/Documentation:
|
537
|
-
Description: 'Document classes and non-namespace modules.'
|
538
|
-
Enabled: false
|
539
|
-
|
540
|
-
Style/DotPosition:
|
541
|
-
Description: 'Checks the position of the dot in multi-line method calls.'
|
542
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#consistent-multi-line-chains'
|
543
394
|
Enabled: false
|
544
395
|
|
545
|
-
Style/
|
546
|
-
|
547
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-bang-bang'
|
548
|
-
Enabled: false
|
549
|
-
|
550
|
-
Style/EachWithObject:
|
551
|
-
Description: 'Prefer `each_with_object` over `inject` or `reduce`.'
|
552
|
-
Enabled: false
|
553
|
-
|
554
|
-
Style/ElseAlignment:
|
555
|
-
Description: 'Align elses and elsifs correctly.'
|
556
|
-
Enabled: false
|
396
|
+
Style/DocumentationMethod:
|
397
|
+
RequireForNonPublicMethods: false
|
557
398
|
|
399
|
+
# Multi-line method chaining should be done with leading dots.
|
400
|
+
Style/DotPosition:
|
401
|
+
EnforcedStyle: leading
|
402
|
+
SupportedStyles:
|
403
|
+
- leading
|
404
|
+
- trailing
|
405
|
+
|
406
|
+
# Warn on empty else statements
|
407
|
+
# empty - warn only on empty else
|
408
|
+
# nil - warn on else with nil in it
|
409
|
+
# both - warn on empty else and else with nil in it
|
558
410
|
Style/EmptyElse:
|
559
|
-
|
560
|
-
|
411
|
+
EnforcedStyle: both
|
412
|
+
SupportedStyles:
|
413
|
+
- empty
|
414
|
+
- nil
|
415
|
+
- both
|
561
416
|
|
417
|
+
# Use empty lines between defs.
|
562
418
|
Style/EmptyLineBetweenDefs:
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
Style/EmptyLines:
|
568
|
-
Description: "Don't use several empty lines in a row."
|
569
|
-
Enabled: false
|
570
|
-
|
571
|
-
Style/EmptyLinesAroundAccessModifier:
|
572
|
-
Description: "Keep blank lines around access modifiers."
|
573
|
-
Enabled: false
|
419
|
+
# If true, this parameter means that single line method definitions don't
|
420
|
+
# need an empty line between them.
|
421
|
+
AllowAdjacentOneLineDefs: false
|
574
422
|
|
575
423
|
Style/EmptyLinesAroundBlockBody:
|
576
|
-
|
577
|
-
|
424
|
+
EnforcedStyle: no_empty_lines
|
425
|
+
SupportedStyles:
|
426
|
+
- empty_lines
|
427
|
+
- no_empty_lines
|
578
428
|
|
579
429
|
Style/EmptyLinesAroundClassBody:
|
580
|
-
|
581
|
-
|
430
|
+
EnforcedStyle: no_empty_lines
|
431
|
+
SupportedStyles:
|
432
|
+
- empty_lines
|
433
|
+
- empty_lines_except_namespace
|
434
|
+
- empty_lines_special
|
435
|
+
- no_empty_lines
|
582
436
|
|
583
437
|
Style/EmptyLinesAroundModuleBody:
|
584
|
-
|
585
|
-
|
586
|
-
|
587
|
-
|
588
|
-
|
589
|
-
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
|
595
|
-
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
|
600
|
-
|
601
|
-
Style/
|
602
|
-
|
603
|
-
|
604
|
-
|
605
|
-
|
606
|
-
|
607
|
-
|
608
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#predicate-methods'
|
609
|
-
Enabled: false
|
438
|
+
EnforcedStyle: no_empty_lines
|
439
|
+
SupportedStyles:
|
440
|
+
- empty_lines
|
441
|
+
- empty_lines_except_namespace
|
442
|
+
- empty_lines_special
|
443
|
+
- no_empty_lines
|
444
|
+
|
445
|
+
# NOT IMPLEMENTED YET
|
446
|
+
# Style/EmptyMethod:
|
447
|
+
# EnforcedStyle: compact
|
448
|
+
# SupportedStyles:
|
449
|
+
# - compact
|
450
|
+
# - expanded
|
451
|
+
|
452
|
+
# Checks whether the source file has a utf-8 encoding comment or not
|
453
|
+
# AutoCorrectEncodingComment must match the regex
|
454
|
+
# /#.*coding\s?[:=]\s?(?:UTF|utf)-8/
|
455
|
+
Style/Encoding:
|
456
|
+
EnforcedStyle: never
|
457
|
+
SupportedStyles:
|
458
|
+
- when_needed
|
459
|
+
- always
|
460
|
+
- never
|
461
|
+
AutoCorrectEncodingComment: '# encoding: utf-8'
|
610
462
|
|
611
463
|
Style/ExtraSpacing:
|
612
|
-
|
613
|
-
|
464
|
+
# When true, allows most uses of extra spacing if the intent is to align
|
465
|
+
# things with the previous or next line, not counting empty lines or comment
|
466
|
+
# lines.
|
467
|
+
AllowForAlignment: true
|
468
|
+
# When true, forces the alignment of = in assignments on consecutive lines.
|
469
|
+
ForceEqualSignAlignment: false
|
614
470
|
|
615
471
|
Style/FileName:
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
|
472
|
+
# File names listed in AllCops:Include are excluded by default. Add extra
|
473
|
+
# excludes here.
|
474
|
+
Exclude: []
|
475
|
+
# When true, requires that each source file should define a class or module
|
476
|
+
# with a name which matches the file name (converted to ... case).
|
477
|
+
# It further expects it to be nested inside modules which match the names
|
478
|
+
# of subdirectories in its path.
|
479
|
+
ExpectMatchingDefinition: false
|
480
|
+
# If non-nil, expect all source file names to match the following regex.
|
481
|
+
# Only the file name itself is matched, not the entire file path.
|
482
|
+
# Use anchors as necessary if you want to match the entire name rather than
|
483
|
+
# just a part of it.
|
484
|
+
Regex: ~
|
485
|
+
# With `IgnoreExecutableScripts` set to `true`, this cop does not
|
486
|
+
# report offending filenames for executable scripts (i.e. source
|
487
|
+
# files with a shebang in the first line).
|
488
|
+
IgnoreExecutableScripts: true
|
624
489
|
|
625
490
|
Style/FirstParameterIndentation:
|
626
|
-
|
627
|
-
|
628
|
-
|
629
|
-
|
630
|
-
|
631
|
-
|
632
|
-
|
633
|
-
|
491
|
+
EnforcedStyle: special_for_inner_method_call_in_parentheses
|
492
|
+
SupportedStyles:
|
493
|
+
# The first parameter should always be indented one step more than the
|
494
|
+
# preceding line.
|
495
|
+
- consistent
|
496
|
+
# The first parameter should normally be indented one step more than the
|
497
|
+
# preceding line, but if it's a parameter for a method call that is itself
|
498
|
+
# a parameter in a method call, then the inner parameter should be indented
|
499
|
+
# relative to the inner method.
|
500
|
+
- special_for_inner_method_call
|
501
|
+
# Same as special_for_inner_method_call except that the special rule only
|
502
|
+
# applies if the outer method call encloses its arguments in parentheses.
|
503
|
+
- special_for_inner_method_call_in_parentheses
|
504
|
+
# By default, the indentation width from Style/IndentationWidth is used
|
505
|
+
# But it can be overridden by setting this parameter
|
506
|
+
IndentationWidth: ~
|
507
|
+
|
508
|
+
# Checks use of for or each in multiline loops.
|
634
509
|
Style/For:
|
635
|
-
|
636
|
-
|
637
|
-
|
510
|
+
EnforcedStyle: each
|
511
|
+
SupportedStyles:
|
512
|
+
- for
|
513
|
+
- each
|
638
514
|
|
515
|
+
# Enforce the method used for string formatting.
|
639
516
|
Style/FormatString:
|
640
|
-
|
641
|
-
|
642
|
-
|
643
|
-
|
517
|
+
EnforcedStyle: format
|
518
|
+
SupportedStyles:
|
519
|
+
- format
|
520
|
+
- sprintf
|
521
|
+
- percent
|
522
|
+
|
523
|
+
Style/FrozenStringLiteralComment:
|
524
|
+
EnforcedStyle: when_needed
|
525
|
+
SupportedStyles:
|
526
|
+
# `when_needed` will add the frozen string literal comment to files
|
527
|
+
# only when the `TargetRubyVersion` is set to 2.3+.
|
528
|
+
- when_needed
|
529
|
+
# `always` will always add the frozen string literal comment to a file
|
530
|
+
# regardless of the Ruby version or if `freeze` or `<<` are called on a
|
531
|
+
# string literal. If you run code against multiple versions of Ruby, it is
|
532
|
+
# possible that this will create errors in Ruby 2.3.0+.
|
533
|
+
- always
|
534
|
+
Exclude:
|
535
|
+
- "Gemfile"
|
536
|
+
- "Rakefile"
|
537
|
+
- "bin/*"
|
538
|
+
- "spec/spec_helper.rb"
|
539
|
+
- "spec/**/*_spec.rb"
|
540
|
+
- "**/*.gemspec"
|
541
|
+
- "**/*.rake"
|
542
|
+
|
543
|
+
# Built-in global variables are allowed by default.
|
644
544
|
Style/GlobalVars:
|
645
|
-
|
646
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#instance-vars'
|
647
|
-
Reference: 'http://www.zenspider.com/Languages/Ruby/QuickRef.html'
|
648
|
-
Enabled: false
|
545
|
+
AllowedVariables: []
|
649
546
|
|
547
|
+
# `MinBodyLength` defines the number of lines of the a body of an if / unless
|
548
|
+
# needs to have to trigger this cop
|
650
549
|
Style/GuardClause:
|
651
|
-
|
652
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-nested-conditionals'
|
653
|
-
Enabled: false
|
550
|
+
MinBodyLength: 1
|
654
551
|
|
655
552
|
Style/HashSyntax:
|
656
|
-
|
657
|
-
|
658
|
-
|
659
|
-
|
660
|
-
|
553
|
+
EnforcedStyle: ruby19
|
554
|
+
SupportedStyles:
|
555
|
+
# checks for 1.9 syntax (e.g. {a: 1}) for all symbol keys
|
556
|
+
- ruby19
|
557
|
+
# checks for hash rocket syntax for all hashes
|
558
|
+
- hash_rockets
|
559
|
+
# forbids mixed key syntaxes (e.g. {a: 1, :b => 2})
|
560
|
+
- no_mixed_keys
|
561
|
+
# enforces both ruby19 and no_mixed_keys styles
|
562
|
+
- ruby19_no_mixed_keys
|
563
|
+
# Force hashes that have a symbol value to use hash rockets
|
564
|
+
UseHashRocketsWithSymbolValues: false
|
565
|
+
# Do not suggest { a?: 1 } over { :a? => 1 } in ruby19 style
|
566
|
+
PreferHashRocketsForNonAlnumEndingSymbols: false
|
661
567
|
|
662
568
|
Style/IfUnlessModifier:
|
663
|
-
|
664
|
-
Favor modifier if/unless usage when you have a
|
665
|
-
single-line body.
|
666
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#if-as-a-modifier'
|
667
|
-
Enabled: false
|
668
|
-
|
669
|
-
Style/IfWithSemicolon:
|
670
|
-
Description: 'Do not use if x; .... Use the ternary operator instead.'
|
671
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-semicolon-ifs'
|
672
|
-
Enabled: false
|
569
|
+
MaxLineLength: 80
|
673
570
|
|
674
571
|
Style/IndentationConsistency:
|
675
|
-
|
676
|
-
|
572
|
+
# The difference between `rails` and `normal` is that the `rails` style
|
573
|
+
# prescribes that in classes and modules the `protected` and `private`
|
574
|
+
# modifier keywords shall be indented the same as public methods and that
|
575
|
+
# protected and private members shall be indented one step more than the
|
576
|
+
# modifiers. Other than that, both styles mean that entities on the same
|
577
|
+
# logical depth shall have the same indentation.
|
578
|
+
EnforcedStyle: normal
|
579
|
+
SupportedStyles:
|
580
|
+
- normal
|
581
|
+
- rails
|
677
582
|
|
678
583
|
Style/IndentationWidth:
|
679
|
-
|
680
|
-
|
681
|
-
Enabled: false
|
584
|
+
# Number of spaces for each indentation level.
|
585
|
+
Width: 2
|
682
586
|
|
587
|
+
# Checks the indentation of the first element in an array literal.
|
683
588
|
Style/IndentArray:
|
684
|
-
|
685
|
-
|
686
|
-
|
687
|
-
|
688
|
-
|
589
|
+
# The value `special_inside_parentheses` means that array literals with
|
590
|
+
# brackets that have their opening bracket on the same line as a surrounding
|
591
|
+
# opening round parenthesis, shall have their first element indented relative
|
592
|
+
# to the first position inside the parenthesis.
|
593
|
+
#
|
594
|
+
# The value `consistent` means that the indentation of the first element shall
|
595
|
+
# always be relative to the first position of the line where the opening
|
596
|
+
# bracket is.
|
597
|
+
#
|
598
|
+
# The value `align_brackets` means that the indentation of the first element
|
599
|
+
# shall always be relative to the position of the opening bracket.
|
600
|
+
EnforcedStyle: consistent
|
601
|
+
SupportedStyles:
|
602
|
+
- special_inside_parentheses
|
603
|
+
- consistent
|
604
|
+
- align_brackets
|
605
|
+
# By default, the indentation width from Style/IndentationWidth is used
|
606
|
+
# But it can be overridden by setting this parameter
|
607
|
+
IndentationWidth: ~
|
608
|
+
|
609
|
+
# Checks the indentation of assignment RHS, when on a different line from LHS
|
610
|
+
Style/IndentAssignment:
|
611
|
+
# By default, the indentation width from Style/IndentationWidth is used
|
612
|
+
# But it can be overridden by setting this parameter
|
613
|
+
IndentationWidth: ~
|
614
|
+
|
615
|
+
# Checks the indentation of the first key in a hash literal.
|
689
616
|
Style/IndentHash:
|
690
|
-
|
691
|
-
|
692
|
-
|
693
|
-
|
694
|
-
|
695
|
-
|
696
|
-
|
617
|
+
# The value `special_inside_parentheses` means that hash literals with braces
|
618
|
+
# that have their opening brace on the same line as a surrounding opening
|
619
|
+
# round parenthesis, shall have their first key indented relative to the
|
620
|
+
# first position inside the parenthesis.
|
621
|
+
#
|
622
|
+
# The value `consistent` means that the indentation of the first key shall
|
623
|
+
# always be relative to the first position of the line where the opening
|
624
|
+
# brace is.
|
625
|
+
#
|
626
|
+
# The value `align_braces` means that the indentation of the first key shall
|
627
|
+
# always be relative to the position of the opening brace.
|
628
|
+
EnforcedStyle: consistent
|
629
|
+
SupportedStyles:
|
630
|
+
- special_inside_parentheses
|
631
|
+
- consistent
|
632
|
+
- align_braces
|
633
|
+
# By default, the indentation width from Style/IndentationWidth is used
|
634
|
+
# But it can be overridden by setting this parameter
|
635
|
+
IndentationWidth: ~
|
697
636
|
|
698
637
|
Style/Lambda:
|
699
|
-
|
700
|
-
|
701
|
-
|
638
|
+
EnforcedStyle: literal
|
639
|
+
SupportedStyles:
|
640
|
+
- line_count_dependent
|
641
|
+
- lambda
|
642
|
+
- literal
|
643
|
+
|
644
|
+
Style/SpaceInLambdaLiteral:
|
645
|
+
EnforcedStyle: require_no_space
|
646
|
+
SupportedStyles:
|
647
|
+
- require_no_space
|
648
|
+
- require_space
|
702
649
|
|
703
650
|
Style/LambdaCall:
|
704
|
-
|
705
|
-
|
706
|
-
|
707
|
-
|
708
|
-
Style/LeadingCommentSpace:
|
709
|
-
Description: 'Comments should start with a space.'
|
710
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#hash-space'
|
711
|
-
Enabled: false
|
651
|
+
EnforcedStyle: call
|
652
|
+
SupportedStyles:
|
653
|
+
- call
|
654
|
+
- braces
|
712
655
|
|
713
|
-
Style/
|
714
|
-
|
715
|
-
|
716
|
-
|
717
|
-
|
656
|
+
Style/Next:
|
657
|
+
# With `always` all conditions at the end of an iteration needs to be
|
658
|
+
# replaced by next - with `skip_modifier_ifs` the modifier if like this one
|
659
|
+
# are ignored: [1, 2].each { |a| return 'yes' if a == 1 }
|
660
|
+
EnforcedStyle: skip_modifier_ifs
|
661
|
+
# `MinBodyLength` defines the number of lines of the a body of an if / unless
|
662
|
+
# needs to have to trigger this cop
|
663
|
+
MinBodyLength: 3
|
664
|
+
SupportedStyles:
|
665
|
+
- skip_modifier_ifs
|
666
|
+
- always
|
718
667
|
|
719
|
-
Style/
|
720
|
-
|
721
|
-
|
722
|
-
|
668
|
+
Style/NonNilCheck:
|
669
|
+
# With `IncludeSemanticChanges` set to `true`, this cop reports offenses for
|
670
|
+
# `!x.nil?` and autocorrects that and `x != nil` to solely `x`, which is
|
671
|
+
# **usually** OK, but might change behavior.
|
672
|
+
#
|
673
|
+
# With `IncludeSemanticChanges` set to `false`, this cop does not report
|
674
|
+
# offenses for `!x.nil?` and does no changes that might change behavior.
|
675
|
+
IncludeSemanticChanges: false
|
676
|
+
|
677
|
+
Style/NumericPredicate:
|
678
|
+
EnforcedStyle: predicate
|
679
|
+
SupportedStyles:
|
680
|
+
- predicate
|
681
|
+
- comparison
|
682
|
+
# Exclude RSpec specs because assertions like `expect(1).to be > 0` cause
|
683
|
+
# false positives.
|
684
|
+
Exclude:
|
685
|
+
- 'spec/**/*'
|
723
686
|
|
724
687
|
Style/MethodDefParentheses:
|
725
|
-
|
726
|
-
|
727
|
-
|
728
|
-
|
729
|
-
|
688
|
+
EnforcedStyle: require_parentheses
|
689
|
+
SupportedStyles:
|
690
|
+
- require_parentheses
|
691
|
+
- require_no_parentheses
|
692
|
+
- require_no_parentheses_except_multiline
|
730
693
|
|
731
694
|
Style/MethodName:
|
732
|
-
|
733
|
-
|
734
|
-
|
695
|
+
EnforcedStyle: snake_case
|
696
|
+
SupportedStyles:
|
697
|
+
- snake_case
|
698
|
+
- camelCase
|
735
699
|
|
736
700
|
Style/ModuleFunction:
|
737
|
-
|
738
|
-
|
739
|
-
|
740
|
-
|
741
|
-
|
742
|
-
|
743
|
-
|
744
|
-
|
745
|
-
|
746
|
-
|
747
|
-
|
748
|
-
|
749
|
-
|
750
|
-
|
751
|
-
|
752
|
-
|
753
|
-
|
701
|
+
EnforcedStyle: module_function
|
702
|
+
SupportedStyles:
|
703
|
+
- module_function
|
704
|
+
- extend_self
|
705
|
+
|
706
|
+
Style/MultilineArrayBraceLayout:
|
707
|
+
EnforcedStyle: symmetrical
|
708
|
+
SupportedStyles:
|
709
|
+
# symmetrical: closing brace is positioned in same way as opening brace
|
710
|
+
# new_line: closing brace is always on a new line
|
711
|
+
# same_line: closing brace is always on the same line as last element
|
712
|
+
- symmetrical
|
713
|
+
- new_line
|
714
|
+
- same_line
|
715
|
+
|
716
|
+
Style/MultilineAssignmentLayout:
|
717
|
+
# The types of assignments which are subject to this rule.
|
718
|
+
SupportedTypes:
|
719
|
+
- block
|
720
|
+
- case
|
721
|
+
- class
|
722
|
+
- if
|
723
|
+
- kwbegin
|
724
|
+
- module
|
725
|
+
EnforcedStyle: new_line
|
726
|
+
SupportedStyles:
|
727
|
+
# Ensures that the assignment operator and the rhs are on the same line for
|
728
|
+
# the set of supported types.
|
729
|
+
- same_line
|
730
|
+
# Ensures that the assignment operator and the rhs are on separate lines
|
731
|
+
# for the set of supported types.
|
732
|
+
- new_line
|
733
|
+
|
734
|
+
Style/MultilineHashBraceLayout:
|
735
|
+
EnforcedStyle: symmetrical
|
736
|
+
SupportedStyles:
|
737
|
+
# symmetrical: closing brace is positioned in same way as opening brace
|
738
|
+
# new_line: closing brace is always on a new line
|
739
|
+
# same_line: closing brace is always on same line as last element
|
740
|
+
- symmetrical
|
741
|
+
- new_line
|
742
|
+
- same_line
|
743
|
+
|
744
|
+
Style/MultilineMethodCallBraceLayout:
|
745
|
+
EnforcedStyle: symmetrical
|
746
|
+
SupportedStyles:
|
747
|
+
# symmetrical: closing brace is positioned in same way as opening brace
|
748
|
+
# new_line: closing brace is always on a new line
|
749
|
+
# same_line: closing brace is always on the same line as last argument
|
750
|
+
- symmetrical
|
751
|
+
- new_line
|
752
|
+
- same_line
|
753
|
+
|
754
|
+
Style/MultilineMethodCallIndentation:
|
755
|
+
EnforcedStyle: aligned
|
756
|
+
SupportedStyles:
|
757
|
+
- aligned
|
758
|
+
- indented
|
759
|
+
- indented_relative_to_receiver
|
760
|
+
# By default, the indentation width from Style/IndentationWidth is used
|
761
|
+
# But it can be overridden by setting this parameter
|
762
|
+
IndentationWidth: ~
|
763
|
+
|
764
|
+
Style/MultilineMethodDefinitionBraceLayout:
|
765
|
+
EnforcedStyle: symmetrical
|
766
|
+
SupportedStyles:
|
767
|
+
# symmetrical: closing brace is positioned in same way as opening brace
|
768
|
+
# new_line: closing brace is always on a new line
|
769
|
+
# same_line: closing brace is always on the same line as last parameter
|
770
|
+
- symmetrical
|
771
|
+
- new_line
|
772
|
+
- same_line
|
754
773
|
|
755
774
|
Style/MultilineOperationIndentation:
|
756
|
-
|
757
|
-
|
758
|
-
|
759
|
-
|
760
|
-
|
761
|
-
|
762
|
-
|
763
|
-
Avoid multi-line ?: (the ternary operator);
|
764
|
-
use if/unless instead.
|
765
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-multiline-ternary'
|
766
|
-
Enabled: false
|
767
|
-
|
768
|
-
Style/NegatedIf:
|
769
|
-
Description: >-
|
770
|
-
Favor unless over if for negative conditions
|
771
|
-
(or control flow or).
|
772
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#unless-for-negatives'
|
773
|
-
Enabled: false
|
774
|
-
|
775
|
-
Style/NegatedWhile:
|
776
|
-
Description: 'Favor until over while for negative conditions.'
|
777
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#until-for-negatives'
|
778
|
-
Enabled: false
|
779
|
-
|
780
|
-
Style/NestedTernaryOperator:
|
781
|
-
Description: 'Use one expression per branch in a ternary operator.'
|
782
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-nested-ternary'
|
783
|
-
Enabled: false
|
784
|
-
|
785
|
-
Style/Next:
|
786
|
-
Description: 'Use `next` to skip iteration instead of a condition at the end.'
|
787
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-nested-conditionals'
|
788
|
-
Enabled: false
|
789
|
-
|
790
|
-
Style/NilComparison:
|
791
|
-
Description: 'Prefer x.nil? to x == nil.'
|
792
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#predicate-methods'
|
793
|
-
Enabled: false
|
794
|
-
|
795
|
-
Style/NonNilCheck:
|
796
|
-
Description: 'Checks for redundant nil checks.'
|
797
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-non-nil-checks'
|
798
|
-
Enabled: false
|
799
|
-
|
800
|
-
Style/Not:
|
801
|
-
Description: 'Use ! instead of not.'
|
802
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#bang-not-not'
|
803
|
-
Enabled: false
|
775
|
+
EnforcedStyle: indented
|
776
|
+
SupportedStyles:
|
777
|
+
- aligned
|
778
|
+
- indented
|
779
|
+
# By default, the indentation width from Style/IndentationWidth is used
|
780
|
+
# But it can be overridden by setting this parameter
|
781
|
+
IndentationWidth: ~
|
804
782
|
|
805
783
|
Style/NumericLiterals:
|
806
|
-
|
807
|
-
|
808
|
-
|
809
|
-
|
810
|
-
|
811
|
-
|
812
|
-
|
813
|
-
|
814
|
-
|
815
|
-
|
816
|
-
|
817
|
-
|
818
|
-
|
819
|
-
|
820
|
-
|
821
|
-
|
822
|
-
|
823
|
-
|
824
|
-
Style/OptionalArguments:
|
825
|
-
Description: >-
|
826
|
-
Checks for optional arguments that do not appear at the end
|
827
|
-
of the argument list
|
828
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#optional-arguments'
|
829
|
-
Enabled: false
|
830
|
-
|
831
|
-
Style/ParallelAssignment:
|
832
|
-
Description: >-
|
833
|
-
Check for simple usages of parallel assignment.
|
834
|
-
It will only warn when the number of variables
|
835
|
-
matches on both sides of the assignment.
|
836
|
-
This also provides performance benefits
|
837
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#parallel-assignment'
|
838
|
-
Enabled: false
|
839
|
-
|
784
|
+
MinDigits: 5
|
785
|
+
|
786
|
+
Style/NumericLiteralPrefix:
|
787
|
+
EnforcedOctalStyle: zero_with_o
|
788
|
+
SupportedOctalStyles:
|
789
|
+
- zero_with_o
|
790
|
+
- zero_only
|
791
|
+
|
792
|
+
Style/OptionHash:
|
793
|
+
# A list of parameter names that will be flagged by this cop.
|
794
|
+
SuspiciousParamNames:
|
795
|
+
- options
|
796
|
+
- opts
|
797
|
+
- args
|
798
|
+
- params
|
799
|
+
- parameters
|
800
|
+
|
801
|
+
# Allow safe assignment in conditions.
|
840
802
|
Style/ParenthesesAroundCondition:
|
841
|
-
|
842
|
-
Don't use parentheses around the condition of an
|
843
|
-
if/unless/while.
|
844
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-parens-if'
|
845
|
-
Enabled: false
|
803
|
+
AllowSafeAssignment: true
|
846
804
|
|
847
805
|
Style/PercentLiteralDelimiters:
|
848
|
-
|
849
|
-
|
850
|
-
|
806
|
+
PreferredDelimiters:
|
807
|
+
'%': ()
|
808
|
+
'%i': ()
|
809
|
+
'%I': ()
|
810
|
+
'%q': ()
|
811
|
+
'%Q': ()
|
812
|
+
'%r': '{}'
|
813
|
+
'%s': ()
|
814
|
+
'%w': ()
|
815
|
+
'%W': ()
|
816
|
+
'%x': '{}'
|
851
817
|
|
852
818
|
Style/PercentQLiterals:
|
853
|
-
|
854
|
-
|
855
|
-
|
856
|
-
|
857
|
-
Description: 'Avoid Perl-style regex back references.'
|
858
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-perl-regexp-last-matchers'
|
859
|
-
Enabled: false
|
819
|
+
EnforcedStyle: lower_case_q
|
820
|
+
SupportedStyles:
|
821
|
+
- lower_case_q # Use %q when possible, %Q when necessary
|
822
|
+
- upper_case_q # Always use %Q
|
860
823
|
|
861
824
|
Style/PredicateName:
|
862
|
-
|
863
|
-
|
864
|
-
|
825
|
+
# Predicate name prefixes.
|
826
|
+
NamePrefix:
|
827
|
+
- is_
|
828
|
+
- has_
|
829
|
+
- have_
|
830
|
+
# Predicate name prefixes that should be removed.
|
831
|
+
NamePrefixBlacklist:
|
832
|
+
- is_
|
833
|
+
- has_
|
834
|
+
- have_
|
835
|
+
# Predicate names which, despite having a blacklisted prefix, or no ?,
|
836
|
+
# should still be accepted
|
837
|
+
NameWhitelist:
|
838
|
+
- is_a?
|
839
|
+
# Exclude Rspec specs because there is a strong convetion to write spec
|
840
|
+
# helpers in the form of `have_something` or `be_something`.
|
841
|
+
Exclude:
|
842
|
+
- 'spec/**/*'
|
865
843
|
|
866
|
-
Style/
|
867
|
-
|
868
|
-
|
869
|
-
|
844
|
+
Style/PreferredHashMethods:
|
845
|
+
EnforcedStyle: short
|
846
|
+
SupportedStyles:
|
847
|
+
- short
|
848
|
+
- verbose
|
870
849
|
|
871
850
|
Style/RaiseArgs:
|
872
|
-
|
873
|
-
|
874
|
-
|
875
|
-
|
876
|
-
Style/RedundantBegin:
|
877
|
-
Description: "Don't use begin blocks when they are not needed."
|
878
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#begin-implicit'
|
879
|
-
Enabled: false
|
880
|
-
|
881
|
-
Style/RedundantException:
|
882
|
-
Description: "Checks for an obsolete RuntimeException argument in raise/fail."
|
883
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-explicit-runtimeerror'
|
884
|
-
Enabled: false
|
851
|
+
EnforcedStyle: exploded
|
852
|
+
SupportedStyles:
|
853
|
+
- compact # raise Exception.new(msg)
|
854
|
+
- exploded # raise Exception, msg
|
885
855
|
|
886
856
|
Style/RedundantReturn:
|
887
|
-
|
888
|
-
|
889
|
-
Enabled: false
|
890
|
-
|
891
|
-
Style/RedundantSelf:
|
892
|
-
Description: "Don't use self where it's not needed."
|
893
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-self-unless-required'
|
894
|
-
Enabled: false
|
857
|
+
# When true allows code like `return x, y`.
|
858
|
+
AllowMultipleReturnValues: false
|
895
859
|
|
860
|
+
# Use / or %r around regular expressions.
|
896
861
|
Style/RegexpLiteral:
|
897
|
-
|
898
|
-
|
899
|
-
|
900
|
-
|
901
|
-
|
902
|
-
|
903
|
-
|
904
|
-
|
905
|
-
|
906
|
-
|
907
|
-
|
908
|
-
|
909
|
-
|
910
|
-
|
911
|
-
|
912
|
-
|
913
|
-
been used.
|
914
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#self-assignment'
|
915
|
-
Enabled: false
|
862
|
+
EnforcedStyle: slashes
|
863
|
+
# slashes: Always use slashes.
|
864
|
+
# percent_r: Always use %r.
|
865
|
+
# mixed: Use slashes on single-line regexes, and %r on multi-line regexes.
|
866
|
+
SupportedStyles:
|
867
|
+
- slashes
|
868
|
+
- percent_r
|
869
|
+
- mixed
|
870
|
+
# If false, the cop will always recommend using %r if one or more slashes
|
871
|
+
# are found in the regexp string.
|
872
|
+
AllowInnerSlashes: false
|
873
|
+
|
874
|
+
Style/SafeNavigation:
|
875
|
+
# Safe navigation may cause a statement to start returning `nil` in addition
|
876
|
+
# to whatever it used to return.
|
877
|
+
ConvertCodeThatCanStartToReturnNil: false
|
916
878
|
|
917
879
|
Style/Semicolon:
|
918
|
-
|
919
|
-
|
920
|
-
Enabled: false
|
880
|
+
# Allow ; to separate several expressions on the same line.
|
881
|
+
AllowAsExpressionSeparator: false
|
921
882
|
|
922
883
|
Style/SignalException:
|
923
|
-
|
924
|
-
|
925
|
-
|
884
|
+
EnforcedStyle: only_raise
|
885
|
+
SupportedStyles:
|
886
|
+
- only_raise
|
887
|
+
- only_fail
|
888
|
+
- semantic
|
926
889
|
|
927
890
|
Style/SingleLineBlockParams:
|
928
|
-
|
929
|
-
|
930
|
-
|
891
|
+
Methods:
|
892
|
+
- reduce:
|
893
|
+
- acc
|
894
|
+
- elem
|
895
|
+
- inject:
|
896
|
+
- acc
|
897
|
+
- elem
|
931
898
|
|
932
899
|
Style/SingleLineMethods:
|
933
|
-
|
934
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-single-line-methods'
|
935
|
-
Enabled: false
|
900
|
+
AllowIfMethodIsEmpty: true
|
936
901
|
|
937
902
|
Style/SpaceBeforeFirstArg:
|
938
|
-
|
939
|
-
|
940
|
-
|
941
|
-
|
942
|
-
|
943
|
-
Style/SpaceAfterColon:
|
944
|
-
Description: 'Use spaces after colons.'
|
945
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#spaces-operators'
|
946
|
-
Enabled: false
|
903
|
+
# When true, allows most uses of extra spacing if the intent is to align
|
904
|
+
# things with the previous or next line, not counting empty lines or comment
|
905
|
+
# lines.
|
906
|
+
AllowForAlignment: false
|
947
907
|
|
948
|
-
Style/
|
949
|
-
|
950
|
-
|
951
|
-
|
908
|
+
Style/SpecialGlobalVars:
|
909
|
+
EnforcedStyle: use_english_names
|
910
|
+
SupportedStyles:
|
911
|
+
- use_perl_names
|
912
|
+
- use_english_names
|
952
913
|
|
953
|
-
Style/
|
954
|
-
|
955
|
-
|
914
|
+
Style/StabbyLambdaParentheses:
|
915
|
+
EnforcedStyle: require_parentheses
|
916
|
+
SupportedStyles:
|
917
|
+
- require_parentheses
|
918
|
+
- require_no_parentheses
|
956
919
|
|
957
|
-
Style/
|
958
|
-
|
959
|
-
|
960
|
-
|
961
|
-
|
962
|
-
|
920
|
+
Style/StringLiterals:
|
921
|
+
EnforcedStyle: single_quotes
|
922
|
+
SupportedStyles:
|
923
|
+
- single_quotes
|
924
|
+
- double_quotes
|
925
|
+
# If true, strings which span multiple lines using \ for continuation must
|
926
|
+
# use the same type of quotes on each line.
|
927
|
+
ConsistentQuotesInMultiline: false
|
963
928
|
|
964
|
-
Style/
|
965
|
-
|
966
|
-
|
967
|
-
|
929
|
+
Style/StringLiteralsInInterpolation:
|
930
|
+
EnforcedStyle: single_quotes
|
931
|
+
SupportedStyles:
|
932
|
+
- single_quotes
|
933
|
+
- double_quotes
|
934
|
+
|
935
|
+
Style/StringMethods:
|
936
|
+
# Mapping from undesired method to desired_method
|
937
|
+
# e.g. to use `to_sym` over `intern`:
|
938
|
+
#
|
939
|
+
# StringMethods:
|
940
|
+
# PreferredMethods:
|
941
|
+
# intern: to_sym
|
942
|
+
PreferredMethods:
|
943
|
+
intern: to_sym
|
968
944
|
|
969
|
-
Style/
|
970
|
-
|
971
|
-
|
972
|
-
|
945
|
+
Style/SpaceAroundBlockParameters:
|
946
|
+
EnforcedStyleInsidePipes: no_space
|
947
|
+
SupportedStyles:
|
948
|
+
- space
|
949
|
+
- no_space
|
950
|
+
|
951
|
+
Style/SpaceAroundEqualsInParameterDefault:
|
952
|
+
EnforcedStyle: space
|
953
|
+
SupportedStyles:
|
954
|
+
- space
|
955
|
+
- no_space
|
956
|
+
|
957
|
+
Style/SpaceAroundOperators:
|
958
|
+
# When true, allows most uses of extra spacing if the intent is to align
|
959
|
+
# with an operator on the previous or next line, not counting empty lines
|
960
|
+
# or comment lines.
|
961
|
+
AllowForAlignment: true
|
973
962
|
|
974
963
|
Style/SpaceBeforeBlockBraces:
|
975
|
-
|
976
|
-
|
977
|
-
|
978
|
-
|
964
|
+
EnforcedStyle: space
|
965
|
+
SupportedStyles:
|
966
|
+
- space
|
967
|
+
- no_space
|
979
968
|
|
980
|
-
Style/
|
981
|
-
|
982
|
-
|
969
|
+
Style/SpaceInsideBlockBraces:
|
970
|
+
EnforcedStyle: space
|
971
|
+
SupportedStyles:
|
972
|
+
- space
|
973
|
+
- no_space
|
974
|
+
# Valid values are: space, no_space
|
975
|
+
EnforcedStyleForEmptyBraces: no_space
|
976
|
+
# Space between { and |. Overrides EnforcedStyle if there is a conflict.
|
977
|
+
SpaceBeforeBlockParameters: true
|
983
978
|
|
984
|
-
Style/
|
985
|
-
|
986
|
-
|
987
|
-
|
988
|
-
|
979
|
+
Style/SpaceInsideHashLiteralBraces:
|
980
|
+
EnforcedStyle: no_space
|
981
|
+
EnforcedStyleForEmptyBraces: no_space
|
982
|
+
SupportedStyles:
|
983
|
+
- space
|
984
|
+
- no_space
|
985
|
+
# 'compact' normally requires a space inside hash braces, with the exception
|
986
|
+
# that successive left braces or right braces are collapsed together
|
987
|
+
- compact
|
989
988
|
|
990
|
-
Style/
|
991
|
-
|
992
|
-
|
989
|
+
Style/SpaceInsideStringInterpolation:
|
990
|
+
EnforcedStyle: no_space
|
991
|
+
SupportedStyles:
|
992
|
+
- space
|
993
|
+
- no_space
|
993
994
|
|
994
|
-
Style/
|
995
|
-
|
996
|
-
|
997
|
-
|
998
|
-
|
999
|
-
Enabled: false
|
995
|
+
Style/SymbolArray:
|
996
|
+
EnforcedStyle: percent
|
997
|
+
SupportedStyles:
|
998
|
+
- percent
|
999
|
+
- brackets
|
1000
1000
|
|
1001
|
-
Style/
|
1002
|
-
|
1003
|
-
|
1001
|
+
Style/SymbolProc:
|
1002
|
+
# A list of method names to be ignored by the check.
|
1003
|
+
# The names should be fairly unique, otherwise you'll end up ignoring lots of code.
|
1004
|
+
IgnoredMethods:
|
1005
|
+
- respond_to
|
1006
|
+
- define_method
|
1007
|
+
|
1008
|
+
# NOT FULLY IMPLEMENTED YET
|
1009
|
+
# require_parentheses_when_complex
|
1010
|
+
Style/TernaryParentheses:
|
1011
|
+
EnforcedStyle: require_no_parentheses
|
1012
|
+
SupportedStyles:
|
1013
|
+
- require_parentheses
|
1014
|
+
- require_no_parentheses
|
1015
|
+
- require_parentheses_when_complex
|
1016
|
+
AllowSafeAssignment: true
|
1004
1017
|
|
1005
|
-
Style/
|
1006
|
-
|
1007
|
-
|
1008
|
-
|
1009
|
-
|
1010
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#spaces-around-equals'
|
1011
|
-
Enabled: false
|
1018
|
+
Style/TrailingBlankLines:
|
1019
|
+
EnforcedStyle: final_newline
|
1020
|
+
SupportedStyles:
|
1021
|
+
- final_newline
|
1022
|
+
- final_blank_line
|
1012
1023
|
|
1013
|
-
Style/
|
1014
|
-
|
1015
|
-
|
1016
|
-
|
1024
|
+
Style/TrailingCommaInArguments:
|
1025
|
+
# If `comma`, the cop requires a comma after the last argument, but only for
|
1026
|
+
# parenthesized method calls where each argument is on its own line.
|
1027
|
+
# If `consistent_comma`, the cop requires a comma after the last argument,
|
1028
|
+
# for all parenthesized method calls with arguments.
|
1029
|
+
EnforcedStyleForMultiline: no_comma
|
1030
|
+
SupportedStyles:
|
1031
|
+
- comma
|
1032
|
+
- consistent_comma
|
1033
|
+
- no_comma
|
1017
1034
|
|
1018
|
-
Style/
|
1019
|
-
|
1020
|
-
|
1021
|
-
|
1035
|
+
Style/TrailingCommaInLiteral:
|
1036
|
+
# If `comma`, the cop requires a comma after the last item in an array or
|
1037
|
+
# hash, but only when each item is on its own line.
|
1038
|
+
# If `consistent_comma`, the cop requires a comma after the last item of all
|
1039
|
+
# non-empty array and hash literals.
|
1040
|
+
EnforcedStyleForMultiline: no_comma
|
1041
|
+
SupportedStyles:
|
1042
|
+
- comma
|
1043
|
+
- consistent_comma
|
1044
|
+
- no_comma
|
1045
|
+
|
1046
|
+
# TrivialAccessors requires exact name matches and doesn't allow
|
1047
|
+
# predicated methods by default.
|
1048
|
+
Style/TrivialAccessors:
|
1049
|
+
# When set to false the cop will suggest the use of accessor methods
|
1050
|
+
# in situations like:
|
1051
|
+
#
|
1052
|
+
# def name
|
1053
|
+
# @other_name
|
1054
|
+
# end
|
1055
|
+
#
|
1056
|
+
# This way you can uncover "hidden" attributes in your code.
|
1057
|
+
ExactNameMatch: true
|
1058
|
+
AllowPredicates: true
|
1059
|
+
# Allows trivial writers that don't end in an equal sign. e.g.
|
1060
|
+
#
|
1061
|
+
# def on_exception(action)
|
1062
|
+
# @on_exception=action
|
1063
|
+
# end
|
1064
|
+
# on_exception :restart
|
1065
|
+
#
|
1066
|
+
# Commonly used in DSLs
|
1067
|
+
AllowDSLWriters: false
|
1068
|
+
IgnoreClassMethods: false
|
1069
|
+
Whitelist:
|
1070
|
+
- to_ary
|
1071
|
+
- to_a
|
1072
|
+
- to_c
|
1073
|
+
- to_enum
|
1074
|
+
- to_h
|
1075
|
+
- to_hash
|
1076
|
+
- to_i
|
1077
|
+
- to_int
|
1078
|
+
- to_io
|
1079
|
+
- to_open
|
1080
|
+
- to_path
|
1081
|
+
- to_proc
|
1082
|
+
- to_r
|
1083
|
+
- to_regexp
|
1084
|
+
- to_str
|
1085
|
+
- to_s
|
1086
|
+
- to_sym
|
1022
1087
|
|
1023
|
-
Style/
|
1024
|
-
|
1025
|
-
|
1026
|
-
|
1088
|
+
Style/VariableName:
|
1089
|
+
EnforcedStyle: snake_case
|
1090
|
+
SupportedStyles:
|
1091
|
+
- snake_case
|
1092
|
+
- camelCase
|
1093
|
+
|
1094
|
+
Style/VariableNumber:
|
1095
|
+
EnforcedStyle: normalcase
|
1096
|
+
SupportedStyles:
|
1097
|
+
- snake_case
|
1098
|
+
- normalcase
|
1099
|
+
- non_integer
|
1027
1100
|
|
1028
|
-
Style/
|
1029
|
-
|
1030
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-spaces-braces'
|
1031
|
-
Enabled: false
|
1101
|
+
Style/WhileUntilModifier:
|
1102
|
+
MaxLineLength: 80
|
1032
1103
|
|
1033
|
-
|
1034
|
-
|
1035
|
-
|
1036
|
-
|
1104
|
+
# WordArray enforces how array literals of word-like strings should be expressed.
|
1105
|
+
Style/WordArray:
|
1106
|
+
EnforcedStyle: percent
|
1107
|
+
SupportedStyles:
|
1108
|
+
# percent style: %w(word1 word2)
|
1109
|
+
- percent
|
1110
|
+
# bracket style: ['word1', 'word2']
|
1111
|
+
- brackets
|
1112
|
+
# The MinSize option causes the WordArray rule to be ignored for arrays
|
1113
|
+
# smaller than a certain size. The rule is only applied to arrays
|
1114
|
+
# whose element count is greater than or equal to MinSize.
|
1115
|
+
MinSize: 0
|
1116
|
+
# The regular expression WordRegex decides what is considered a word.
|
1117
|
+
WordRegex: !ruby/regexp '/\A[\p{Word}\n\t]+\z/'
|
1118
|
+
|
1119
|
+
##################### Metrics ##################################
|
1037
1120
|
|
1038
|
-
|
1039
|
-
|
1040
|
-
|
1041
|
-
|
1121
|
+
Metrics/AbcSize:
|
1122
|
+
# The ABC size is a calculated magnitude, so this number can be an Integer or
|
1123
|
+
# a Float.
|
1124
|
+
Max: 15
|
1042
1125
|
|
1043
|
-
|
1044
|
-
|
1045
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-cryptic-perlisms'
|
1046
|
-
Enabled: false
|
1126
|
+
Metrics/BlockNesting:
|
1127
|
+
Max: 3
|
1047
1128
|
|
1048
|
-
|
1049
|
-
|
1050
|
-
|
1051
|
-
Enabled: false
|
1129
|
+
Metrics/ClassLength:
|
1130
|
+
CountComments: false # count full line comments?
|
1131
|
+
Max: 100
|
1052
1132
|
|
1053
|
-
|
1054
|
-
|
1055
|
-
|
1056
|
-
strings match the configured preference.
|
1057
|
-
Enabled: false
|
1133
|
+
Metrics/ModuleLength:
|
1134
|
+
CountComments: false # count full line comments?
|
1135
|
+
Max: 100
|
1058
1136
|
|
1059
|
-
|
1060
|
-
|
1061
|
-
|
1062
|
-
Enabled: false
|
1137
|
+
# Avoid complex methods.
|
1138
|
+
Metrics/CyclomaticComplexity:
|
1139
|
+
Max: 6
|
1063
1140
|
|
1064
|
-
|
1065
|
-
|
1066
|
-
|
1141
|
+
Metrics/LineLength:
|
1142
|
+
Max: 120
|
1143
|
+
# To make it possible to copy or click on URIs in the code, we allow lines
|
1144
|
+
# containing a URI to be longer than Max.
|
1145
|
+
AllowHeredoc: true
|
1146
|
+
AllowURI: true
|
1147
|
+
URISchemes:
|
1148
|
+
- http
|
1149
|
+
- https
|
1150
|
+
# The IgnoreCopDirectives option causes the LineLength rule to ignore cop
|
1151
|
+
# directives like '# rubocop: enable ...' when calculating a line's length.
|
1152
|
+
IgnoreCopDirectives: false
|
1067
1153
|
|
1068
|
-
|
1069
|
-
|
1070
|
-
|
1154
|
+
Metrics/MethodLength:
|
1155
|
+
CountComments: false # count full line comments?
|
1156
|
+
Max: 10
|
1157
|
+
|
1158
|
+
Metrics/BlockLength:
|
1159
|
+
CountComments: false # count full line comments?
|
1160
|
+
Max: 25
|
1161
|
+
Exclude:
|
1162
|
+
- 'Rakefile'
|
1163
|
+
- '*.gemspec'
|
1164
|
+
- '**/*.rake'
|
1165
|
+
- 'spec/**/*.rb'
|
1071
1166
|
|
1072
|
-
|
1073
|
-
|
1074
|
-
|
1075
|
-
Enabled: false
|
1167
|
+
Metrics/ParameterLists:
|
1168
|
+
Max: 5
|
1169
|
+
CountKeywordArgs: true
|
1076
1170
|
|
1077
|
-
|
1078
|
-
|
1079
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#newline-eof'
|
1080
|
-
Enabled: false
|
1171
|
+
Metrics/PerceivedComplexity:
|
1172
|
+
Max: 7
|
1081
1173
|
|
1082
|
-
|
1083
|
-
Description: 'Checks for trailing comma in parameter lists.'
|
1084
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-params-comma'
|
1085
|
-
Enabled: false
|
1174
|
+
##################### Lint ##################################
|
1086
1175
|
|
1087
|
-
|
1088
|
-
|
1089
|
-
|
1090
|
-
Enabled: false
|
1176
|
+
# Allow safe assignment in conditions.
|
1177
|
+
Lint/AssignmentInCondition:
|
1178
|
+
AllowSafeAssignment: true
|
1091
1179
|
|
1092
|
-
|
1093
|
-
|
1094
|
-
|
1095
|
-
|
1180
|
+
# checks whether the end keywords are aligned properly for `do` `end` blocks.
|
1181
|
+
Lint/BlockAlignment:
|
1182
|
+
# The value `start_of_block` means that the `end` should be aligned with line
|
1183
|
+
# where the `do` keyword appears.
|
1184
|
+
# The value `start_of_line` means it should be aligned with the whole
|
1185
|
+
# expression's starting line.
|
1186
|
+
# The value `either` means both are allowed.
|
1187
|
+
AlignWith: either
|
1188
|
+
SupportedStyles:
|
1189
|
+
- either
|
1190
|
+
- start_of_block
|
1191
|
+
- start_of_line
|
1192
|
+
|
1193
|
+
# Align ends correctly.
|
1194
|
+
Lint/EndAlignment:
|
1195
|
+
# The value `keyword` means that `end` should be aligned with the matching
|
1196
|
+
# keyword (if, while, etc.).
|
1197
|
+
# The value `variable` means that in assignments, `end` should be aligned
|
1198
|
+
# with the start of the variable on the left hand side of `=`. In all other
|
1199
|
+
# situations, `end` should still be aligned with the keyword.
|
1200
|
+
# The value `start_of_line` means that `end` should be aligned with the start
|
1201
|
+
# of the line which the matching keyword appears on.
|
1202
|
+
AlignWith: keyword
|
1203
|
+
SupportedStyles:
|
1204
|
+
- keyword
|
1205
|
+
- variable
|
1206
|
+
- start_of_line
|
1207
|
+
AutoCorrect: false
|
1096
1208
|
|
1097
|
-
|
1098
|
-
|
1099
|
-
|
1100
|
-
|
1209
|
+
Lint/DefEndAlignment:
|
1210
|
+
# The value `def` means that `end` should be aligned with the def keyword.
|
1211
|
+
# The value `start_of_line` means that `end` should be aligned with method
|
1212
|
+
# calls like `private`, `public`, etc, if present in front of the `def`
|
1213
|
+
# keyword on the same line.
|
1214
|
+
AlignWith: start_of_line
|
1215
|
+
SupportedStyles:
|
1216
|
+
- start_of_line
|
1217
|
+
- def
|
1218
|
+
AutoCorrect: false
|
1219
|
+
|
1220
|
+
Lint/InheritException:
|
1221
|
+
# The default base class in favour of `Exception`.
|
1222
|
+
EnforcedStyle: standard_error
|
1223
|
+
SupportedStyles:
|
1224
|
+
- runtime_error
|
1225
|
+
- standard_error
|
1226
|
+
|
1227
|
+
# Checks for unused block arguments
|
1228
|
+
Lint/UnusedBlockArgument:
|
1229
|
+
IgnoreEmptyBlocks: true
|
1230
|
+
AllowUnusedKeywordArguments: false
|
1101
1231
|
|
1102
|
-
|
1103
|
-
|
1104
|
-
|
1105
|
-
|
1106
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-else-with-unless'
|
1107
|
-
Enabled: false
|
1232
|
+
# Checks for unused method arguments.
|
1233
|
+
Lint/UnusedMethodArgument:
|
1234
|
+
IgnoreEmptyMethods: true
|
1235
|
+
AllowUnusedKeywordArguments: false
|
1108
1236
|
|
1109
|
-
|
1110
|
-
Description: 'Checks for %W when interpolation is not needed.'
|
1111
|
-
Enabled: false
|
1237
|
+
##################### Performance ############################
|
1112
1238
|
|
1113
|
-
|
1114
|
-
|
1115
|
-
|
1116
|
-
Enabled: false
|
1239
|
+
Performance/RedundantMerge:
|
1240
|
+
# Max number of key-value pairs to consider an offense
|
1241
|
+
MaxKeyValuePairs: 2
|
1117
1242
|
|
1118
|
-
|
1119
|
-
Description: >-
|
1120
|
-
Checks for the usage of unneeded trailing underscores at the
|
1121
|
-
end of parallel variable assignment.
|
1122
|
-
Enabled: false
|
1243
|
+
##################### Rails ##################################
|
1123
1244
|
|
1124
|
-
|
1125
|
-
|
1126
|
-
|
1127
|
-
|
1128
|
-
|
1129
|
-
|
1245
|
+
Rails/ActionFilter:
|
1246
|
+
EnforcedStyle: action
|
1247
|
+
SupportedStyles:
|
1248
|
+
- action
|
1249
|
+
- filter
|
1250
|
+
Include:
|
1251
|
+
- app/controllers/**/*.rb
|
1130
1252
|
|
1131
|
-
|
1132
|
-
|
1133
|
-
|
1134
|
-
|
1253
|
+
Rails/Date:
|
1254
|
+
# The value `strict` disallows usage of `Date.today`, `Date.current`,
|
1255
|
+
# `Date#to_time` etc.
|
1256
|
+
# The value `flexible` allows usage of `Date.current`, `Date.yesterday`, etc
|
1257
|
+
# (but not `Date.today`) which are overridden by ActiveSupport to handle current
|
1258
|
+
# time zone.
|
1259
|
+
EnforcedStyle: flexible
|
1260
|
+
SupportedStyles:
|
1261
|
+
- strict
|
1262
|
+
- flexible
|
1263
|
+
|
1264
|
+
Rails/DynamicFindBy:
|
1265
|
+
Whitelist:
|
1266
|
+
- find_by_sql
|
1267
|
+
|
1268
|
+
# NOT IMPLEMENTED YET
|
1269
|
+
# Rails/EnumUniqueness:
|
1270
|
+
# Include:
|
1271
|
+
# - app/models/**/*.rb
|
1272
|
+
|
1273
|
+
Rails/Exit:
|
1274
|
+
Include:
|
1275
|
+
- app/**/*.rb
|
1276
|
+
- config/**/*.rb
|
1277
|
+
- lib/**/*.rb
|
1278
|
+
Exclude:
|
1279
|
+
- lib/**/*.rake
|
1135
1280
|
|
1136
|
-
|
1137
|
-
|
1138
|
-
|
1139
|
-
Enabled: false
|
1281
|
+
Rails/FindBy:
|
1282
|
+
Include:
|
1283
|
+
- app/models/**/*.rb
|
1140
1284
|
|
1141
|
-
|
1142
|
-
|
1143
|
-
|
1144
|
-
Enabled: false
|
1285
|
+
Rails/FindEach:
|
1286
|
+
Include:
|
1287
|
+
- app/models/**/*.rb
|
1145
1288
|
|
1146
|
-
|
1147
|
-
|
1148
|
-
|
1149
|
-
single-line body.
|
1150
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#while-as-a-modifier'
|
1151
|
-
Enabled: false
|
1289
|
+
Rails/HasAndBelongsToMany:
|
1290
|
+
Include:
|
1291
|
+
- app/models/**/*.rb
|
1152
1292
|
|
1153
|
-
|
1154
|
-
|
1155
|
-
|
1156
|
-
|
1293
|
+
Rails/NotNullColumn:
|
1294
|
+
Include:
|
1295
|
+
- db/migrate/*.rb
|
1296
|
+
|
1297
|
+
Rails/Output:
|
1298
|
+
Include:
|
1299
|
+
- app/**/*.rb
|
1300
|
+
- config/**/*.rb
|
1301
|
+
- db/**/*.rb
|
1302
|
+
- lib/**/*.rb
|
1303
|
+
|
1304
|
+
Rails/ReadWriteAttribute:
|
1305
|
+
Include:
|
1306
|
+
- app/models/**/*.rb
|
1307
|
+
|
1308
|
+
Rails/RequestReferer:
|
1309
|
+
EnforcedStyle: referer
|
1310
|
+
SupportedStyles:
|
1311
|
+
- referer
|
1312
|
+
- referrer
|
1313
|
+
|
1314
|
+
Rails/SafeNavigation:
|
1315
|
+
# This will convert usages of `try` to use safe navigation as well as `try!`.
|
1316
|
+
# `try` and `try!` work slighly differently. `try!` and safe navigation will
|
1317
|
+
# both raise a `NoMethodError` if the receiver of the method call does not
|
1318
|
+
# implement the intended method. `try` will not raise an exception for this.
|
1319
|
+
ConvertTry: false
|
1320
|
+
|
1321
|
+
Rails/ScopeArgs:
|
1322
|
+
Include:
|
1323
|
+
- app/models/**/*.rb
|
1324
|
+
|
1325
|
+
Rails/TimeZone:
|
1326
|
+
# The value `strict` means that `Time` should be used with `zone`.
|
1327
|
+
# The value `flexible` allows usage of `in_time_zone` instead of `zone`.
|
1328
|
+
EnforcedStyle: flexible
|
1329
|
+
SupportedStyles:
|
1330
|
+
- strict
|
1331
|
+
- flexible
|
1332
|
+
|
1333
|
+
Rails/UniqBeforePluck:
|
1334
|
+
EnforcedMode: conservative
|
1335
|
+
SupportedModes:
|
1336
|
+
- conservative
|
1337
|
+
- aggressive
|
1338
|
+
AutoCorrect: false
|
1339
|
+
|
1340
|
+
Rails/Validation:
|
1341
|
+
Include:
|
1342
|
+
- app/models/**/*.rb
|