-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.rubocop.yml
250 lines (196 loc) · 5.92 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
# Rubocop configuration settings for Brigade Ruby services
#
# If you want to override the configuration for a particular directory in the
# repo, add a `.rubocop.yml` file to that directory and make it `inherit_from`
# this file, using a relative path.
AllCops:
TargetRubyVersion: 2.5
DisplayCopNames: true
UseCache: true
CacheRootDirectory: ./tmp/cache
# This is unnecessary since there are already other ways of measuring method
# size/complexity.
AbcSize:
Enabled: false
AccessModifierIndentation:
Enabled: true
EnforcedStyle: indent
# This lint prohibits method names starting with `get_`, which is often good
# advice but wrong too often to be worthwhile.
AccessorMethodName:
Enabled: false
# Allow developers to pass regexes as arguments without enclosing parens, e.g.
#
# response.body.should match /some regex/
AmbiguousRegexpLiteral:
Enabled: false
# Allow the case equality ("threequals") operator, which is often useful,
# especially for working with RSpec.
CaseEquality:
Enabled: false
ClassLength:
Severity: warning
# Don't require use of `collect` over `map`
CollectionMethods:
Enabled: false
CommentAnnotation:
Enabled: false
CyclomaticComplexity:
Severity: warning
Debugger:
Severity: error # binding.pry blocks!
Documentation:
Exclude:
# Exclude concerns so that people aren't forced to document ClassMethods
# modules.
- 'config/**/*'
# Namespacing specs can be useful, and rubocop doesn't detect that
- 'spec/**/*'
DoubleNegation:
Enabled: false
FileName:
Exclude:
- 'script/*'
- '.overcommit_gems.rb'
# This disagrees with our current style and doesn't really matter.
FirstParameterIndentation:
Enabled: false
# Don't enforce using if/unless modifiers when you have a single-line body.
IfUnlessModifier:
Enabled: false
# Don't favor sprintf/format over the use of String#%, as
#
# '%s' % value
#
# is more concise than
#
# sprintf('%s', value)
FormatString:
Enabled: false
# We want to allow multi-line lambdas using the `->` syntax which Rubocop
# doesn't allow. We're also not too worried about people using `lambda` for
# single-line lambdas either.
Lambda:
Enabled: false
# Avoid lines longer than 100 characters. The theory is that there are times
# where forcing a wrap to 80 characters can actually harm readability, but if
# you're hitting 100 there is probably a way to condense what you're trying to
# express.
LineLength:
Max: 100
IgnoredPatterns:
- '\A#' # Allow longer comments
# There are a number of places where it makes sense to chain do...end blocks
MethodCalledOnDoEndBlock:
Enabled: false
# Avoid methods longer than 30 lines. This is larger than the default 10, but
# hopefully we can gradually lower it over time.
MethodLength:
Severity: warning
Max: 30
Metrics/ModuleLength:
Severity: warning
Metrics/BlockLength:
Severity: warning
Exclude:
- lib/tasks/**/*
- spec/**/*
# Because we sometimes use RSpec's implicit subject syntax, we need to be able
# to format blocks more flexibly than in the main codebase.
MultilineBlockLayout:
Exclude:
- spec/**/*
# It is OK for Rake tasks to write to STDOUT
Output:
Exclude:
- lib/tasks/**/*
ParameterLists:
CountKeywordArgs: false
PerceivedComplexity:
Severity: warning
# Prefer curly braces except for %i/%w/%W, since those return arrays.
PercentLiteralDelimiters:
PreferredDelimiters:
'%': '{}'
'%i': '[]'
'%q': '{}'
'%Q': '{}'
'%r': '{}'
'%s': '()'
'%w': '[]'
'%W': '[]'
'%x': '{}'
# Forcing the name of a predicate to `doctor?` makes it difficult to tell if it
# is a "has-a" or a "is-a" predicate, so disable it.
PredicateName:
Enabled: false
# Forcing use of intermediate models can lead to extra clutter
Rails/HasAndBelongsToMany:
Enabled: false
# This doesn't allow inheritance or multi-level YAML configs
Security/YAMLLoad:
Enabled: false
ShadowingOuterLocalVariable:
Severity: error
# Disable enforcing `raise` keyword only inside `rescue` blocks. This check had
# widespread disapproval.
SignalException:
Enabled: false
# Forcing the naming of arguments to `reduce` to be `|a, e|` isn't very useful.
SingleLineBlockParams:
Enabled: false
Layout/SpaceBeforeFirstArg:
AllowForAlignment: true
# There's no reason to enforce only using ASCII in comments.
Style/AsciiComments:
Enabled: false
Style/ModuleFunction:
Enabled: false
Layout/MultilineMethodCallIndentation:
EnforcedStyle: indented
Layout/MultilineMethodCallBraceLayout:
Enabled: false
Style/NumericLiterals:
Exclude:
- spec/**/*
- config/**/*
# It doesn't seem like .zero? and .nonzero? are more readable than == 0
Style/NumericPredicate:
Enabled: false
# This triggered on `(request.original_url =~ /\?/) ? '&' : '?'`, which doesn't
# seem reasonable.
Style/TernaryParentheses:
Enabled: false
Style/TrailingCommaInArrayLiteral:
EnforcedStyleForMultiline: comma
Style/TrailingCommaInHashLiteral:
EnforcedStyleForMultiline: comma
Style/TrailingCommaInArguments:
EnforcedStyleForMultiline: comma
# Unreachable code is dead code, and should be removed.
UnreachableCode:
Severity: error
UnusedMethodArgument:
AllowUnusedKeywordArguments: true
# Wastes CPU time, especially if the right-hand expression is expensive
UselessAssignment:
Severity: error
# We don't have a preference for this case.
WhileUntilModifier:
Enabled: false
# Two strings in an array is not indicative that the array is likely to have
# elements added to it in the future, so up the minimum number of elements we
# warn on to 3.
WordArray:
MinSize: 3
Layout/ClosingParenthesisIndentation:
Enabled: false
Style/SpecialGlobalVars:
Enabled: false
# Checks for frozen string comment, designed to help upgrade to Ruby 3.0 (where
# frozen string literals will be default); disabled because we prefer calling `.freeze`
# on our string literals rather than using a magic comment.
Style/FrozenStringLiteralComment:
Enabled: false
Layout/DotPosition:
EnforcedStyle: trailing