-
Notifications
You must be signed in to change notification settings - Fork 202
/
.rubocop.yml
266 lines (262 loc) · 6.84 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
# Rubocop configuration
#
# Note: Rubocop continuously adds new cops. Sometimes applying them
# is safely automated, but sometimes they aren't (or the safe automation
# is only available in a later version of Rubocop).
# Here are some options:
# 1. Always implement new cops, even if they require lots of manual work.
# Trying to do this is extremely time-consuming and risky, because
# we already have a code base, and it's often not worth it.
# 2. Freeze on one (old) version. But then we never get the improvements
# such as better cops and bug fixes.
# 3. Update rubocop, use some of its automated fixes, fix some
# easy/important ones (especially if they are bugs or security weaknesses),
# and then disable the rest of the cops (e.g., Enable: false).
# We can then slowly later try to re-enable some of the newer cops.
# We choose option 3. Later versions of rubocop may add automations,
# so this can save time in both the short and long run.
#
# Rubocop has changed over time:
# * the performance cops were extracted in rubocop-performance
# and were removed from the main gem in 0.68
# * the Ruby on Rails cops were extracted in rubocop-rails and
# were removed from the main gem in 0.72
# Be *sure* to depend on rubocop-rails version *2.0* or later.
# See:
# https://docs.rubocop.org/rubocop/installation.html
# https://metaredux.com/posts/2019/05/22/a-modular-rubocop.html
# https://github.com/toshimaru/rubocop-rails/issues/31
require:
- rubocop-performance
- rubocop-rails
AllCops:
EnabledByDefault: true
TargetRubyVersion: 2.5
DisplayCopNames: true
DisplayStyleGuide: true
Include:
- '**/*.rb'
- '**/*.pryrc'
- '**/*.rake'
- '.env'
- '.simplecov'
- '**/config.ru'
- '**/Gemfile'
- '**/Guardfile'
- '**/Rakefile'
Exclude:
- 'tmp/**/*'
- 'lib/.git/**/*'
- 'db/**/*'
- 'db/migrate/**'
- 'bin/**/*'
- 'node_modules/**/*'
- 'railroader/**/*'
- '.pryrc'
- 'license_okay'
# This will ALWAYS be disabled. We *want* to be able disable cops.
Style/DisableCopsWithinSourceCodeDirective:
Enabled: false
# This is a terrible idea and will never happen. Sometimes there's
# no need for a full Rails environment; we only want to bring in a
# Rails environment when it's encessary.
Rails/RakeEnvironment:
Enabled: false
Style/Documentation:
Enabled: false
Lint/SuppressedException:
Enabled: false
# Exclude:
# - 'bin/*'
Style/RescueStandardError:
Exclude:
# When getting evidence from external sources there are
# many possible problems, and we don't care - if there's
# an error getting evidence, we treat it as no evidence.
- 'app/lib/evidence.rb'
Metrics/AbcSize:
Max: 20
Exclude:
- 'db/migrate/*'
Metrics/ClassLength:
Exclude:
- 'db/migrate/*'
# Weird failures on this, disabled for now.
Layout/LineLength:
Max: 132
# Exclude:
# - 'db/migrate/*'
Metrics/MethodLength:
Exclude:
- 'db/migrate/*'
Max: 12
Rails/SkipsModelValidations:
Exclude:
- 'test/**/*.rb'
Style/Copyright:
Enabled: false
Style/InlineComment:
Enabled: false
Style/DocumentationMethod:
Enabled: false
Style/MethodCallWithArgsParentheses:
Enabled: false
Style/MissingElse:
Enabled: false
Style/NegatedIf:
Enabled: true
EnforcedStyle: postfix
Style/Send:
Exclude:
- 'test/**/*.rb'
#
# Historical systems could only reliably handle comments if they were ASCII.
# But UTF-8 has essentially "taken over", so there's no reason to limit
# ourselves to ASCII. Having ASCII-only comments makes it unnecessarily
# difficult to discuss/describe locale issues. *Code* handles UTF-8
# without incident, so there's no reason to limit comments to ASCII.
#
Style/AsciiComments:
Enabled: false
#
# The following are newer cops which have disabled because
# we aren't ready for them right now. It's diffult to do things "all at once".
# Instead, we'll get things running first (ignoring these cops), and
# later try to slowly comply with them or reject them.
# See issue #1069, which tracks this decision.
#
Style/StringHashKeys:
Enabled: false
Naming/ConstantName:
Enabled: false
Style/MixinUsage:
Enabled: false
Rails/EnvironmentComparison:
Enabled: false
Lint/MissingCopEnableDirective:
Enabled: false
Lint/NumberConversion:
Enabled: false
Layout/ClassStructure:
Enabled: false
Rails/Presence:
Enabled: false
Naming/MethodParameterName:
Enabled: false
Style/IpAddresses:
Enabled: false
# Rubocop 0.59.0 doesn't notice same-line comments (whup!), so disable
Bundler/GemComment:
Enabled: false
# Re-enable and try these out later
Performance/ChainArrayAllocation:
Enabled: false
Layout/HashAlignment:
Enabled: false
Rails/SaveBang:
Enabled: false
Rails/FindEach:
Enabled: false
Lint/RedundantCopDisableDirective:
Enabled: false
Layout/MultilineArrayLineBreaks:
Enabled: false
Layout/MultilineHashKeyLineBreaks:
Enabled: false
Layout/MultilineMethodArgumentLineBreaks:
Enabled: false
Style/StderrPuts:
Enabled: false
Rails/HelperInstanceVariable:
Enabled: false
Style/MultilineWhenThen:
Enabled: false
Style/ConstantVisibility:
Enabled: false
Style/RedundantReturn:
Enabled: false
Rails/FilePath:
Enabled: false
Rails/UnknownEnv:
Enabled: false
Performance/IoReadlines:
Enabled: false
Layout/FirstMethodArgumentLineBreak:
Enabled: false
Style/IfUnlessModifier:
Enabled: false
Style/MultilineMethodSignature:
Enabled: false
Lint/ConstantResolution:
Enabled: false
Style/RedundantRegexpEscape:
Enabled: false
Style/CaseLikeIf:
Enabled: false
Style/ExpandPathArguments:
Enabled: false
Style/RedundantFetchBlock:
Enabled: false
Metrics/CyclomaticComplexity:
Enabled: false
Style/RedundantAssignment:
Enabled: false
Bundler/OrderedGems:
Enabled: false
Layout/EmptyLineAfterMultilineCondition:
Enabled: false
Style/StringConcatenation:
Enabled: false
Style/ClassMethodsDefinitions:
Enabled: false
Style/GlobalStdStream:
Enabled: false
Lint/UselessMethodDefinition:
Enabled: false
Style/OptionalBooleanParameter:
Enabled: false
Metrics/PerceivedComplexity:
Enabled: false
Max: 10
Style/SoleNestedConditional:
Enabled: false
Lint/EmptyConditionalBody:
Enabled: false
Style/ExplicitBlockArgument:
Enabled: false
Rails/DefaultScope:
Enabled: false
Rails/WhereNot:
Enabled: false
Rails/NegateInclude:
Enabled: false
Layout/RedundantLineBreak:
Enabled: false
Naming/VariableNumber:
Enabled: false
Layout/LineContinuationLeadingSpace:
Enabled: false
Style/TopLevelMethodDefinition:
Enabled: false
Naming/InclusiveLanguage:
Enabled: false
Bundler/GemVersion:
Enabled: false
Lint/EmptyBlock:
Enabled: false
Lint/OrAssignmentToConstant:
Enabled: false
Rails/EnvironmentVariableAccess:
Enabled: false
Rails/DuplicateScope:
Enabled: false
Rails/I18nLocaleTexts:
Enabled: false
Rails/RedundantPresenceValidationOnBelongsTo:
Enabled: false
Style/RequireOrder:
Enabled: false
Style/YodaExpression:
Enabled: false
Metrics/BlockLength:
Max: 36