1
- # version 1.21 .0 - https://dcm.dev/changelog
1
+ # version 1.24 .0 - https://dcm.dev/changelog
2
2
dart_code_metrics :
3
3
rules :
4
4
# ## Common
5
5
# - arguments-ordering # way too pedantic
6
6
- avoid-accessing-collections-by-constant-index
7
7
- avoid-accessing-other-classes-private-members
8
+ - avoid-adjacent-strings
9
+ - avoid-assignments-as-conditions
8
10
- avoid-async-call-in-sync-function
9
11
# - avoid-banned-annotations # * OK, we just don't have global config
10
12
# - avoid-banned-file-names # * OK, we just don't have global config
@@ -20,12 +22,14 @@ dart_code_metrics:
20
22
- avoid-collection-equality-checks
21
23
- avoid-collection-methods-with-unrelated-types
22
24
# - avoid-collection-mutating-methods # sometimes it's ok
25
+ - avoid-complex-loop-conditions
23
26
- avoid-conditions-with-boolean-literals
24
27
- avoid-contradictory-expressions
25
28
- avoid-declaring-call-method
26
29
- avoid-double-slash-imports
27
30
- avoid-duplicate-cascades
28
31
- avoid-duplicate-collection-elements
32
+ # - avoid-duplicate-constant-values # ! check later
29
33
- avoid-duplicate-exports
30
34
- avoid-duplicate-initializers
31
35
- avoid-duplicate-map-keys
@@ -49,9 +53,13 @@ dart_code_metrics:
49
53
- avoid-future-tostring
50
54
- avoid-generics-shadowing
51
55
- avoid-global-state
56
+ # - avoid-high-cyclomatic-complexity # For now we catch this on CR.
52
57
- avoid-identical-exception-handling-blocks
53
- - avoid-ignoring-return-values
58
+ - avoid-ignoring-return-values :
59
+ exclude :
60
+ - test/**
54
61
- avoid-importing-entrypoint-exports
62
+ - avoid-incorrect-uri
55
63
- avoid-inferrable-type-arguments :
56
64
ignored-invocations :
57
65
- context.read
@@ -60,7 +68,9 @@ dart_code_metrics:
60
68
- avoid-inverted-boolean-checks
61
69
- avoid-keywords-in-wildcard-pattern
62
70
# - avoid-late-keyword
63
- - avoid-local-functions
71
+ - avoid-local-functions :
72
+ exclude :
73
+ - test/**
64
74
# - avoid-long-files # hard to get the right settings
65
75
# - avoid-long-functions # way too pedantic
66
76
# - avoid-long-parameter-list: # way too pedantic
@@ -75,6 +85,7 @@ dart_code_metrics:
75
85
- avoid-multi-assignment
76
86
# - avoid-mutating-parameters # we use ValueNotifier etc.
77
87
# - avoid-negated-conditions # sometimes it might be better
88
+ - avoid-negations-in-equality-checks
78
89
- avoid-nested-conditional-expressions :
79
90
acceptable-level : 2
80
91
- avoid-nested-extension-types
@@ -86,6 +97,7 @@ dart_code_metrics:
86
97
- avoid-non-ascii-symbols :
87
98
exclude :
88
99
- test/**
100
+ # - avoid-non-empty-constructor-bodies # way too pedantic
89
101
- avoid-non-null-assertion :
90
102
skip-checked-fields : true
91
103
exclude :
@@ -108,8 +120,9 @@ dart_code_metrics:
108
120
- avoid-redundant-positional-field-name
109
121
- avoid-redundant-pragma-inline
110
122
- avoid-referencing-discarded-variables
123
+ # - avoid-referencing-subclasses # we often use this in states and events
111
124
- avoid-renaming-representation-getters
112
- - avoid-returning-cascades
125
+ # - avoid-returning-cascades # collides with prefer-immediate-return
113
126
- avoid-returning-void
114
127
- avoid-self-assignment
115
128
- avoid-self-compare
@@ -125,6 +138,7 @@ dart_code_metrics:
125
138
- avoid-throw-in-catch-block
126
139
- avoid-throw-objects-without-tostring
127
140
- avoid-top-level-members-in-tests
141
+ # - avoid-type-casts # needed when working with JSONs
128
142
- avoid-unassigned-late-fields
129
143
- avoid-unassigned-stream-subscriptions
130
144
- avoid-uncaught-future-errors
@@ -133,12 +147,14 @@ dart_code_metrics:
133
147
- avoid-unnecessary-call
134
148
- avoid-unnecessary-collections
135
149
- avoid-unnecessary-conditionals
150
+ - avoid-unnecessary-extends
136
151
- avoid-unnecessary-futures
137
152
# - avoid-unnecessary-getter # it's ok to have getter for private field
138
153
- avoid-unnecessary-if
139
154
- avoid-unnecessary-local-late
140
155
- avoid-unnecessary-negations
141
156
- avoid-unnecessary-nullable-return-type
157
+ - avoid-unnecessary-overrides
142
158
- avoid-unnecessary-reassignment
143
159
- avoid-unnecessary-return
144
160
- avoid-unnecessary-super
@@ -149,6 +165,7 @@ dart_code_metrics:
149
165
- avoid-unsafe-collection-methods
150
166
- avoid-unsafe-reduce
151
167
- avoid-unused-after-null-check
168
+ - avoid-unused-assignment
152
169
- avoid-unused-generics
153
170
- avoid-unused-instances
154
171
- avoid-unused-parameters
@@ -162,10 +179,13 @@ dart_code_metrics:
162
179
- enum-constants-ordering
163
180
- format-comment :
164
181
only-doc-comments : true
182
+ ignored-patterns :
183
+ - etc.
165
184
# - format-test-name # good but painful
166
185
- function-always-returns-null :
167
186
ignored-invocations :
168
187
- useEffect
188
+ - function-always-returns-same-value
169
189
- handle-throwing-invocations
170
190
- map-keys-ordering :
171
191
exclude :
@@ -198,7 +218,14 @@ dart_code_metrics:
198
218
- public-methods
199
219
- build-method
200
220
- private-methods
201
- - missing-test-assertion
221
+ - missing-test-assertion :
222
+ include-assertions :
223
+ - called # mocktail
224
+ - calledOnce # mocktail
225
+ - verifyNoMoreInteractions # mocktail
226
+ - verifyZeroInteractions # mocktail
227
+ - blocTest # bloc_test
228
+ - blocPresentationTest # safe_bloc
202
229
# - missing-use-result-annotation # * OK, we just don't have global config
203
230
- move-records-to-typedefs :
204
231
min-fields : 3
@@ -233,10 +260,35 @@ dart_code_metrics:
233
260
- no-object-declaration
234
261
# - parameters-ordering # way too strict
235
262
- prefer-abstract-final-static-class
263
+ - prefer-add-all
236
264
# - prefer-addition-subtraction-assignments # dunno
237
265
- prefer-any-or-every
238
266
- prefer-async-await
239
- - prefer-boolean-prefixes
267
+ - prefer-boolean-prefixes :
268
+ ignored-names :
269
+ - value
270
+ - result
271
+ - " _"
272
+ prefixes :
273
+ # Defaults
274
+ - is
275
+ - are
276
+ - was
277
+ - were
278
+ - has
279
+ - have
280
+ - had
281
+ - can
282
+ - should
283
+ - will
284
+ - do
285
+ - does
286
+ - did
287
+ # New
288
+ - show
289
+ - allow
290
+ - enable
291
+ - handle # for handlers that return bool
240
292
- prefer-both-inlining-annotations
241
293
- prefer-bytes-builder
242
294
- prefer-commenting-analyzer-ignores
@@ -252,8 +304,7 @@ dart_code_metrics:
252
304
# - prefer-correct-json-casts # overkill
253
305
- prefer-correct-setter-parameter-name
254
306
- prefer-correct-stream-return-type
255
- - prefer-correct-switch-length :
256
- max-length : 20 # default value 10 is sometimes way too much
307
+ # - prefer-correct-switch-length # sometimes switch with 2 cases makes sense
257
308
- prefer-correct-test-file-name
258
309
# - prefer-correct-throws # for now hard to maintain
259
310
- prefer-correct-type-name
@@ -264,7 +315,10 @@ dart_code_metrics:
264
315
- prefer-explicit-parameter-names
265
316
# - prefer-explicit-type-arguments # inference is better
266
317
# - prefer-extracting-function-callbacks # not now
267
- - prefer-first
318
+ - prefer-first :
319
+ exclude :
320
+ - test/**
321
+ - prefer-for-in
268
322
# - prefer-getter-over-method # way too pedantic
269
323
- prefer-immediate-return
270
324
- prefer-iterable-of
@@ -276,7 +330,9 @@ dart_code_metrics:
276
330
allowed-duplicated-chains : 3
277
331
exclude :
278
332
- test/**
279
- - prefer-named-boolean-parameters
333
+ - prefer-named-boolean-parameters :
334
+ exclude :
335
+ - test/**
280
336
# - prefer-named-imports # * OK, we just don't have global config
281
337
- prefer-named-parameters : # TODO
282
338
max-number : 2
@@ -288,6 +344,7 @@ dart_code_metrics:
288
344
- prefer-public-exception-classes
289
345
- prefer-return-await
290
346
# - prefer-returning-conditional-expressions # annoying sometimes
347
+ - prefer-simpler-boolean-expressions
291
348
- prefer-simpler-patterns-null-check
292
349
- prefer-single-declaration-per-file :
293
350
ignore-private : true
@@ -313,16 +370,19 @@ dart_code_metrics:
313
370
- avoid-misused-set-literals
314
371
- avoid-misused-test-matchers
315
372
- prefer-wildcard-pattern
373
+ - avoid-late-final-reassignment
316
374
# - tag-name # * OK, we just don't have global config
317
375
- unnecessary-trailing-comma :
318
376
max-width : 80
377
+ - use-existing-variable
319
378
320
379
# ## Flutter
321
380
# - add-copy-with # * OK, we just don't have global config
322
381
- always-remove-listener
323
382
- avoid-border-all
324
383
- avoid-empty-setstate
325
384
- avoid-expanded-as-spacer
385
+ - avoid-flexible-outside-flex
326
386
- avoid-incomplete-copy-with
327
387
- avoid-incorrect-image-opacity
328
388
- avoid-inherited-widget-in-initstate
@@ -345,14 +405,17 @@ dart_code_metrics:
345
405
- consistent-update-render-object
346
406
- dispose-fields
347
407
- prefer-action-button-tooltip
408
+ - prefer-center-over-align
348
409
- prefer-const-border-radius
349
410
- prefer-correct-edge-insets-constructor
350
411
- prefer-dedicated-media-query-methods
351
412
- prefer-define-hero-tag
352
413
- prefer-extracting-callbacks
353
414
- prefer-for-loop-in-children
415
+ - prefer-padding-over-container
354
416
- prefer-single-widget-per-file :
355
417
ignore-private-widgets : true
418
+ - prefer-sized-box-square
356
419
- prefer-sliver-prefix
357
420
- prefer-text-rich
358
421
- prefer-using-list-view
@@ -366,14 +429,22 @@ dart_code_metrics:
366
429
- avoid-watch-outside-build
367
430
- dispose-providers
368
431
- prefer-multi-provider
432
+ - prefer-provider-extensions
369
433
370
434
# ## Bloc
371
435
- avoid-bloc-public-methods
372
436
# - avoid-cubits
437
+ - avoid-duplicate-bloc-event-handlers
438
+ # - avoid-empty-build-when
373
439
# - avoid-passing-bloc-to-bloc
440
+ - avoid-passing-build-context-to-blocs
374
441
- check-is-not-closed-after-async-gap
442
+ - handle-bloc-event-subclasses
443
+ - prefer-bloc-extensions
375
444
- prefer-correct-bloc-provider
376
445
- prefer-multi-bloc-provider
446
+ - prefer-sealed-bloc-events
447
+ - prefer-sealed-bloc-state
377
448
378
449
# ## Riverpod
379
450
- avoid-calling-notifier-members-inside-build
@@ -420,6 +491,7 @@ dart_code_metrics:
420
491
# ## GetX - not used
421
492
# - always-remove-getx-listener
422
493
# - avoid-getx-rx-inside-build
494
+ # - avoid-mutable-rx-variables
423
495
# - dispose-getx-fields
424
496
# - proper-getx-super-calls
425
497
0 commit comments