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-assigning-to-static-field
10
+ - avoid-assignments-as-conditions
8
11
- avoid-async-call-in-sync-function
9
12
# - avoid-banned-annotations # * OK, we just don't have global config
10
13
# - avoid-banned-file-names # * OK, we just don't have global config
@@ -20,12 +23,14 @@ dart_code_metrics:
20
23
- avoid-collection-equality-checks
21
24
- avoid-collection-methods-with-unrelated-types
22
25
# - avoid-collection-mutating-methods # sometimes it's ok
26
+ - avoid-complex-loop-conditions
23
27
- avoid-conditions-with-boolean-literals
24
28
- avoid-contradictory-expressions
25
29
- avoid-declaring-call-method
26
30
- avoid-double-slash-imports
27
31
- avoid-duplicate-cascades
28
32
- avoid-duplicate-collection-elements
33
+ # - avoid-duplicate-constant-values # ! check later, does not work for us for 2+ parameters as expected
29
34
- avoid-duplicate-exports
30
35
- avoid-duplicate-initializers
31
36
- avoid-duplicate-map-keys
@@ -48,10 +53,17 @@ dart_code_metrics:
48
53
- avoid-function-type-in-records
49
54
- avoid-future-tostring
50
55
- avoid-generics-shadowing
56
+ - avoid-getter-prefix :
57
+ prefix : " ^get"
51
58
- avoid-global-state
59
+ # - avoid-high-cyclomatic-complexity # For now we catch this on CR.
52
60
- avoid-identical-exception-handling-blocks
53
- - avoid-ignoring-return-values
61
+ - avoid-ignoring-return-values :
62
+ exclude :
63
+ - test/**
64
+ - avoid-implicitly-nullable-extension-types
54
65
- avoid-importing-entrypoint-exports
66
+ - avoid-incorrect-uri
55
67
- avoid-inferrable-type-arguments :
56
68
ignored-invocations :
57
69
- context.read
@@ -60,7 +72,9 @@ dart_code_metrics:
60
72
- avoid-inverted-boolean-checks
61
73
- avoid-keywords-in-wildcard-pattern
62
74
# - avoid-late-keyword
63
- - avoid-local-functions
75
+ - avoid-local-functions :
76
+ exclude :
77
+ - test/**
64
78
# - avoid-long-files # hard to get the right settings
65
79
# - avoid-long-functions # way too pedantic
66
80
# - avoid-long-parameter-list: # way too pedantic
@@ -75,6 +89,7 @@ dart_code_metrics:
75
89
- avoid-multi-assignment
76
90
# - avoid-mutating-parameters # we use ValueNotifier etc.
77
91
# - avoid-negated-conditions # sometimes it might be better
92
+ - avoid-negations-in-equality-checks
78
93
- avoid-nested-conditional-expressions :
79
94
acceptable-level : 2
80
95
- avoid-nested-extension-types
@@ -86,6 +101,8 @@ dart_code_metrics:
86
101
- avoid-non-ascii-symbols :
87
102
exclude :
88
103
- test/**
104
+ # - avoid-non-empty-constructor-bodies # way too pedantic
105
+ - avoid-non-final-exception-class-fields
89
106
- avoid-non-null-assertion :
90
107
skip-checked-fields : true
91
108
exclude :
@@ -108,8 +125,9 @@ dart_code_metrics:
108
125
- avoid-redundant-positional-field-name
109
126
- avoid-redundant-pragma-inline
110
127
- avoid-referencing-discarded-variables
128
+ # - avoid-referencing-subclasses # we often use this in states and events
111
129
- avoid-renaming-representation-getters
112
- - avoid-returning-cascades
130
+ # - avoid-returning-cascades # collides with prefer-immediate-return
113
131
- avoid-returning-void
114
132
- avoid-self-assignment
115
133
- avoid-self-compare
@@ -125,6 +143,7 @@ dart_code_metrics:
125
143
- avoid-throw-in-catch-block
126
144
- avoid-throw-objects-without-tostring
127
145
- avoid-top-level-members-in-tests
146
+ # - avoid-type-casts # needed when working with JSONs
128
147
- avoid-unassigned-late-fields
129
148
- avoid-unassigned-stream-subscriptions
130
149
- avoid-uncaught-future-errors
@@ -133,12 +152,17 @@ dart_code_metrics:
133
152
- avoid-unnecessary-call
134
153
- avoid-unnecessary-collections
135
154
- avoid-unnecessary-conditionals
155
+ - avoid-unnecessary-constructor
156
+ - avoid-unnecessary-enum-arguments
157
+ - avoid-unnecessary-enum-prefix
158
+ - avoid-unnecessary-extends
136
159
- avoid-unnecessary-futures
137
160
# - avoid-unnecessary-getter # it's ok to have getter for private field
138
161
- avoid-unnecessary-if
139
162
- avoid-unnecessary-local-late
140
163
- avoid-unnecessary-negations
141
164
- avoid-unnecessary-nullable-return-type
165
+ - avoid-unnecessary-overrides
142
166
- avoid-unnecessary-reassignment
143
167
- avoid-unnecessary-return
144
168
- avoid-unnecessary-super
@@ -149,6 +173,7 @@ dart_code_metrics:
149
173
- avoid-unsafe-collection-methods
150
174
- avoid-unsafe-reduce
151
175
- avoid-unused-after-null-check
176
+ - avoid-unused-assignment
152
177
- avoid-unused-generics
153
178
- avoid-unused-instances
154
179
- avoid-unused-parameters
@@ -162,10 +187,13 @@ dart_code_metrics:
162
187
- enum-constants-ordering
163
188
- format-comment :
164
189
only-doc-comments : true
190
+ ignored-patterns :
191
+ - etc.
165
192
# - format-test-name # good but painful
166
193
- function-always-returns-null :
167
194
ignored-invocations :
168
195
- useEffect
196
+ - function-always-returns-same-value
169
197
- handle-throwing-invocations
170
198
- map-keys-ordering :
171
199
exclude :
@@ -198,7 +226,14 @@ dart_code_metrics:
198
226
- public-methods
199
227
- build-method
200
228
- private-methods
201
- - missing-test-assertion
229
+ - missing-test-assertion :
230
+ include-assertions :
231
+ - called # mocktail
232
+ - calledOnce # mocktail
233
+ - verifyNoMoreInteractions # mocktail
234
+ - verifyZeroInteractions # mocktail
235
+ - blocTest # bloc_test
236
+ - blocPresentationTest # safe_bloc
202
237
# - missing-use-result-annotation # * OK, we just don't have global config
203
238
- move-records-to-typedefs :
204
239
min-fields : 3
@@ -233,14 +268,40 @@ dart_code_metrics:
233
268
- no-object-declaration
234
269
# - parameters-ordering # way too strict
235
270
- prefer-abstract-final-static-class
271
+ - prefer-add-all
236
272
# - prefer-addition-subtraction-assignments # dunno
237
273
- prefer-any-or-every
238
274
- prefer-async-await
239
- - prefer-boolean-prefixes
275
+ - prefer-boolean-prefixes :
276
+ ignored-names :
277
+ - value
278
+ - result
279
+ - " _"
280
+ prefixes :
281
+ # Defaults
282
+ - is
283
+ - are
284
+ - was
285
+ - were
286
+ - has
287
+ - have
288
+ - had
289
+ - can
290
+ - should
291
+ - will
292
+ - do
293
+ - does
294
+ - did
295
+ # New
296
+ - show
297
+ - allow
298
+ - enable
299
+ - handle # for handlers that return bool
240
300
- prefer-both-inlining-annotations
241
301
- prefer-bytes-builder
242
302
- prefer-commenting-analyzer-ignores
243
303
- prefer-conditional-expressions
304
+ - prefer-contains
244
305
- prefer-correct-callback-field-name
245
306
- prefer-correct-error-name :
246
307
allowed-names :
@@ -252,8 +313,7 @@ dart_code_metrics:
252
313
# - prefer-correct-json-casts # overkill
253
314
- prefer-correct-setter-parameter-name
254
315
- prefer-correct-stream-return-type
255
- - prefer-correct-switch-length :
256
- max-length : 20 # default value 10 is sometimes way too much
316
+ # - prefer-correct-switch-length # sometimes switch with 2 cases makes sense
257
317
- prefer-correct-test-file-name
258
318
# - prefer-correct-throws # for now hard to maintain
259
319
- prefer-correct-type-name
@@ -264,7 +324,10 @@ dart_code_metrics:
264
324
- prefer-explicit-parameter-names
265
325
# - prefer-explicit-type-arguments # inference is better
266
326
# - prefer-extracting-function-callbacks # not now
267
- - prefer-first
327
+ - prefer-first :
328
+ exclude :
329
+ - test/**
330
+ - prefer-for-in
268
331
# - prefer-getter-over-method # way too pedantic
269
332
- prefer-immediate-return
270
333
- prefer-iterable-of
@@ -276,7 +339,9 @@ dart_code_metrics:
276
339
allowed-duplicated-chains : 3
277
340
exclude :
278
341
- test/**
279
- - prefer-named-boolean-parameters
342
+ - prefer-named-boolean-parameters :
343
+ exclude :
344
+ - test/**
280
345
# - prefer-named-imports # * OK, we just don't have global config
281
346
- prefer-named-parameters : # TODO
282
347
max-number : 2
@@ -288,6 +353,7 @@ dart_code_metrics:
288
353
- prefer-public-exception-classes
289
354
- prefer-return-await
290
355
# - prefer-returning-conditional-expressions # annoying sometimes
356
+ - prefer-simpler-boolean-expressions
291
357
- prefer-simpler-patterns-null-check
292
358
- prefer-single-declaration-per-file :
293
359
ignore-private : true
@@ -313,16 +379,19 @@ dart_code_metrics:
313
379
- avoid-misused-set-literals
314
380
- avoid-misused-test-matchers
315
381
- prefer-wildcard-pattern
382
+ - avoid-late-final-reassignment
316
383
# - tag-name # * OK, we just don't have global config
317
384
- unnecessary-trailing-comma :
318
385
max-width : 80
386
+ - use-existing-variable
319
387
320
388
# ## Flutter
321
389
# - add-copy-with # * OK, we just don't have global config
322
390
- always-remove-listener
323
391
- avoid-border-all
324
392
- avoid-empty-setstate
325
393
- avoid-expanded-as-spacer
394
+ - avoid-flexible-outside-flex
326
395
- avoid-incomplete-copy-with
327
396
- avoid-incorrect-image-opacity
328
397
- avoid-inherited-widget-in-initstate
@@ -345,14 +414,17 @@ dart_code_metrics:
345
414
- consistent-update-render-object
346
415
- dispose-fields
347
416
- prefer-action-button-tooltip
417
+ - prefer-center-over-align
348
418
- prefer-const-border-radius
349
419
- prefer-correct-edge-insets-constructor
350
420
- prefer-dedicated-media-query-methods
351
421
- prefer-define-hero-tag
352
422
- prefer-extracting-callbacks
353
423
- prefer-for-loop-in-children
424
+ - prefer-padding-over-container
354
425
- prefer-single-widget-per-file :
355
426
ignore-private-widgets : true
427
+ - prefer-sized-box-square
356
428
- prefer-sliver-prefix
357
429
- prefer-text-rich
358
430
- prefer-using-list-view
@@ -366,14 +438,22 @@ dart_code_metrics:
366
438
- avoid-watch-outside-build
367
439
- dispose-providers
368
440
- prefer-multi-provider
441
+ - prefer-provider-extensions
369
442
370
443
# ## Bloc
371
444
- avoid-bloc-public-methods
372
- # - avoid-cubits
445
+ # - avoid-cubits # we use cubits in some places
446
+ - avoid-duplicate-bloc-event-handlers
447
+ # - avoid-empty-build-when
373
448
# - avoid-passing-bloc-to-bloc
449
+ - avoid-passing-build-context-to-blocs
374
450
- check-is-not-closed-after-async-gap
451
+ - handle-bloc-event-subclasses
452
+ - prefer-bloc-extensions
375
453
- prefer-correct-bloc-provider
376
454
- prefer-multi-bloc-provider
455
+ - prefer-sealed-bloc-events
456
+ - prefer-sealed-bloc-state
377
457
378
458
# ## Riverpod
379
459
- avoid-calling-notifier-members-inside-build
@@ -420,6 +500,7 @@ dart_code_metrics:
420
500
# ## GetX - not used
421
501
# - always-remove-getx-listener
422
502
# - avoid-getx-rx-inside-build
503
+ # - avoid-mutable-rx-variables
423
504
# - dispose-getx-fields
424
505
# - proper-getx-super-calls
425
506
@@ -447,5 +528,6 @@ dart_code_metrics:
447
528
- prefer-caret-version-syntax
448
529
# - prefer-correct-package-name # * OK, we just don't have global config
449
530
- prefer-correct-screenshots
531
+ # - prefer-pinned-version-syntax # we use prefer-caret-version-syntax
450
532
- prefer-publish-to-none
451
533
- prefer-semver-version
0 commit comments