Skip to content

Commit

Permalink
Merge pull request #52 from netglade/dcm-1.24.0
Browse files Browse the repository at this point in the history
Adhere to DCM 1.24.0
  • Loading branch information
tenhobi authored Nov 14, 2024
2 parents 09ba48c + 7001dfc commit e3a85d3
Show file tree
Hide file tree
Showing 6 changed files with 141 additions and 18 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- uses: actions/checkout@v4

- name: Configure FVM
uses: kuhnroyal/flutter-fvm-config-action@v2
uses: kuhnroyal/flutter-fvm-config-action@v3
id: fvm-config-action
- name: Setup Flutter and Dart
uses: subosito/flutter-action@v2
Expand All @@ -26,7 +26,7 @@ jobs:
channel: ${{ steps.fvm-config-action.outputs.FLUTTER_CHANNEL }}

- name: Setup Melos
uses: bluefireteam/melos-action@v2
uses: bluefireteam/melos-action@v3

- name: Format
run: dart format --line-length 120 --set-exit-if-changed .
Expand Down
2 changes: 1 addition & 1 deletion dcm_global.yaml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version: "1.21.1"
version: "1.24.2"
36 changes: 36 additions & 0 deletions packages/netglade_analysis/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,39 @@
## 13.0.0
- Adhere to DCM 1.22.0, 1.23.0, and 1.24.2:
- Add avoid-adjacent-strings
- Add avoid-assignments-as-conditions
- Add avoid-complex-loop-conditions
- Add avoid-incorrect-uri
- Add avoid-negations-in-equality-checks
- Add avoid-unnecessary-extends
- Add avoid-unnecessary-overrides
- Add avoid-unused-assignment
- Add function-always-returns-same-value
- Add prefer-add-all
- Add prefer-for-in
- Add prefer-simpler-boolean-expressions
- Add avoid-late-final-reassignment
- Add use-existing-variable
- Add avoid-flexible-outside-flex
- Add prefer-center-over-align
- Add prefer-padding-over-container
- Add prefer-sized-box-square
- Add prefer-provider-extensions
- Add avoid-duplicate-bloc-event-handlers
- Add avoid-passing-build-context-to-blocs
- Add handle-bloc-event-subclasses
- Add prefer-bloc-extensions
- Add prefer-sealed-bloc-events
- Add prefer-sealed-bloc-state
- Add avoid-assigning-to-static-field
- Add avoid-getter-prefix
- Add avoid-implicitly-nullable-extension-types
- Add avoid-non-final-exception-class-fields
- Add avoid-unnecessary-constructor
- Add avoid-unnecessary-enum-arguments
- Add avoid-unnecessary-enum-prefix
- Add prefer-contains

