-
Notifications
You must be signed in to change notification settings - Fork 0
/
.rubocop.yml
282 lines (225 loc) · 7.89 KB
/
.rubocop.yml
1
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
AllCops:
DisabledByDefault: true
Include:
- "**/Gemfile"
- "**/lib/**/*"
- "**/test/**/*"
- "**/bin/**"
- "**.rb"
Exclude:
- "**/*.yml"
- "**/*.py"
- "bin/bump_version"
TargetRubyVersion: 2.7
#################### Layout ################################
Layout/BlockAlignment:
Description: "Align block ends correctly."
Enabled: true
Layout/ConditionPosition:
Description: >-
Checks for condition placed in a confusing position relative to
the keyword.
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#same-line-condition"
Enabled: true
Layout/DefEndAlignment:
Description: "Align ends corresponding to defs correctly."
Enabled: true
Layout/EndAlignment:
Description: "Align ends correctly."
Enabled: true
EnforcedStyleAlignWith: variable
Layout/IndentationConsistency:
Description: "Indents remain consistent throughout blocks"
Enabled: true
Layout/AccessModifierIndentation:
Description: "Access Modifiers (e.g. private) are indented correctly"
Enabled: true
Layout/RescueEnsureAlignment:
Description: "Aligns rescue and begin blocks"
Enabled: true
#################### Style ################################
Style/StringLiterals:
Description: "String literals use double quotes"
EnforcedStyle: double_quotes
Enabled: true
#################### Lint ################################
Lint/AmbiguousOperator:
Description: >-
Checks for ambiguous operators in the first argument of a
method invocation without parentheses.
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#parens-as-args"
Enabled: true
Lint/AmbiguousRegexpLiteral:
Description: >-
Checks for ambiguous regexp literals in the first argument of
a method invocation without parenthesis.
Enabled: true
Lint/AssignmentInCondition:
Description: "Don't use assignment in conditions."
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#safe-assignment-in-condition"
Enabled: true
Lint/CircularArgumentReference:
Description: "Don't refer to the keyword argument in the default value."
Enabled: true
Lint/Debugger:
Description: "Check for debugger calls."
Enabled: true
Lint/DeprecatedClassMethods:
Description: "Check for deprecated class method calls."
Enabled: true
Lint/DuplicateMethods:
Description: "Check for duplicate methods calls."
Enabled: true
Lint/EachWithObjectArgument:
Description: "Check for immutable argument given to each_with_object."
Enabled: true
Lint/ElseLayout:
Description: "Check for odd code arrangement in an else block."
Enabled: true
Lint/EmptyEnsure:
Description: "Checks for empty ensure block."
Enabled: true
Lint/EmptyInterpolation:
Description: "Checks for empty string interpolation."
Enabled: true
Style/EndBlock:
Description: "END blocks should not be placed inside method definitions."
Enabled: true
Lint/EnsureReturn:
Description: "Do not use return in an ensure block."
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#no-return-ensure"
Enabled: true
Lint/FormatParameterMismatch:
Description: "The number of parameters to format/sprint must match the fields."
Enabled: true
Lint/SuppressedException:
Description: "Don't suppress exception."
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#dont-hide-exceptions"
Enabled: true
Lint/LiteralAsCondition:
Description: "Checks of literals used in conditions."
Enabled: true
Lint/LiteralInInterpolation:
Description: "Checks for literals used in interpolation."
Enabled: true
Lint/Loop:
Description: >-
Use Kernel#loop with break rather than begin/end/until or
begin/end/while for post-loop tests.
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#loop-with-break"
Enabled: true
Lint/NestedMethodDefinition:
Description: "Do not use nested method definitions."
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#no-nested-methods"
Enabled: true
Lint/NonLocalExitFromIterator:
Description: "Do not use return in iterator to cause non-local exit."
Enabled: true
Lint/ParenthesesAsGroupedExpression:
Description: >-
Checks for method calls with a space before the opening
parenthesis.
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#parens-no-spaces"
Enabled: true
Lint/RequireParentheses:
Description: >-
Use parentheses in the method call to avoid confusion
about precedence.
Enabled: true
Lint/RescueException:
Description: "Avoid rescuing the Exception class."
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#no-blind-rescues"
Enabled: true
Lint/ShadowingOuterLocalVariable:
Description: >-
Do not use the same name as outer local variable
for block arguments or block local variables.
Enabled: true
Lint/RedundantStringCoercion:
Description: "Checks for Object#to_s usage in string interpolation."
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#no-to-s"
Enabled: true
Lint/UnderscorePrefixedVariableName:
Description: "Do not use prefix `_` for a variable that is used."
Enabled: true
Lint/RedundantCopDisableDirective:
Description: >-
Checks for rubocop:disable comments that can be removed.
Note: this cop is not disabled when disabling all cops.
It must be explicitly disabled.
Enabled: true
Lint/UnusedBlockArgument:
Description: "Checks for unused block arguments."
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#underscore-unused-vars"
Enabled: true
Lint/UnusedMethodArgument:
Description: "Checks for unused method arguments."
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#underscore-unused-vars"
Enabled: true
Lint/UnreachableCode:
Description: "Unreachable code."
Enabled: true
Lint/UselessAccessModifier:
Description: "Checks for useless access modifiers."
Enabled: true
Lint/UselessAssignment:
Description: "Checks for useless assignment to a local variable."
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#underscore-unused-vars"
Enabled: true
Lint/BinaryOperatorWithIdenticalOperands:
Description: "Checks for comparison of something with itself."
Enabled: true
Lint/UselessElseWithoutRescue:
Description: "Checks for useless `else` in `begin..end` without `rescue`."
Enabled: true
Lint/UselessSetterCall:
Description: "Checks for useless setter call to a local variable."
Enabled: true
Lint/Void:
Description: "Possible use of operator/literal/variable in void context."
Enabled: true
###################### Metrics ####################################
Metrics/AbcSize:
Description: >-
A calculated magnitude based on number of assignments,
branches, and conditions.
Reference: "http://c2.com/cgi/wiki?AbcMetric"
Enabled: false
Max: 20
Metrics/BlockNesting:
Description: "Avoid excessive block nesting"
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#three-is-the-number-thou-shalt-count"
Enabled: true
Max: 4
Metrics/ClassLength:
Description: "Avoid classes longer than 250 lines of code."
Enabled: true
Max: 250
Metrics/CyclomaticComplexity:
Description: >-
A complexity metric that is strongly correlated to the number
of test cases needed to validate a method.
Enabled: true
Layout/LineLength:
Description: "Limit lines to 80 characters."
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#80-character-limits"
Enabled: true
Max: 115
Metrics/MethodLength:
Description: "Avoid methods longer than 30 lines of code."
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#short-methods"
Enabled: true
Max: 30
Metrics/ModuleLength:
Description: "Avoid modules longer than 250 lines of code."
Enabled: true
Max: 250
Metrics/ParameterLists:
Description: "Avoid parameter lists longer than three or four parameters."
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#too-many-params"
Enabled: true
Metrics/PerceivedComplexity:
Description: >-
A complexity metric geared towards measuring complexity for a
human reader.
Enabled: false