Skip to content

Commit 2751b15

Browse files
committed
Adhere to DCM 1.24.0
1 parent 09ba48c commit 2751b15

File tree

5 files changed

+97
-15
lines changed

5 files changed

+97
-15
lines 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: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 13.0.0
2+
- Adhere to DCM 1.22.0, 1.23.0, and 1.24.2:
3+
-
4+
15
## 12.0.0
26
- Minimal Dart 3.5.0
37
- Adhere to DCM 1.18.0, 1.19.0, and 1.21.0:

packages/netglade_analysis/lib/dcm.yaml

Lines changed: 82 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
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-assignments-as-conditions
810
- avoid-async-call-in-sync-function
911
# - avoid-banned-annotations # * OK, we just don't have global config
1012
# - avoid-banned-file-names # * OK, we just don't have global config
@@ -20,12 +22,14 @@ dart_code_metrics:
2022
- avoid-collection-equality-checks
2123
- avoid-collection-methods-with-unrelated-types
2224
# - avoid-collection-mutating-methods # sometimes it's ok
25+
- avoid-complex-loop-conditions
2326
- avoid-conditions-with-boolean-literals
2427
- avoid-contradictory-expressions
2528
- avoid-declaring-call-method
2629
- avoid-double-slash-imports
2730
- avoid-duplicate-cascades
2831
- avoid-duplicate-collection-elements
32+
# - avoid-duplicate-constant-values # ! check later
2933
- avoid-duplicate-exports
3034
- avoid-duplicate-initializers
3135
- avoid-duplicate-map-keys
@@ -49,9 +53,13 @@ dart_code_metrics:
4953
- avoid-future-tostring
5054
- avoid-generics-shadowing
5155
- avoid-global-state
56+
# - avoid-high-cyclomatic-complexity # For now we catch this on CR.
5257
- avoid-identical-exception-handling-blocks
53-
- avoid-ignoring-return-values
58+
- avoid-ignoring-return-values:
59+
exclude:
60+
- test/**
5461
- avoid-importing-entrypoint-exports
62+
- avoid-incorrect-uri
5563
- avoid-inferrable-type-arguments:
5664
ignored-invocations:
5765
- context.read
@@ -60,7 +68,9 @@ dart_code_metrics:
6068
- avoid-inverted-boolean-checks
6169
- avoid-keywords-in-wildcard-pattern
6270
# - avoid-late-keyword
63-
- avoid-local-functions
71+
- avoid-local-functions:
72+
exclude:
73+
- test/**
6474
# - avoid-long-files # hard to get the right settings
6575
# - avoid-long-functions # way too pedantic
6676
# - avoid-long-parameter-list: # way too pedantic
@@ -75,6 +85,7 @@ dart_code_metrics:
7585
- avoid-multi-assignment
7686
# - avoid-mutating-parameters # we use ValueNotifier etc.
7787
# - avoid-negated-conditions # sometimes it might be better
88+
- avoid-negations-in-equality-checks
7889
- avoid-nested-conditional-expressions:
7990
acceptable-level: 2
8091
- avoid-nested-extension-types
@@ -86,6 +97,7 @@ dart_code_metrics:
8697
- avoid-non-ascii-symbols:
8798
exclude:
8899
- test/**
100+
# - avoid-non-empty-constructor-bodies # way too pedantic
89101
- avoid-non-null-assertion:
90102
skip-checked-fields: true
91103
exclude:
@@ -108,8 +120,9 @@ dart_code_metrics:
108120
- avoid-redundant-positional-field-name
109121
- avoid-redundant-pragma-inline
110122
- avoid-referencing-discarded-variables
123+
# - avoid-referencing-subclasses # we often use this in states and events
111124
- avoid-renaming-representation-getters
112-
- avoid-returning-cascades
125+
# - avoid-returning-cascades # collides with prefer-immediate-return
113126
- avoid-returning-void
114127
- avoid-self-assignment
115128
- avoid-self-compare
@@ -125,6 +138,7 @@ dart_code_metrics:
125138
- avoid-throw-in-catch-block
126139
- avoid-throw-objects-without-tostring
127140
- avoid-top-level-members-in-tests
141+
# - avoid-type-casts # needed when working with JSONs
128142
- avoid-unassigned-late-fields
129143
- avoid-unassigned-stream-subscriptions
130144
- avoid-uncaught-future-errors
@@ -133,12 +147,14 @@ dart_code_metrics:
133147
- avoid-unnecessary-call
134148
- avoid-unnecessary-collections
135149
- avoid-unnecessary-conditionals
150+
- avoid-unnecessary-extends
136151
- avoid-unnecessary-futures
137152
# - avoid-unnecessary-getter # it's ok to have getter for private field
138153
- avoid-unnecessary-if
139154
- avoid-unnecessary-local-late
140155
- avoid-unnecessary-negations
141156
- avoid-unnecessary-nullable-return-type
157+
- avoid-unnecessary-overrides
142158
- avoid-unnecessary-reassignment
143159
- avoid-unnecessary-return
144160
- avoid-unnecessary-super
@@ -149,6 +165,7 @@ dart_code_metrics:
149165
- avoid-unsafe-collection-methods
150166
- avoid-unsafe-reduce
151167
- avoid-unused-after-null-check
168+
- avoid-unused-assignment
152169
- avoid-unused-generics
153170
- avoid-unused-instances
154171
- avoid-unused-parameters
@@ -162,10 +179,13 @@ dart_code_metrics:
162179
- enum-constants-ordering
163180
- format-comment:
164181
only-doc-comments: true
182+
ignored-patterns:
183+
- etc.
165184
# - format-test-name # good but painful
166185
- function-always-returns-null:
167186
ignored-invocations:
168187
- useEffect
188+
- function-always-returns-same-value
169189
- handle-throwing-invocations
170190
- map-keys-ordering:
171191
exclude:
@@ -198,7 +218,14 @@ dart_code_metrics:
198218
- public-methods
199219
- build-method
200220
- 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
202229
# - missing-use-result-annotation # * OK, we just don't have global config
203230
- move-records-to-typedefs:
204231
min-fields: 3
@@ -233,10 +260,35 @@ dart_code_metrics:
233260
- no-object-declaration
234261
# - parameters-ordering # way too strict
235262
- prefer-abstract-final-static-class
263+
- prefer-add-all
236264
# - prefer-addition-subtraction-assignments # dunno
237265
- prefer-any-or-every
238266
- 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
240292
- prefer-both-inlining-annotations
241293
- prefer-bytes-builder
242294
- prefer-commenting-analyzer-ignores
@@ -252,8 +304,7 @@ dart_code_metrics:
252304
# - prefer-correct-json-casts # overkill
253305
- prefer-correct-setter-parameter-name
254306
- 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
257308
- prefer-correct-test-file-name
258309
# - prefer-correct-throws # for now hard to maintain
259310
- prefer-correct-type-name
@@ -264,7 +315,10 @@ dart_code_metrics:
264315
- prefer-explicit-parameter-names
265316
# - prefer-explicit-type-arguments # inference is better
266317
# - prefer-extracting-function-callbacks # not now
267-
- prefer-first
318+
- prefer-first:
319+
exclude:
320+
- test/**
321+
- prefer-for-in
268322
# - prefer-getter-over-method # way too pedantic
269323
- prefer-immediate-return
270324
- prefer-iterable-of
@@ -276,7 +330,9 @@ dart_code_metrics:
276330
allowed-duplicated-chains: 3
277331
exclude:
278332
- test/**
279-
- prefer-named-boolean-parameters
333+
- prefer-named-boolean-parameters:
334+
exclude:
335+
- test/**
280336
# - prefer-named-imports # * OK, we just don't have global config
281337
- prefer-named-parameters: # TODO
282338
max-number: 2
@@ -288,6 +344,7 @@ dart_code_metrics:
288344
- prefer-public-exception-classes
289345
- prefer-return-await
290346
# - prefer-returning-conditional-expressions # annoying sometimes
347+
- prefer-simpler-boolean-expressions
291348
- prefer-simpler-patterns-null-check
292349
- prefer-single-declaration-per-file:
293350
ignore-private: true
@@ -313,16 +370,19 @@ dart_code_metrics:
313370
- avoid-misused-set-literals
314371
- avoid-misused-test-matchers
315372
- prefer-wildcard-pattern
373+
- avoid-late-final-reassignment
316374
# - tag-name # * OK, we just don't have global config
317375
- unnecessary-trailing-comma:
318376
max-width: 80
377+
- use-existing-variable
319378

320379
### Flutter
321380
# - add-copy-with # * OK, we just don't have global config
322381
- always-remove-listener
323382
- avoid-border-all
324383
- avoid-empty-setstate
325384
- avoid-expanded-as-spacer
385+
- avoid-flexible-outside-flex
326386
- avoid-incomplete-copy-with
327387
- avoid-incorrect-image-opacity
328388
- avoid-inherited-widget-in-initstate
@@ -345,14 +405,17 @@ dart_code_metrics:
345405
- consistent-update-render-object
346406
- dispose-fields
347407
- prefer-action-button-tooltip
408+
- prefer-center-over-align
348409
- prefer-const-border-radius
349410
- prefer-correct-edge-insets-constructor
350411
- prefer-dedicated-media-query-methods
351412
- prefer-define-hero-tag
352413
- prefer-extracting-callbacks
353414
- prefer-for-loop-in-children
415+
- prefer-padding-over-container
354416
- prefer-single-widget-per-file:
355417
ignore-private-widgets: true
418+
- prefer-sized-box-square
356419
- prefer-sliver-prefix
357420
- prefer-text-rich
358421
- prefer-using-list-view
@@ -366,14 +429,22 @@ dart_code_metrics:
366429
- avoid-watch-outside-build
367430
- dispose-providers
368431
- prefer-multi-provider
432+
- prefer-provider-extensions
369433

370434
### Bloc
371435
- avoid-bloc-public-methods
372436
# - avoid-cubits
437+
- avoid-duplicate-bloc-event-handlers
438+
# - avoid-empty-build-when
373439
# - avoid-passing-bloc-to-bloc
440+
- avoid-passing-build-context-to-blocs
374441
- check-is-not-closed-after-async-gap
442+
- handle-bloc-event-subclasses
443+
- prefer-bloc-extensions
375444
- prefer-correct-bloc-provider
376445
- prefer-multi-bloc-provider
446+
- prefer-sealed-bloc-events
447+
- prefer-sealed-bloc-state
377448

378449
### Riverpod
379450
- avoid-calling-notifier-members-inside-build
@@ -420,6 +491,7 @@ dart_code_metrics:
420491
### GetX - not used
421492
# - always-remove-getx-listener
422493
# - avoid-getx-rx-inside-build
494+
# - avoid-mutable-rx-variables
423495
# - dispose-getx-fields
424496
# - proper-getx-super-calls
425497

packages/netglade_analysis/lib/lints.yaml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ analyzer:
1616
deprecated_member_use_from_same_package: warning
1717
record_literal_one_positional_no_trailing_comma: error
1818

19-
# version 3.1.0 - https://github.com/dart-lang/linter/blob/main/CHANGELOG.md
19+
# version 3.6.0 - https://github.com/dart-lang/sdk/blob/main/pkg/linter/CHANGELOG.md
2020
linter:
2121
rules:
2222
### ERROR
@@ -46,8 +46,8 @@ linter:
4646
- no_adjacent_strings_in_list
4747
- no_duplicate_case_values
4848
- no_logic_in_create_state
49-
# - no_self_assignments WIP
50-
# - no_wildcard_variable_uses WIP
49+
- no_self_assignments WIP
50+
- no_wildcard_variable_uses WIP
5151
# - prefer_relative_imports
5252
- prefer_void_to_null
5353
- test_types_in_equals
@@ -56,7 +56,9 @@ linter:
5656
- unrelated_type_equality_checks
5757
- unsafe_html
5858
- use_build_context_synchronously
59+
- use_build_context_synchronously
5960
- use_key_in_widget_constructors
61+
# - use_truncating_division # ! unreleased
6062
- valid_regexps
6163

6264
### STYLE
@@ -66,6 +68,7 @@ linter:
6668
- always_put_required_named_parameters_first
6769
# - always_specify_types
6870
- annotate_overrides
71+
- annotate_redeclares
6972
# - avoid_annotating_with_dynamic
7073
- avoid_bool_literals_in_conditional_expressions
7174
- avoid_catches_without_on_clauses
@@ -76,6 +79,7 @@ linter:
7679
- avoid_field_initializers_in_const_classes
7780
- avoid_final_parameters
7881
- avoid_function_literals_in_foreach_calls
82+
# - avoid_futureor_void # ! unreleased
7983
# - avoid_implementing_value_types
8084
- avoid_init_to_null
8185
- avoid_js_rounded_ints
@@ -138,6 +142,7 @@ linter:
138142
- null_check_on_nullable_type_parameter
139143
- null_closures
140144
- omit_local_variable_types
145+
# - omit_obvious_local_variable_types # ! unreleased
141146
- one_member_abstracts
142147
- only_throw_errors
143148
- overridden_fields
@@ -191,6 +196,7 @@ linter:
191196
- sort_child_properties_last
192197
# - sort_constructors_first
193198
- sort_unnamed_constructors_first
199+
# - specify_nonobvious_local_variable_types # ! undreleased
194200
- tighten_type_of_initializing_formals
195201
- type_annotate_public_apis
196202
- type_init_formals

packages/netglade_analysis/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: netglade_analysis
2-
version: 12.0.0
2+
version: 13.0.0
33
description: Lint rules for Dart and Flutter used internally at netglade.
44
repository: https://github.com/netglade/flutter_core/tree/main/packages/netglade_analysis
55
issue_tracker: https://github.com/netglade/flutter_core/issues

0 commit comments

Comments
 (0)