Skip to content

Commit e3a85d3

Browse files
authored
Merge pull request #52 from netglade/dcm-1.24.0
Adhere to DCM 1.24.0
2 parents 09ba48c + 7001dfc commit e3a85d3

File tree

6 files changed

+141
-18
lines changed

6 files changed

+141
-18
lines changed

.github/workflows/ci.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
- uses: actions/checkout@v4
1818

1919
- name: Configure FVM
20-
uses: kuhnroyal/flutter-fvm-config-action@v2
20+
uses: kuhnroyal/flutter-fvm-config-action@v3
2121
id: fvm-config-action
2222
- name: Setup Flutter and Dart
2323
uses: subosito/flutter-action@v2
@@ -26,7 +26,7 @@ jobs:
2626
channel: ${{ steps.fvm-config-action.outputs.FLUTTER_CHANNEL }}
2727

2828
- name: Setup Melos
29-
uses: bluefireteam/melos-action@v2
29+
uses: bluefireteam/melos-action@v3
3030

3131
- name: Format
3232
run: dart format --line-length 120 --set-exit-if-changed .

dcm_global.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
version: "1.21.1"
1+
version: "1.24.2"

packages/netglade_analysis/CHANGELOG.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,39 @@
1+
## 13.0.0
2+
- Adhere to DCM 1.22.0, 1.23.0, and 1.24.2:
3+
- Add avoid-adjacent-strings
4+
- Add avoid-assignments-as-conditions
5+
- Add avoid-complex-loop-conditions
6+
- Add avoid-incorrect-uri
7+
- Add avoid-negations-in-equality-checks
8+
- Add avoid-unnecessary-extends
9+
- Add avoid-unnecessary-overrides
10+
- Add avoid-unused-assignment
11+
- Add function-always-returns-same-value
12+
- Add prefer-add-all
13+
- Add prefer-for-in
14+
- Add prefer-simpler-boolean-expressions
15+
- Add avoid-late-final-reassignment
16+
- Add use-existing-variable
17+
- Add avoid-flexible-outside-flex
18+
- Add prefer-center-over-align
19+
- Add prefer-padding-over-container
20+
- Add prefer-sized-box-square
21+
- Add prefer-provider-extensions
22+
- Add avoid-duplicate-bloc-event-handlers
23+
- Add avoid-passing-build-context-to-blocs
24+
- Add handle-bloc-event-subclasses
25+
- Add prefer-bloc-extensions
26+
- Add prefer-sealed-bloc-events
27+
- Add prefer-sealed-bloc-state
28+
- Add avoid-assigning-to-static-field
29+
- Add avoid-getter-prefix
30+
- Add avoid-implicitly-nullable-extension-types
31+
- Add avoid-non-final-exception-class-fields
32+
- Add avoid-unnecessary-constructor
33+
- Add avoid-unnecessary-enum-arguments
34+
- Add avoid-unnecessary-enum-prefix
35+
- Add prefer-contains
36+
137
## 12.0.0
238
- Minimal Dart 3.5.0
339
- Adhere to DCM 1.18.0, 1.19.0, and 1.21.0:

packages/netglade_analysis/lib/dcm.yaml