## 12.0.0
- Minimal Dart 3.5.0
- Adhere to DCM 1.18.0, 1.19.0, and 1.21.0:
Expand Down
104 changes: 93 additions & 11 deletions packages/netglade_analysis/lib/dcm.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
# version 1.21.0 - https://dcm.dev/changelog
# version 1.24.0 - https://dcm.dev/changelog
dart_code_metrics:
rules:
### Common
# - arguments-ordering # way too pedantic
- avoid-accessing-collections-by-constant-index
- avoid-accessing-other-classes-private-members
- avoid-adjacent-strings
- avoid-assigning-to-static-field
- avoid-assignments-as-conditions
- avoid-async-call-in-sync-function
# - avoid-banned-annotations # * OK, we just don't have global config
# - avoid-banned-file-names # * OK, we just don't have global config
Expand All @@ -20,12 +23,14 @@ dart_code_metrics:
- avoid-collection-equality-checks
- avoid-collection-methods-with-unrelated-types
# - avoid-collection-mutating-methods # sometimes it's ok
- avoid-complex-loop-conditions
- avoid-conditions-with-boolean-literals
- avoid-contradictory-expressions
- avoid-declaring-call-method
- avoid-double-slash-imports
- avoid-duplicate-cascades
- avoid-duplicate-collection-elements
# - avoid-duplicate-constant-values # ! check later, does not work for us for 2+ parameters as expected
- avoid-duplicate-exports
- avoid-duplicate-initializers
- avoid-duplicate-map-keys
Expand All @@ -48,10 +53,17 @@ dart_code_metrics:
- avoid-function-type-in-records
- avoid-future-tostring
- avoid-generics-shadowing
- avoid-getter-prefix:
prefix: "^get"
- avoid-global-state
# - avoid-high-cyclomatic-complexity # For now we catch this on CR.
- avoid-identical-exception-handling-blocks
- avoid-ignoring-return-values
- avoid-ignoring-return-values:
exclude:
- test/**
- avoid-implicitly-nullable-extension-types
- avoid-importing-entrypoint-exports
- avoid-incorrect-uri
- avoid-inferrable-type-arguments:
ignored-invocations:
- context.read
Expand All @@ -60,7 +72,9 @@ dart_code_metrics:
- avoid-inverted-boolean-checks
- avoid-keywords-in-wildcard-pattern
# - avoid-late-keyword
- avoid-local-functions
- avoid-local-functions:
exclude:
- test/**
# - avoid-long-files # hard to get the right settings
# - avoid-long-functions # way too pedantic
# - avoid-long-parameter-list: # way too pedantic
Expand All @@ -75,6 +89,7 @@ dart_code_metrics:
- avoid-multi-assignment
# - avoid-mutating-parameters # we use ValueNotifier etc.
# - avoid-negated-conditions # sometimes it might be better
- avoid-negations-in-equality-checks
- avoid-nested-conditional-expressions:
acceptable-level: 2
- avoid-nested-extension-types
Expand All @@ -86,6 +101,8 @@ dart_code_metrics:
- avoid-non-ascii-symbols:
exclude:
- test/**
# - avoid-non-empty-constructor-bodies # way too pedantic
- avoid-non-final-exception-class-fields
- avoid-non-null-assertion:
skip-checked-fields: true
exclude:
Expand All @@ -108,8 +125,9 @@ dart_code_metrics:
- avoid-redundant-positional-field-name
- avoid-redundant-pragma-inline
- avoid-referencing-discarded-variables
# - avoid-referencing-subclasses # we often use this in states and events
- avoid-renaming-representation-getters
- avoid-returning-cascades
# - avoid-returning-cascades # collides with prefer-immediate-return
- avoid-returning-void
- avoid-self-assignment
- avoid-self-compare
Expand All @@ -125,6 +143,7 @@ dart_code_metrics:
- avoid-throw-in-catch-block
- avoid-throw-objects-without-tostring
- avoid-top-level-members-in-tests
# - avoid-type-casts # needed when working with JSONs
- avoid-unassigned-late-fields
- avoid-unassigned-stream-subscriptions
- avoid-uncaught-future-errors
Expand All @@ -133,12 +152,17 @@ dart_code_metrics:
- avoid-unnecessary-call
- avoid-unnecessary-collections
- avoid-unnecessary-conditionals
- avoid-unnecessary-constructor
- avoid-unnecessary-enum-arguments
- avoid-unnecessary-enum-prefix
- avoid-unnecessary-extends
- avoid-unnecessary-futures
# - avoid-unnecessary-getter # it's ok to have getter for private field
- avoid-unnecessary-if
- avoid-unnecessary-local-late
- avoid-unnecessary-negations
- avoid-unnecessary-nullable-return-type
- avoid-unnecessary-overrides
- avoid-unnecessary-reassignment
- avoid-unnecessary-return
- avoid-unnecessary-super
Expand All @@ -149,6 +173,7 @@ dart_code_metrics:
- avoid-unsafe-collection-methods
- avoid-unsafe-reduce
- avoid-unused-after-null-check
- avoid-unused-assignment
- avoid-unused-generics
- avoid-unused-instances
- avoid-unused-parameters
Expand All @@ -162,10 +187,13 @@ dart_code_metrics:
- enum-constants-ordering
- format-comment:
only-doc-comments: true
ignored-patterns:
- etc.
# - format-test-name # good but painful
- function-always-returns-null:
ignored-invocations:
- useEffect
- function-always-returns-same-value
- handle-throwing-invocations
- map-keys-ordering:
exclude:
Expand Down Expand Up @@ -198,7 +226,14 @@ dart_code_metrics:
- public-methods
- build-method
- private-methods
- missing-test-assertion
- missing-test-assertion:
include-assertions:
- called # mocktail
- calledOnce # mocktail
- verifyNoMoreInteractions # mocktail
- verifyZeroInteractions # mocktail
- blocTest # bloc_test
- blocPresentationTest # safe_bloc
# - missing-use-result-annotation # * OK, we just don't have global config
- move-records-to-typedefs:
min-fields: 3
Expand Down Expand Up @@ -233,14 +268,40 @@ dart_code_metrics:
- no-object-declaration
# - parameters-ordering # way too strict
- prefer-abstract-final-static-class
- prefer-add-all
# - prefer-addition-subtraction-assignments # dunno
- prefer-any-or-every
- prefer-async-await
- prefer-boolean-prefixes
- prefer-boolean-prefixes:
ignored-names:
- value
- result
- "_"
prefixes:
# Defaults
- is
- are
- was
- were
- has
- have
- had
- can
- should
- will
- do
- does
- did
# New
- show
- allow
- enable
- handle # for handlers that return bool
- prefer-both-inlining-annotations
- prefer-bytes-builder
- prefer-commenting-analyzer-ignores
- prefer-conditional-expressions
- prefer-contains
- prefer-correct-callback-field-name
- prefer-correct-error-name:
allowed-names:
Expand All @@ -252,8 +313,7 @@ dart_code_metrics:
# - prefer-correct-json-casts # overkill
- prefer-correct-setter-parameter-name
- prefer-correct-stream-return-type
- prefer-correct-switch-length:
max-length: 20 # default value 10 is sometimes way too much
# - prefer-correct-switch-length # sometimes switch with 2 cases makes sense
- prefer-correct-test-file-name
# - prefer-correct-throws # for now hard to maintain
- prefer-correct-type-name
Expand All @@ -264,7 +324,10 @@ dart_code_metrics:
- prefer-explicit-parameter-names
# - prefer-explicit-type-arguments # inference is better
# - prefer-extracting-function-callbacks # not now
- prefer-first
- prefer-first:
exclude:
- test/**
- prefer-for-in
# - prefer-getter-over-method # way too pedantic
- prefer-immediate-return
- prefer-iterable-of
Expand All @@ -276,7 +339,9 @@ dart_code_metrics:
allowed-duplicated-chains: 3
exclude:
- test/**
- prefer-named-boolean-parameters
- prefer-named-boolean-parameters:
exclude:
- test/**
# - prefer-named-imports # * OK, we just don't have global config
- prefer-named-parameters: # TODO
max-number: 2
Expand All @@ -288,6 +353,7 @@ dart_code_metrics:
- prefer-public-exception-classes
- prefer-return-await
# - prefer-returning-conditional-expressions # annoying sometimes
- prefer-simpler-boolean-expressions
- prefer-simpler-patterns-null-check
- prefer-single-declaration-per-file:
ignore-private: true
Expand All @@ -313,16 +379,19 @@ dart_code_metrics:
- avoid-misused-set-literals
- avoid-misused-test-matchers
- prefer-wildcard-pattern
- avoid-late-final-reassignment
# - tag-name # * OK, we just don't have global config
- unnecessary-trailing-comma:
max-width: 80
- use-existing-variable

### Flutter
# - add-copy-with # * OK, we just don't have global config
- always-remove-listener
- avoid-border-all
- avoid-empty-setstate
- avoid-expanded-as-spacer
- avoid-flexible-outside-flex
- avoid-incomplete-copy-with
- avoid-incorrect-image-opacity
- avoid-inherited-widget-in-initstate
Expand All @@ -345,14 +414,17 @@ dart_code_metrics:
- consistent-update-render-object
- dispose-fields
- prefer-action-button-tooltip
- prefer-center-over-align
- prefer-const-border-radius
- prefer-correct-edge-insets-constructor
- prefer-dedicated-media-query-methods
- prefer-define-hero-tag
- prefer-extracting-callbacks
- prefer-for-loop-in-children
- prefer-padding-over-container
- prefer-single-widget-per-file:
ignore-private-widgets: true
- prefer-sized-box-square
- prefer-sliver-prefix
- prefer-text-rich
- prefer-using-list-view
Expand All @@ -366,14 +438,22 @@ dart_code_metrics:
- avoid-watch-outside-build
- dispose-providers
- prefer-multi-provider
- prefer-provider-extensions

### Bloc
- avoid-bloc-public-methods
# - avoid-cubits
# - avoid-cubits # we use cubits in some places
- avoid-duplicate-bloc-event-handlers
# - avoid-empty-build-when
# - avoid-passing-bloc-to-bloc
- avoid-passing-build-context-to-blocs
- check-is-not-closed-after-async-gap
- handle-bloc-event-subclasses
- prefer-bloc-extensions
- prefer-correct-bloc-provider
- prefer-multi-bloc-provider
- prefer-sealed-bloc-events
- prefer-sealed-bloc-state

### Riverpod
- avoid-calling-notifier-members-inside-build
Expand Down Expand Up @@ -420,6 +500,7 @@ dart_code_metrics:
### GetX - not used
# - always-remove-getx-listener
# - avoid-getx-rx-inside-build
# - avoid-mutable-rx-variables
# - dispose-getx-fields
# - proper-getx-super-calls

Expand Down Expand Up @@ -447,5 +528,6 @@ dart_code_metrics:
- prefer-caret-version-syntax
# - prefer-correct-package-name # * OK, we just don't have global config
- prefer-correct-screenshots
# - prefer-pinned-version-syntax # we use prefer-caret-version-syntax
- prefer-publish-to-none
- prefer-semver-version
Loading

0 comments on commit e3a85d3

Please sign in to comment.