-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrubocop.yml
More file actions
301 lines (272 loc) · 8.97 KB
/
rubocop.yml
File metadata and controls
301 lines (272 loc) · 8.97 KB
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
# The behavior of RuboCop can be controlled via the .rubocop.yml
# configuration file. It makes it possible to enable/disable
# certain cops (checks) and to alter their behavior if they accept
# any parameters. The file can be placed either in your home
# directory or in some project directory.
#
# RuboCop will start looking for the configuration file in the directory
# where the inspected file is and continue its way up to the root directory.
#
# See https://github.com/rubocop-hq/rubocop/blob/master/manual/configuration.md
#
# For defaults, see https://github.com/rubocop-hq/rubocop/blob/master/config/default.yml
#AllCops:
# Exclude:
# - 'bin/**/*'
# - 'db/schema.rb'
#################### Rails ###############################
AllCops:
Exclude:
- 'bin/**/*'
- 'node_modules/**/*'
- 'vendor/**/*'
- 'db/schema.rb'
#################### Bundler ###############################
Bundler/OrderedGems:
Description: >-
Gems within groups in the Gemfile should be alphabetically sorted.
Enabled: false
VersionAdded: '0.46'
VersionChanged: '0.47'
TreatCommentsAsGroupSeparators: true
Include:
- '**/*.gemfile'
- '**/Gemfile'
- '**/gems.rb'
#################### Layout ###########################
Layout/ArgumentAlignment:
Description: >-
Align the arguments of a method call if they span more
than one line.
StyleGuide: '#no-double-indent'
Enabled: true
VersionAdded: '0.68'
VersionChanged: '0.77'
# Alignment of arguments in multi-line method calls.
#
# The `with_first_argument` style aligns the following lines along the same
# column as the first parameter.
#
# method_call(a,
# b)
#
# The `with_fixed_indentation` style aligns the following lines with one
# level of indentation relative to the start of the line with the method call.
#
# method_call(a,
# b)
EnforcedStyle: with_fixed_indentation
SupportedStyles:
- with_first_argument
- with_fixed_indentation
# By default, the indentation width from Layout/IndentationWidth is used
# But it can be overridden by setting this parameter
IndentationWidth: ~
Layout/LineLength:
Description: 'Limit lines to 80 characters.'
StyleGuide: '#80-character-limits'
Enabled: true
VersionAdded: '0.25'
VersionChanged: '0.78'
AutoCorrect: false
Max: 120
# To make it possible to copy or click on URIs in the code, we allow lines
# containing a URI to be longer than Max.
AllowHeredoc: true
AllowURI: true
URISchemes:
- http
- https
# The IgnoreCopDirectives option causes the LineLength rule to ignore cop
# directives like '# rubocop: enable ...' when calculating a line's length.
IgnoreCopDirectives: true
# The IgnoredPatterns option is a list of !ruby/regexp and/or string
# elements. Strings will be converted to Regexp objects. A line that matches
# any regular expression listed in this option will be ignored by LineLength.
IgnoredPatterns: []
#################### Metrics ###############################
Metrics/AbcSize:
Description: >-
A calculated magnitude based on number of assignments,
branches, and conditions.
Reference:
- http://c2.com/cgi/wiki?AbcMetric
- https://en.wikipedia.org/wiki/ABC_Software_Metric
Enabled: false
VersionAdded: '0.27'
VersionChanged: '0.66'
# The ABC size is a calculated magnitude, so this number can be an Integer or
# a Float.
Max: 15
Metrics/MethodLength:
Description: 'Avoid methods longer than 10 lines of code.'
StyleGuide: '#short-methods'
Enabled: true
VersionAdded: '0.25'
VersionChanged: '0.59.2'
CountComments: false # count full line comments?
Max: 25
ExcludedMethods: []
##################### Naming ##############################
Naming/RescuedExceptionsVariableName:
Description: 'Use consistent rescued exceptions variables naming.'
Enabled: true
VersionAdded: '0.67'
VersionChanged: '0.68'
PreferredName: exception
#################### Style ###############################
Style/BlockComments:
Description: 'Do not use block comments.'
StyleGuide: '#no-block-comments'
Enabled: false
VersionAdded: '0.9'
VersionChanged: '0.23'
Style/ClassAndModuleChildren:
Description: 'Checks style of children classes and modules.'
StyleGuide: '#namespace-definition'
# Moving from compact to nested children requires knowledge of whether the
# outer parent is a module or a class. Moving from nested to compact requires
# verification that the outer parent is defined elsewhere. Rubocop does not
# have the knowledge to perform either operation safely and thus requires
# manual oversight.
SafeAutoCorrect: false
AutoCorrect: false
Enabled: false
VersionAdded: '0.19'
#
# Basically there are two different styles:
#
# `nested` - have each child on a separate line
# class Foo
# class Bar
# end
# end
#
# `compact` - combine definitions as much as possible
# class Foo::Bar
# end
#
# The compact style is only forced, for classes or modules with one child.
EnforcedStyle: nested
SupportedStyles:
- nested
- compact
Style/Documentation:
Description: 'Document classes and non-namespace modules.'
Enabled: false
VersionAdded: '0.9'
Exclude:
- 'spec/**/*'
- 'test/**/*'
Style/DocumentationMethod:
Description: 'Checks for missing documentation comment for public methods.'
Enabled: false
VersionAdded: '0.43'
Exclude:
- 'spec/**/*'
- 'test/**/*'
RequireForNonPublicMethods: false
Layout/DotPosition:
Description: 'Checks the position of the dot in multi-line method calls.'
StyleGuide: '#consistent-multi-line-chains'
Enabled: true
VersionAdded: '0.49'
EnforcedStyle: trailing
SupportedStyles:
- leading
- trailing
Style/GuardClause:
Description: 'Check for conditionals that can be replaced with guard clauses.'
StyleGuide: '#no-nested-conditionals'
Enabled: true
VersionAdded: '0.20'
VersionChanged: '0.22'
# `MinBodyLength` defines the number of lines of the a body of an `if` or `unless`
# needs to have to trigger this cop
MinBodyLength: 10
Style/MethodCallWithArgsParentheses:
Description: 'Use parentheses for method calls with arguments.'
StyleGuide: '#method-invocation-parens'
Enabled: false
VersionAdded: '0.47'
VersionChanged: '0.61'
IgnoreMacros: true
IgnoredMethods: []
IgnoredPatterns: []
IncludedMacros: []
AllowParenthesesInMultilineCall: false
AllowParenthesesInChaining: false
AllowParenthesesInCamelCaseMethod: false
EnforcedStyle: require_parentheses
SupportedStyles:
- require_parentheses
- omit_parentheses
Style/NumericPredicate:
Description: >-
Checks for the use of predicate- or comparison methods for
numeric comparisons.
StyleGuide: '#predicate-methods'
Safe: false
# This will change to a new method call which isn't guaranteed to be on the
# object. Switching these methods has to be done with knowledge of the types
# of the variables which rubocop doesn't have.
SafeAutoCorrect: false
AutoCorrect: false
Enabled: true
VersionAdded: '0.42'
VersionChanged: '0.59'
EnforcedStyle: comparison
SupportedStyles:
- predicate
- comparison
IgnoredMethods: []
# Exclude RSpec specs because assertions like `expect(1).to be > 0` cause
# false positives.
Exclude:
- 'spec/**/*'
Style/RedundantSelf:
Description: "Don't use self where it's not needed."
StyleGuide: '#no-self-unless-required'
Enabled: false
VersionAdded: '0.10'
VersionChanged: '0.13'
Style/TrailingCommaInArguments:
Description: 'Checks for trailing comma in argument lists.'
StyleGuide: '#no-trailing-params-comma'
Enabled: true
VersionAdded: '0.36'
# If `comma`, the cop requires a comma after the last argument, but only for
# parenthesized method calls where each argument is on its own line.
# If `consistent_comma`, the cop requires a comma after the last argument,
# for all parenthesized method calls with arguments.
EnforcedStyleForMultiline: comma
SupportedStylesForMultiline:
- comma
- consistent_comma
- no_comma
Style/TrailingCommaInArrayLiteral:
Description: 'Checks for trailing comma in array literals.'
StyleGuide: '#no-trailing-array-commas'
Enabled: true
VersionAdded: '0.53'
# but only when each item is on its own line.
# If `consistent_comma`, the cop requires a comma after the last item of all
# non-empty array literals.
EnforcedStyleForMultiline: comma
SupportedStylesForMultiline:
- comma
- consistent_comma
- no_comma
Style/TrailingCommaInHashLiteral:
Description: 'Checks for trailing comma in hash literals.'
Enabled: true
VersionAdded: '0.53'
# If `comma`, the cop requires a comma after the last item in a hash,
# but only when each item is on its own line.
# If `consistent_comma`, the cop requires a comma after the last item of all
# non-empty hash literals.
EnforcedStyleForMultiline: comma
SupportedStylesForMultiline:
- comma
- consistent_comma
- no_comma