forked from otwcode/otwarchive
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.rubocop.yml
292 lines (229 loc) · 5.8 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
# Options available at https://github.com/bbatsov/rubocop/blob/master/config/default.yml
require:
- rubocop-rails
- rubocop-rspec
- ./rubocop/rubocop
inherit_mode:
merge:
- Exclude
AllCops:
NewCops: enable
TargetRubyVersion: 3.1
Bundler/OrderedGems:
Enabled: false
I18n/DeprecatedTranslationKey:
Rules:
name_with_colon: "Prefer `name` with `mailer.general.metadata_label_indicator` over `name_with_colon`"
Layout/DotPosition:
EnforcedStyle: leading
Layout/EmptyLinesAroundAttributeAccessor:
Enabled: false
Layout/FirstArrayElementIndentation:
EnforcedStyle: consistent
Layout/LineLength:
Enabled: false
Layout/MultilineMethodCallIndentation:
EnforcedStyle: indented
Layout/SingleLineBlockChain:
Enabled: true
Layout/TrailingWhitespace:
Enabled: false
Lint/AmbiguousBlockAssociation:
Exclude:
# Exception for specs where we use change matchers:
# https://github.com/rubocop-hq/rubocop/issues/4222
- 'spec/**/*.rb'
Lint/AmbiguousRegexpLiteral:
Enabled: false
Lint/RedundantSafeNavigation:
Exclude:
# Take a better safe than sorry approach to safe navigation in admin
# policies.
- 'app/policies/*.rb'
Metrics/AbcSize:
Enabled: false
Metrics/BlockLength:
Enabled: false
Metrics/ClassLength:
Enabled: false
Metrics/CyclomaticComplexity:
Enabled: false
Metrics/MethodLength:
Enabled: false
Metrics/ModuleLength:
Enabled: false
Metrics/ParameterLists:
CountKeywordArgs: false
Metrics/PerceivedComplexity:
Enabled: false
Migration/LargeTableSchemaUpdate:
Tables:
- abuse_reports
- admin_activities
- audits
- bookmarks
- comments
- common_taggings
- collection_items
- collection_participants
- collection_profiles
- collections
- creatorships
- external_works
- favorite_tags
- feedbacks
- filter_counts
- filter_taggings
- gifts
- inbox_comments
- invitations
- kudos
- log_items
- mutes
- preferences
- profiles
- prompts
- pseuds
- readings
- set_taggings
- serial_works
- series
- skins
- stat_counters
- subscriptions
- tag_nominations
- tag_set_associations
- tags
- taggings
- users
- works
Rails/DefaultScope:
Enabled: true
Rails/DynamicFindBy:
AllowedMethods:
# Exception for Tag.find_by_name
- find_by_name
# Exception for Tagging.find_by_tag
- find_by_tag
# Exceptions for Work.find_by_*
- find_by_url
- find_by_url_cache_key
- find_by_url_generation
- find_by_url_generation_key
- find_by_url_uncached
# Exceptions for InboxComment.find_by_filters
- find_by_filters
Rails/EnvironmentVariableAccess:
Enabled: true
# Allow all uses of html_safe, they're everywhere...
Rails/OutputSafety:
Enabled: false
Rails/Output:
Exclude:
# Allow migrations to print pt-osc comments to console:
- 'db/migrate/*.rb'
Rails/RakeEnvironment:
Enabled: false
Rails/ReversibleMigrationMethodDefinition:
Enabled: true
# Allow update_attribute, update_all, touch, etc.
Rails/SkipsModelValidations:
Enabled: false
Rails/UnknownEnv:
Environments:
- development
- test
- staging
- production
RSpec:
Include:
- "(?:^|/)factories/"
- "(?:^|/)features/"
- "(?:^|/)spec/"
# Allow "allow_any_instance_of"
RSpec/AnyInstance:
Enabled: false
# By default allow only prefixes "when", "with", "without".
# We have too many, so let's allow everything.
RSpec/ContextWording:
Enabled: false
RSpec/DescribeClass:
Exclude:
# Exception for specs about I18n configurations
- 'spec/lib/i18n/**/*.rb'
# Exception for rake specs, where the top level describe uses a task name
- 'spec/lib/tasks/*.rake_spec.rb'
# Exception for integration specs, which may not test a specific class
- 'spec/requests/**/*.rb'
RSpec/DescribedClass:
Enabled: false
RSpec/ExampleLength:
Enabled: false
# Prefer: expect { run }.to change { Foo.bar }
# over: expect { run }.to change(Foo, :bar)
RSpec/ExpectChange:
EnforcedStyle: block
RSpec/FilePath:
Exclude:
# Exception for WorksController, whose many specs need multiple files
- 'spec/controllers/works/*.rb'
# Exception for concern specs, which may test multiple classes
- 'spec/models/concerns/**/*.rb'
# Avoid instance variables, except for those not assigned within the spec,
# e.g. @request.
RSpec/InstanceVariable:
AssignmentOnly: true
# Allow unreferenced let! calls for test setup
RSpec/LetSetup:
Enabled: false
# Allow both "have_received" and "receive" for expectations
RSpec/MessageSpies:
Enabled: false
# Allow multiple top level describes (rake specs)
RSpec/MultipleDescribes:
Enabled: false
# Allow unlimited expectations per test
RSpec/MultipleExpectations:
Enabled: false
# Allow unnamed subjects
RSpec/NamedSubject:
Enabled: false
# Allow unlimited nested groups
RSpec/NestedGroups:
Enabled: false
RSpec/PredicateMatcher:
Enabled: false
Style/AndOr:
EnforcedStyle: conditionals
Style/ClassAndModuleChildren:
Enabled: false
Style/Documentation:
Enabled: false
Style/EmptyMethod:
EnforcedStyle: expanded
# Prefer template tokens (like %{foo}) over annotated tokens (like %s)
Style/FormatStringToken:
EnforcedStyle: template
Style/FrozenStringLiteralComment:
Enabled: false
Style/GlobalVars:
AllowedVariables:
- $elasticsearch
- $rollout
Style/PercentLiteralDelimiters:
Exclude:
# Exception for Cucumber step definitions, where we heavily use %{} for strings
- 'features/**/*.rb'
# Stop checking if uses of "self" are redundant
Style/RedundantSelf:
Enabled: false
Style/SelectByRegexp:
Enabled: true
Style/SingleLineMethods:
AllowIfMethodIsEmpty: false
Style/StringLiterals:
EnforcedStyle: double_quotes
Style/SymbolArray:
Enabled: false
Style/TernaryParentheses:
EnforcedStyle: require_parentheses_when_complex