-
Notifications
You must be signed in to change notification settings - Fork 1
/
.rubocop.yml
259 lines (200 loc) · 5.82 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
inherit_from: .rubocop_todo.yml
require:
- rubocop-performance
- rubocop-rails
- rubocop-rake
- rubocop-rspec
AllCops:
TargetRubyVersion: 2.7
NewCops: enable
Exclude:
- 'perf/**/*'
- 'test-apps/**/*'
- 'vendor/**/*'
Lint/EmptyClass:
Exclude:
- 'spec/**/*'
Rails/ShortI18n:
Enabled: false
Style/Documentation:
AllowedConstants: ['ClassMethods']
Exclude:
- 'gemfiles/**/*'
- 'spec/**/*'
Style/DocumentationMethod:
Exclude:
- 'gemfiles/**/*'
- 'spec/**/*'
# --------------------------------------------------
# These cops are having CI issues. Enable later.
Performance/StringInclude:
Enabled: false
Performance/RegexpMatch:
Exclude:
- 'Gemfile'
Style/FrozenStringLiteralComment:
Exclude:
- 'Gemfile'
# --------------------------------------------------
# Cops with specific files skipped. These can be inlined later.
Layout/LineContinuationLeadingSpace:
Exclude:
- 'spec/integration/app_spec.rb'
Lint/EmptyBlock:
Exclude:
- 'spec/**/*'
Lint/RedundantCopDisableDirective:
Exclude:
- 'spec/mongoid/version_spec.rb'
RSpec/BeforeAfterAll:
Exclude:
- 'spec/support/constraints.rb'
Lint/BinaryOperatorWithIdenticalOperands:
Exclude:
- 'spec/mongoid/equality_spec.rb'
Lint/ConstantDefinitionInBlock:
Exclude:
- 'spec/**/*'
Lint/SuppressedException:
Exclude:
- 'spec/**/*'
Naming/AccessorMethodName:
Exclude:
- 'lib/mongoid/association/referenced/has_many/enumerable.rb'
- 'lib/mongoid/atomic/modifiers.rb'
- 'lib/mongoid/clients/options.rb'
- 'lib/mongoid/criteria/options.rb'
- 'lib/mongoid/encryptable.rb'
- 'lib/mongoid/fields/encrypted.rb'
- 'lib/mongoid/persistence_context.rb'
- 'lib/mongoid/timestamps/timeless.rb'
RSpec/AroundBlock:
Exclude:
- 'spec/support/constraints.rb'
RSpec/IdenticalEqualityAssertion:
Exclude:
- 'spec/mongoid/equality_spec.rb'
RSpec/InstanceVariable:
Exclude:
- 'spec/integration/callbacks_spec.rb'
Security/MarshalLoad:
Exclude:
- 'spec/mongoid/criteria/marshalable_spec.rb'
RSpec/SubjectStub:
Exclude:
- 'spec/mongoid/collection_configurable_spec.rb'
Style/ClassVars:
Exclude:
- 'lib/mongoid/contextual/mongo/documents_loader.rb'
- 'spec/mongoid/clients/transactions_spec_models.rb'
- 'spec/mongoid/contextual/mongo/documents_loader_spec.rb'
Style/CaseEquality:
Exclude:
- 'lib/mongoid/association/embedded/embeds_many/proxy.rb'
- 'lib/mongoid/association/referenced/has_many/enumerable.rb'
- 'spec/**/*'
RSpec/ExampleLength:
Max: 50
RSpec/MultipleExpectations:
Max: 20
RSpec/MultipleMemoizedHelpers:
Max: 50
# --------------------------------------------------
# These cops are disabled by default, but should be periodically
# checked and cleaned up.
Layout/EmptyLinesAroundBlockBody:
Enabled: false
Layout/EmptyLinesAroundClassBody:
Enabled: false
Layout/EmptyLinesAroundModuleBody:
Enabled: false
Performance/CollectionLiteralInLoop:
Exclude:
- 'spec/mongoid/association/embedded/embeds_many/proxy_spec.rb'
- 'spec/mongoid/association/referenced/has_many/proxy_spec.rb'
- 'spec/mongoid/attributes_spec.rb'
- 'spec/mongoid/criteria/queryable/selectable_spec.rb'
- 'spec/mongoid/criteria/queryable/selector_spec.rb'
Style/IfUnlessModifier:
Enabled: false
# --------------------------------------------------
# These cops are intentionally disabled due to incompatibility.
# Mongoid behavior differs from ActiveRecord
Rails/RedundantPresenceValidationOnBelongsTo:
Enabled: false
# False positives
Lint/HashCompareByIdentity:
Exclude:
- 'lib/mongoid/persistence_context.rb'
- 'lib/mongoid/threaded.rb'
# --------------------------------------------------
# These cops are intentionally configured due to style preference.
Bundler/OrderedGems:
Enabled: false
Gemspec/OrderedDependencies:
Enabled: false
Layout/FirstArrayElementIndentation:
EnforcedStyle: consistent
Layout/FirstHashElementIndentation:
EnforcedStyle: consistent
Lint/AmbiguousBlockAssociation:
Exclude:
- 'spec/mongoid/association/referenced/has_many/proxy_spec.rb'
- 'spec/mongoid/interceptable_spec.rb'
- 'spec/mongoid/touchable_spec.rb'
Lint/MissingSuper:
Exclude:
- 'lib/mongoid/association/embedded/embedded_in/proxy.rb'
- 'lib/mongoid/association/embedded/embeds_many/proxy.rb'
- 'lib/mongoid/association/embedded/embeds_one/proxy.rb'
- 'lib/mongoid/association/referenced/belongs_to/proxy.rb'
- 'lib/mongoid/association/referenced/has_many/proxy.rb'
- 'lib/mongoid/association/referenced/has_one/proxy.rb'
- 'lib/mongoid/criteria/queryable/pipeline.rb'
- 'lib/mongoid/criteria/queryable/smash.rb'
Lint/UnusedMethodArgument:
AllowUnusedKeywordArguments: true
Metrics/BlockLength:
Exclude:
- '**/Rakefile'
- '**/*.rake'
Naming/PredicateName:
AllowedMethods:
- is_a?
- has_and_belongs_to_many
- has_many
- has_one
- has_attribute?
- has_attribute_before_type_cast?
RSpec/IndexedLet:
Enabled: false
RSpec/NotToNot:
EnforcedStyle: to_not
Style/Alias:
EnforcedStyle: prefer_alias_method
Style/FetchEnvVar:
Enabled: false
Style/GuardClause:
AllowConsecutiveConditionals: true
Exclude:
- 'Gemfile'
- 'gemfiles/**/*'
# this exclusion should be inlined
- 'lib/mongoid/criteria/queryable/mergeable.rb'
Style/ModuleFunction:
EnforcedStyle: extend_self
Style/NumericLiterals:
Enabled: false
Style/NumericPredicate:
Enabled: false
Style/RaiseArgs:
EnforcedStyle: compact
# See: https://github.com/rubocop/rubocop/issues/11798
# Enforce multiline style if it becomes available in the future.
Style/WhileUntilModifier:
Enabled: false
# See: https://github.com/rubocop/rubocop/issues/11802
Style/SymbolArray:
Exclude:
- 'spec/mongoid/criteria/queryable/selector_spec.rb'
- 'spec/mongoid/criteria/queryable/options_spec.rb'