This repository has been archived by the owner on Dec 30, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
.rubocop.yml
348 lines (281 loc) · 7.57 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
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
require: rubocop-rspec
# TARIC & CHIEF have long variable names, allow longer lines for our sanity
Metrics/LineLength:
Max: 180
Documentation:
Enabled: false
Style/FrozenStringLiteralComment:
Enabled: false
############
## General https://raw.githubusercontent.com/alphagov/styleguides/master/ruby-styleguide/rubocop/gds-ruby-styleguide.yml
############
BlockAlignment:
Description: 'Align block ends correctly.'
Enabled: true
CaseIndentation:
Description: Indentation of when in a case/when/[else/]end.
Enabled: true
EnforcedStyle: case
SupportedStyles:
- case
- end
IndentOneStep: false
Layout/ClosingParenthesisIndentation:
Description: 'Checks the indentation of hanging closing parentheses.'
Enabled: false
Style/MutableConstant:
Description: 'Freeze mutable objects assigned to constants.'
Enabled: true
ElseLayout:
Description: 'Check for odd code arrangement in an else block.'
Enabled: true
# Supports --auto-correct
EmptyLineBetweenDefs:
Description: Use empty lines between defs.
Enabled: true
AllowAdjacentOneLineDefs: false
EmptyLines:
Description: "Don't use several empty lines in a row."
Enabled: true
EndAlignment:
Description: 'Align ends correctly.'
Enabled: true
EndOfLine:
Description: 'Use Unix-style line endings.'
Enabled: true
# Supports --auto-correct
IndentationWidth:
Description: Use 2 spaces for indentation.
Enabled: true
# Supports --auto-correct
IndentationConsistency:
Description: Keep indentation straight.
Enabled: true
LineLength:
Description: Limit lines to 80 characters.
Enabled: false
Max: 80
# Supports --auto-correct
SpaceAroundOperators:
Description: Use spaces around operators.
Enabled: true
# Supports --auto-correct
SpaceBeforeBlockBraces:
Description: Checks that the left block brace has or doesn't have space before it.
Enabled: true
EnforcedStyle: space
SupportedStyles:
- space
- no_space
# Supports --auto-correct
SpaceAfterSemicolon:
Description: Use spaces after semicolons.
Enabled: true
# Supports --auto-correct
SpaceAfterColon:
Description: Use spaces after colons.
Enabled: true
# Supports --auto-correct
SpaceAfterComma:
Description: Use spaces after commas.
Enabled: true
# Supports --auto-correct
SpaceInsideReferenceBrackets:
Description: No spaces after array[ or before ].
Enabled: true
# Supports --auto-correct
SpaceInsideArrayLiteralBrackets:
Description: No spaces after array = [ or before ].
Enabled: true
# Supports --auto-correct
SpaceInsideParens:
Description: No spaces after ( or before ).
Enabled: true
Tab:
Description: No hard tabs.
Enabled: true
# Supports --auto-correct
TrailingWhitespace:
Description: Avoid trailing whitespace.
Enabled: true
# Supports --auto-correct
TrailingBlankLines:
Description: Checks trailing blank lines and final newline.
Enabled: true
EnforcedStyle: final_newline
SupportedStyles:
- final_newline
- final_blank_line
## Syntax
# Supports --auto-correct
AndOr:
Description: Use &&/|| instead of and/or.
Enabled: true
# Supports --auto-correct
DefWithParentheses:
Description: Use def with parentheses when there are arguments.
Enabled: true
For:
Description: Checks use of for or each in multiline loops.
Enabled: true
EnforcedStyle: each
SupportedStyles:
- for
- each
IfUnlessModifier:
Description: Favor modifier if/unless usage when you have a single-line body.
Enabled: false
MethodCalledOnDoEndBlock:
Description: Avoid chaining a method call on a do...end block.
Enabled: true
MethodCallWithoutArgsParentheses:
Description: 'Do not use parentheses for method calls with no arguments.'
Enabled: true
MultilineBlockChain:
Description: Avoid multi-line chains of blocks.
Enabled: true
MultilineIfThen:
Description: Never use then for multi-line if/unless.
Enabled: true
MultilineTernaryOperator:
Description: 'Avoid multi-line ?: (the ternary operator); use if/unless instead.'
Enabled: true
NestedTernaryOperator:
Description: Use one expression per branch in a ternary operator.
Enabled: true
OneLineConditional:
Description: Favor the ternary operator(?:) over if/then/else/end constructs.
Enabled: true
# Supports --auto-correct
ParenthesesAroundCondition:
Description: Don't use parentheses around the condition of an if/unless/while.
Enabled: true
AllowSafeAssignment: true
# Supports --auto-correct
RedundantReturn:
Description: Don't use return where it's not required.
Enabled: true
AllowMultipleReturnValues: false
# Supports --auto-correct
SpaceAfterMethodName:
Description: Never put a space between a method name and the opening parenthesis in
a method definition.
Enabled: true
# Supports --auto-correct
SpaceAroundEqualsInParameterDefault:
Description: Checks that the equals signs in parameter default assignments have or
don't have surrounding space depending on configuration.
Enabled: true
EnforcedStyle: space
SupportedStyles:
- space
- no_space
UnlessElse:
Description: Never use unless with else. Rewrite these with the positive case first.
Enabled: true
# Supports --auto-correct
UnusedBlockArgument:
Description: Checks for unused block arguments.
Enabled: true
## Naming
ClassAndModuleCamelCase:
Description: Use CamelCase for classes and modules.
Enabled: true
# Supports --auto-correct
ClassMethods:
Description: Use self when defining module/class methods.
Enabled: true
ClassVars:
Description: Avoid the use of class variables.
Enabled: true
ConstantName:
Description: Constants should use SCREAMING_SNAKE_CASE.
Enabled: true
MethodName:
Description: Use the configured style when naming methods.
Enabled: true
EnforcedStyle: snake_case
SupportedStyles:
- snake_case
- camelCase
# Supports --auto-correct
TrivialAccessors:
Description: Prefer attr_* methods to trivial readers/writers.
Enabled: true
ExactNameMatch: true
AllowPredicates: true
AllowDSLWriters: false
Whitelist:
- to_ary
- to_a
- to_c
- to_enum
- to_h
- to_hash
- to_i
- to_int
- to_io
- to_open
- to_path
- to_proc
- to_r
- to_regexp
- to_str
- to_s
- to_sym
VariableName:
Description: Use the configured style when naming variables.
Enabled: true
EnforcedStyle: snake_case
SupportedStyles:
- snake_case
- camelCase
## Exceptions
# Supports --auto-correct
RescueException:
Description: Avoid rescuing the Exception class.
Enabled: true
## Collections
# Supports --auto-correct
AlignArray:
Description: Align the elements of an array literal if they span more than one line.
Enabled: true
# Supports --auto-correct
HashSyntax:
Description: 'Prefer Ruby 1.9 hash syntax { a: 1, b: 2 } over 1.8 syntax { :a => 1,
:b => 2 }.'
Enabled: true
Exclude:
- 'db/schema.rb'
EnforcedStyle: ruby19
SupportedStyles:
- ruby19
- hash_rockets
TrailingCommaInArrayLiteral:
Enabled: false
EnforcedStyleForMultiline: comma
TrailingCommaInHashLiteral:
Enabled: false
EnforcedStyleForMultiline: comma
TrailingCommaInArguments:
Enabled: false
# Supports --auto-correct
WordArray:
Description: Use %w or %W for arrays of words.
Enabled: true
MinSize: 0
MultilineMethodCallIndentation:
Enabled: false
## Strings
# Supports --auto-correct
StringConversionInInterpolation:
Description: Checks for Object#to_s usage in string interpolation.
Enabled: true
# Supports --auto-correct
StringLiterals:
Description: Checks if uses of quotes match the configured preference.
Enabled: false
EnforcedStyle: double_quotes
SupportedStyles:
- single_quotes
- double_quotes