Lines changed: 93 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1-
# version 1.21.0 - https://dcm.dev/changelog
1+
# version 1.24.0 - https://dcm.dev/changelog
22
dart_code_metrics:
33
rules:
44
### Common
55
# - arguments-ordering # way too pedantic
66
- avoid-accessing-collections-by-constant-index
77
- avoid-accessing-other-classes-private-members
8+
- avoid-adjacent-strings
9+
- avoid-assigning-to-static-field
10+
- avoid-assignments-as-conditions
811
- avoid-async-call-in-sync-function
912
# - avoid-banned-annotations # * OK, we just don't have global config
1013
# - avoid-banned-file-names # * OK, we just don't have global config
@@ -20,12 +23,14 @@ dart_code_metrics:
2023
- avoid-collection-equality-checks
2124
- avoid-collection-methods-with-unrelated-types
2225
# - avoid-collection-mutating-methods # sometimes it's ok
26+
- avoid-complex-loop-conditions
2327
- avoid-conditions-with-boolean-literals
2428
- avoid-contradictory-expressions
2529
- avoid-declaring-call-method
2630
- avoid-double-slash-imports
2731
- avoid-duplicate-cascades
2832
- avoid-duplicate-collection-elements
33+
# - avoid-duplicate-constant-values # ! check later, does not work for us for 2+ parameters as expected
2934
- avoid-duplicate-exports
3035
- avoid-duplicate-initializers
3136
- avoid-duplicate-map-keys
@@ -48,10 +53,17 @@ dart_code_metrics:
4853
- avoid-function-type-in-records
4954
- avoid-future-tostring
5055
- avoid-generics-shadowing
56+
- avoid-getter-prefix:
57+
prefix: "^get"
5158
- avoid-global-state
59+
# - avoid-high-cyclomatic-complexity # For now we catch this on CR.
5260
- 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
5465
- avoid-importing-entrypoint-exports
66+
- avoid-incorrect-uri
5567
- avoid-inferrable-type-arguments:
5668
ignored-invocations:
5769
- context.read
@@ -60,7 +72,9 @@ dart_code_metrics:
6072
- avoid-inverted-boolean-checks
6173
- avoid-keywords-in-wildcard-pattern
6274
# - avoid-late-keyword
63-
- avoid-local-functions
75+
- avoid-local-functions:
76+
exclude:
77+
- test/**
6478
# - avoid-long-files # hard to get the right settings
6579
# - avoid-long-functions # way too pedantic
6680
# - avoid-long-parameter-list: # way too pedantic
@@ -75,6 +89,7 @@ dart_code_metrics:
7589
- avoid-multi-assignment
7690
# - avoid-mutating-parameters # we use ValueNotifier etc.
7791
# - avoid-negated-conditions # sometimes it might be better
92+
- avoid-negations-in-equality-checks
7893
- avoid-nested-conditional-expressions:
7994
acceptable-level: 2
8095
- avoid-nested-extension-types
@@ -86,6 +101,8 @@ dart_code_metrics:
86101
- avoid-non-ascii-symbols:
87102
exclude:
88103
- test/**
104+
# - avoid-non-empty-constructor-bodies # way too pedantic
105+
- avoid-non-final-exception-class-fields
89106
- avoid-non-null-assertion:
90107
skip-checked-fields: true
91108
exclude:
@@ -108,8 +125,9 @@ dart_code_metrics:
108125
- avoid-redundant-positional-field-name
109126
- avoid-redundant-pragma-inline
110127
- avoid-referencing-discarded-variables
128+
# - avoid-referencing-subclasses # we often use this in states and events
111129
- avoid-renaming-representation-getters
112-
- avoid-returning-cascades
130+
# - avoid-returning-cascades # collides with prefer-immediate-return
113131
- avoid-returning-void
114132
- avoid-self-assignment
115133
- avoid-self-compare
@@ -125,6 +143,7 @@ dart_code_metrics:
125143
- avoid-throw-in-catch-block
126144
- avoid-throw-objects-without-tostring
127145
- avoid-top-level-members-in-tests
146+
# - avoid-type-casts # needed when working with JSONs
128147
- avoid-unassigned-late-fields
129148
- avoid-unassigned-stream-subscriptions
130149
- avoid-uncaught-future-errors
@@ -133,12 +152,17 @@ dart_code_metrics:
133152
- avoid-unnecessary-call
134153
- avoid-unnecessary-collections
135154
- avoid-unnecessary-conditionals
155+
- avoid-unnecessary-constructor
156+
- avoid-unnecessary-enum-arguments
157+
- avoid-unnecessary-enum-prefix
158+
- avoid-unnecessary-extends
136159
- avoid-unnecessary-futures
137160
# - avoid-unnecessary-getter # it's ok to have getter for private field
138161
- avoid-unnecessary-if
139162
- avoid-unnecessary-local-late
140163
- avoid-unnecessary-negations
141164
- avoid-unnecessary-nullable-return-type
165+
- avoid-unnecessary-overrides
142166
- avoid-unnecessary-reassignment
143167
- avoid-unnecessary-return
144168
- avoid-unnecessary-super
@@ -149,6 +173,7 @@ dart_code_metrics:
149173
- avoid-unsafe-collection-methods
150174
- avoid-unsafe-reduce
151175
- avoid-unused-after-null-check
176+
- avoid-unused-assignment
152177
- avoid-unused-generics
153178
- avoid-unused-instances
154179
- avoid-unused-parameters
@@ -162,10 +187,13 @@ dart_code_metrics:
162187
- enum-constants-ordering
163188
- format-comment:
164189
only-doc-comments: true
190+
ignored-patterns:
191+
- etc.
165192
# - format-test-name # good but painful
166193
- function-always-returns-null:
167194
ignored-invocations:
168195
- useEffect
196+
- function-always-returns-same-value
169197
- handle-throwing-invocations
170198
- map-keys-ordering:
171199
exclude:
@@ -198,7 +226,14 @@ dart_code_metrics:
198226
- public-methods
199227
- build-method
200228
- 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
202237
# - missing-use-result-annotation # * OK, we just don't have global config
203238
- move-records-to-typedefs:
204239
min-fields: 3
@@ -233,14 +268,40 @@ dart_code_metrics:
233268
- no-object-declaration
234269
# - parameters-ordering # way too strict
235270
- prefer-abstract-final-static-class
271+
- prefer-add-all
236272
# - prefer-addition-subtraction-assignments # dunno
237273
- prefer-any-or-every
238274
- 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
240300
- prefer-both-inlining-annotations
241301
- prefer-bytes-builder
242302
- prefer-commenting-analyzer-ignores
243303
- prefer-conditional-expressions
304+
- prefer-contains
244305
- prefer-correct-callback-field-name
245306
- prefer-correct-error-name:
246307
allowed-names:
@@ -252,8 +313,7 @@ dart_code_metrics:
252313
# - prefer-correct-json-casts # overkill
253314
- prefer-correct-setter-parameter-name
254315
- 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
257317
- prefer-correct-test-file-name
258318
# - prefer-correct-throws # for now hard to maintain
259319
- prefer-correct-type-name
@@ -264,7 +324,10 @@ dart_code_metrics:
264324
- prefer-explicit-parameter-names
265325
# - prefer-explicit-type-arguments # inference is better
266326
# - prefer-extracting-function-callbacks # not now
267-
- prefer-first
327+
- prefer-first:
328+
exclude:
329+
- test/**
330+
- prefer-for-in
268331
# - prefer-getter-over-method # way too pedantic
269332
- prefer-immediate-return
270333
- prefer-iterable-of
@@ -276,7 +339,9 @@ dart_code_metrics:
276339
allowed-duplicated-chains: 3
277340
exclude:
278341
- test/**
279-
- prefer-named-boolean-parameters
342+
- prefer-named-boolean-parameters:
343+
exclude:
344+
- test/**
280345
# - prefer-named-imports # * OK, we just don't have global config
281346
- prefer-named-parameters: # TODO
282347
max-number: 2
@@ -288,6 +353,7 @@ dart_code_metrics:
288353
- prefer-public-exception-classes
289354
- prefer-return-await
290355
# - prefer-returning-conditional-expressions # annoying sometimes
356+
- prefer-simpler-boolean-expressions
291357
- prefer-simpler-patterns-null-check
292358
- prefer-single-declaration-per-file:
293359
ignore-private: true
@@ -313,16 +379,19 @@ dart_code_metrics:
313379
- avoid-misused-set-literals
314380
- avoid-misused-test-matchers
315381
- prefer-wildcard-pattern
382+
- avoid-late-final-reassignment
316383
# - tag-name # * OK, we just don't have global config
317384
- unnecessary-trailing-comma:
318385
max-width: 80
386+
- use-existing-variable
319387

320388
### Flutter
321389
# - add-copy-with # * OK, we just don't have global config
322390
- always-remove-listener
323391
- avoid-border-all
324392
- avoid-empty-setstate
325393
- avoid-expanded-as-spacer
394+
- avoid-flexible-outside-flex
326395
- avoid-incomplete-copy-with
327396
- avoid-incorrect-image-opacity
328397
- avoid-inherited-widget-in-initstate
@@ -345,14 +414,17 @@ dart_code_metrics:
345414
- consistent-update-render-object
346415
- dispose-fields
347416
- prefer-action-button-tooltip
417+
- prefer-center-over-align
348418
- prefer-const-border-radius
349419
- prefer-correct-edge-insets-constructor
350420
- prefer-dedicated-media-query-methods
351421
- prefer-define-hero-tag
352422
- prefer-extracting-callbacks
353423
- prefer-for-loop-in-children
424+
- prefer-padding-over-container
354425
- prefer-single-widget-per-file:
355426
ignore-private-widgets: true
427+
- prefer-sized-box-square
356428
- prefer-sliver-prefix
357429
- prefer-text-rich
358430
- prefer-using-list-view
@@ -366,14 +438,22 @@ dart_code_metrics:
366438
- avoid-watch-outside-build
367439
- dispose-providers
368440
- prefer-multi-provider
441+
- prefer-provider-extensions
369442

370443
### Bloc
371444
- 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
373448
# - avoid-passing-bloc-to-bloc
449+
- avoid-passing-build-context-to-blocs
374450
- check-is-not-closed-after-async-gap
451+
- handle-bloc-event-subclasses
452+
- prefer-bloc-extensions
375453
- prefer-correct-bloc-provider
376454
- prefer-multi-bloc-provider
455+
- prefer-sealed-bloc-events
456+
- prefer-sealed-bloc-state
377457

378458
### Riverpod
379459
- avoid-calling-notifier-members-inside-build
@@ -420,6 +500,7 @@ dart_code_metrics:
420500
### GetX - not used
421501
# - always-remove-getx-listener
422502
# - avoid-getx-rx-inside-build
503+
# - avoid-mutable-rx-variables
423504
# - dispose-getx-fields
424505
# - proper-getx-super-calls
425506

@@ -447,5 +528,6 @@ dart_code_metrics:
447528
- prefer-caret-version-syntax
448529
# - prefer-correct-package-name # * OK, we just don't have global config
449530
- prefer-correct-screenshots
531+
# - prefer-pinned-version-syntax # we use prefer-caret-version-syntax
450532
- prefer-publish-to-none
451533
- prefer-semver-version

0 commit comments

Comments
 (0)