-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy path.rubocop.yml
316 lines (238 loc) · 7.59 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
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
require:
- rubocop-performance
- rubocop-rake
- rubocop-rspec
AllCops:
TargetRubyVersion: 2.5
DisplayCopNames: true
DisabledByDefault: true
Exclude:
- db/migrate/**/*
##################### Layout ##################################
Layout/TrailingEmptyLines:
Enabled: true
Layout/TrailingWhitespace:
Enabled: true
Layout/SpaceAfterComma:
Enabled: true
Layout/SpaceBeforeBlockBraces:
Enabled: true
Layout/SpaceInsideBlockBraces:
Enabled: true
Layout/SpaceInsideHashLiteralBraces:
Enabled: true
Layout/EmptyLineBetweenDefs:
Enabled: true
Layout/EmptyLines:
Enabled: true
Layout/EmptyLinesAroundAccessModifier:
Enabled: true
Layout/EmptyLinesAroundModuleBody:
Enabled: true
##################### Style ##################################
Style/HashSyntax:
Enabled: true
Style/StringLiterals:
Enabled: true
Style/StringLiteralsInInterpolation:
Enabled: true
Style/FrozenStringLiteralComment:
Enabled: true
##################### Performance ############################
# Use `casecmp` rather than `downcase ==`.
Performance/Casecmp:
Enabled: true
# Use `str.{start,end}_with?(x, ..., y, ...)` instead of
# `str.{start,end}_with?(x, ...) || str.{start,end}_with?(y, ...)`.
Performance/DoubleStartEndWith:
Enabled: true
# Use `end_with?` instead of a regex match anchored to the end of a string.
Performance/EndWith:
Enabled: true
# Use `strip` instead of `lstrip.rstrip`.
Style/Strip:
Enabled: true
# Use `Range#cover?` instead of `Range#include?`.
Performance/RangeInclude:
Enabled: true
# Use `yield` instead of `block.call`.
Performance/RedundantBlockCall:
Enabled: true
# Use `=~` instead of `String#match` or `Regexp#match` in a context where the
# returned `MatchData` is not needed.
Performance/RedundantMatch:
Enabled: true
# Use `Hash#[]=`, rather than `Hash#merge!` with a single key-value pair.
Performance/RedundantMerge:
# Max number of key-value pairs to consider an offense
MaxKeyValuePairs: 2
Enabled: true
# Use `sort` instead of `sort_by { |x| x }`.
Style/RedundantSortBy:
Enabled: true
# Use `start_with?` instead of a regex match anchored to the beginning of a
# string.
Performance/StartWith:
Enabled: true
# Use `tr` instead of `gsub` when you are replacing the same number of
# characters. Use `delete` instead of `gsub` when you are deleting
# characters.
Performance/StringReplacement:
Enabled: true
# Checks for `.times.map` calls.
Performance/TimesMap:
Enabled: true
############################ Security ###############################################
# This cop checks for the use of JSON class methods which have potential
# security issues.
Security/JSONLoad:
Enabled: true
# This cop checks for the use of *Kernel#eval*.
Security/Eval:
Enabled: true
############################ Lint #############################################
# Checks for ambiguous operators in the first argument of a method invocation
# without parentheses.
Lint/AmbiguousOperator:
Enabled: true
# This cop checks for ambiguous regexp literals in the first argument of
# a method invocation without parentheses.
Lint/AmbiguousRegexpLiteral:
Enabled: true
# This cop checks for assignments in the conditions of
# if/while/until.
Lint/AssignmentInCondition:
Enabled: true
# Align block ends correctly.
Layout/BlockAlignment:
Enabled: true
# Default values in optional keyword arguments and optional ordinal arguments
# should not refer back to the name of the argument.
Lint/CircularArgumentReference:
Enabled: true
# Checks for condition placed in a confusing position relative to the keyword.
Layout/ConditionPosition:
Enabled: true
# Check for debugger calls.
Lint/Debugger:
Enabled: true
# Align ends corresponding to defs correctly.
Layout/DefEndAlignment:
Enabled: true
# Check for deprecated class method calls.
Lint/DeprecatedClassMethods:
Enabled: true
# Check for immutable argument given to each_with_object.
Lint/EachWithObjectArgument:
Enabled: true
# Check for odd code arrangement in an else block.
Lint/ElseLayout:
Enabled: false
# Checks for empty ensure block.
Lint/EmptyEnsure:
Enabled: true
# Checks for the presence of `when` branches without a body.
Lint/EmptyWhen:
Enabled: true
# Align ends correctly.
Layout/EndAlignment:
Enabled: true
# END blocks should not be placed inside method definitions.
Style/EndBlock:
Enabled: true
# Do not use return in an ensure block.
Lint/EnsureReturn:
Enabled: true
# Catches floating-point literals too large or small for Ruby to represent.
Lint/FloatOutOfRange:
Enabled: true
# The number of parameters to format/sprint must match the fields.
Lint/FormatParameterMismatch:
Enabled: true
# This cop checks for *rescue* blocks with no body.
Lint/SuppressedException:
Enabled: true
# Checks for adjacent string literals on the same line, which could better be
# represented as a single string literal.
Lint/ImplicitStringConcatenation:
Enabled: false
# Checks for attempts to use `private` or `protected` to set the visibility
# of a class method, which does not work.
Lint/IneffectiveAccessModifier:
Enabled: false
# Checks for literals used in interpolation.
Lint/LiteralInInterpolation:
Enabled: false
# This cop checks for uses of *begin...end while/until something*.
Lint/Loop:
Enabled: false
# Do not use nested method definitions.
Lint/NestedMethodDefinition:
Enabled: false
# Do not omit the accumulator when calling `next` in a `reduce`/`inject` block.
Lint/NextWithoutAccumulator:
Enabled: false
# Checks for method calls with a space before the opening parenthesis.
Lint/ParenthesesAsGroupedExpression:
Enabled: false
# Checks for `rand(1)` calls. Such calls always return `0` and most likely
# a mistake.
Lint/RandOne:
Enabled: false
# Use parentheses in the method call to avoid confusion about precedence.
Lint/RequireParentheses:
Enabled: false
# Avoid rescuing the Exception class.
Lint/RescueException:
Enabled: false
# Checks for the order which exceptions are rescued to avoid rescueing a less specific exception before a more specific exception.
Lint/ShadowedException:
Enabled: false
# This cop looks for use of the same name as outer local variables
# for block arguments or block local variables.
Lint/ShadowingOuterLocalVariable:
Enabled: false
# Checks for Object#to_s usage in string interpolation.
Lint/RedundantStringCoercion:
Enabled: false
# Do not use prefix `_` for a variable that is used.
Lint/UnderscorePrefixedVariableName:
Enabled: false
# This cop checks for using Fixnum or Bignum constant
Lint/UnifiedInteger:
Enabled: false
# Checks for rubocop:disable comments that can be removed.
# Note: this cop is not disabled when disabling all cops.
# It must be explicitly disabled.
Lint/RedundantCopDisableDirective:
Enabled: false
# This cop checks for unneeded usages of splat expansion
Lint/RedundantSplatExpansion:
Enabled: false
# Unreachable code.
Lint/UnreachableCode:
Enabled: true
# This cop checks for unused block arguments.
Lint/UnusedBlockArgument:
Enabled: false
# This cop checks for unused method arguments.
Lint/UnusedMethodArgument:
Enabled: false
# Checks for useless access modifiers.
Lint/UselessAccessModifier:
Enabled: false
# Checks for useless assignment to a local variable.
Lint/UselessAssignment:
Enabled: false
# Checks for comparison of something with itself.
Lint/BinaryOperatorWithIdenticalOperands:
Enabled: false
# Checks for useless `else` in `begin..end` without `rescue`.
Lint/UselessElseWithoutRescue:
Enabled: false
# Checks for useless setter call to a local variable.
Lint/UselessSetterCall:
Enabled: false
# Possible use of operator/literal/variable in void context.
Lint/Void:
Enabled: false