Skip to content

Commit ce13eff

Browse files
authored
Merge pull request #9 from netglade/dcm-teams
Update DCM to Teams 1.6.0
2 parents 4d4cf6e + ca05a47 commit ce13eff

File tree

8 files changed

+199
-66
lines changed

8 files changed

+199
-66
lines changed

.github/workflows/ci.yaml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,16 @@ jobs:
2222
- name: Analyze
2323
run: dart analyze .
2424

25+
- name: Install DCM
26+
run: |
27+
sudo apt-get update
28+
wget -qO- https://dcm.dev/pgp-key.public | sudo gpg --dearmor -o /usr/share/keyrings/dcm.gpg
29+
echo 'deb [signed-by=/usr/share/keyrings/dcm.gpg arch=amd64] https://dcm.dev/debian stable main' | sudo tee /etc/apt/sources.list.d/dart_stable.list
30+
sudo apt-get update
31+
sudo apt-get install dcm
32+
33+
- name: DCM Analyze
34+
run: dcm analyze --reporter=github --ci-key ${{ secrets.DCM_KEY }} --email ${{ secrets.DCM_EMAIL }} .
35+
2536
- name: Dry Publish
26-
run: dart pub publish --dry-run
37+
run: dart pub publish --dry-run

CHANGELOG.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1+
## 2.0.0-rc.1
2+
- Update DCM rules to adhere DCM Teams 1.6.0.
3+
14
## 1.2.3
2-
- Fix pub dev icon
5+
- Fix pub dev icon.
36

47
## 1.2.2
5-
- Fix pub dev picture
8+
- Fix pub dev picture.
69

710
## 1.2.1
8-
- Update logo
11+
- Update logo.
912

1013
## 1.2.0
1114
- Remove `analyzer:exclude:` from `lints.yaml`. (add to README as a recommendation)

README.md

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ To use the lints, add as a dev dependency in your `pubspec.yaml`:
2727

2828
```yaml
2929
dev_dependencies:
30-
netglade_analysis: ^1.2.0
30+
netglade_analysis: ^2.0.0
3131
```
3232
3333
Then, add an include in `analysis_options.yaml`:
@@ -36,13 +36,10 @@ Then, add an include in `analysis_options.yaml`:
3636
include: package:netglade_analysis/lints.yaml
3737
```
3838

39-
To also use [Dart Code Metrics](https://dcm.dev), add configuration in `analysis_options.yaml` (and add `dart_code_metrics` to dev dependencies):
39+
To also use [Dart Code Metrics](https://dcm.dev), add configuration in `analysis_options.yaml`.
40+
Then you can use its CLI tool.
4041

4142
```yaml
42-
analyzer:
43-
plugins:
44-
- dart_code_metrics
45-
4643
dart_code_metrics:
4744
extends:
4845
- package:netglade_analysis/dcm.yaml
@@ -85,4 +82,4 @@ To indicate your project is using `netglade_analysis` →
8582

8683
[linter_rules]: https://dart.dev/tools/linter-rules
8784
[supported_lint_rules]: https://dart-lang.github.io/linter/lints
88-
[dcm_rules]: https://dcm.dev/docs/individuals/rules/
85+
[dcm_rules]: https://dcm.dev/docs/rules/

analysis_options.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,7 @@
11
include: lib/lints.yaml
2+
3+
dart_code_metrics:
4+
extends:
5+
- package:netglade_analysis/dcm.yaml
6+
pubspec-rules:
7+
prefer-publish-to-none: false

lib/dcm.yaml

Lines changed: 132 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,98 @@
1+
# version 1.6.0
12
dart_code_metrics:
3+
pubspec-rules:
4+
### Pubspec
5+
- avoid-any-version
6+
# - avoid-dependency-overrides
7+
- banned-dependencies
8+
- prefer-caret-version-syntax
9+
# - prefer-correct-package-name
10+
- prefer-correct-screenshots
11+
- prefer-publish-to-none
12+
- prefer-semver-version
13+
214
rules:
3-
### Dart
15+
### Common
416
# - arguments-ordering # way too pedantic
5-
- avoid-banned-imports
17+
# - avoid-banned-file-names
18+
# - avoid-banned-imports
19+
# - avoid-banned-types
20+
- avoid-bottom-type-in-patterns
21+
- avoid-bottom-type-in-records
622
- avoid-cascade-after-if-null
23+
- avoid-collapsible-if
724
- avoid-collection-methods-with-unrelated-types
25+
- avoid-declaring-call-method
826
- avoid-double-slash-imports
927
- avoid-duplicate-exports
28+
- avoid-duplicate-named-imports
29+
- avoid-duplicate-patterns
1030
- avoid-dynamic
31+
- avoid-equal-expressions
32+
- avoid-explicit-pattern-field-name
33+
# - avoid-explicit-type-declaration # public API
34+
- avoid-function-type-in-records
35+
- avoid-future-tostring
1136
- avoid-global-state
1237
- avoid-ignoring-return-values
38+
- avoid-inverted-boolean-checks
1339
# - avoid-late-keyword
40+
# - avoid-long-functions # way too pedantic
41+
# - avoid-long-parameter-list # doesn't play well with Flutter
42+
- avoid-long-records
43+
- avoid-missed-calls
1444
- avoid-missing-enum-constant-in-map
45+
- avoid-mixing-named-and-positional-fields
1546
- avoid-nested-conditional-expressions:
1647
acceptable-level: 2
48+
- avoid-nested-records
49+
- avoid-nested-switch-expressions
50+
- avoid-nested-switches
1751
- avoid-non-ascii-symbols
1852
- avoid-non-null-assertion:
1953
exclude:
2054
- test/**
55+
- avoid-one-field-records
2156
- avoid-passing-async-when-sync-expected:
2257
exclude:
2358
- test/**
59+
- avoid-positional-record-field-access
2460
- avoid-redundant-async
61+
- avoid-redundant-else
62+
- avoid-redundant-positional-field-name
63+
- avoid-redundant-pragma-inline
64+
- avoid-self-assignment
65+
- avoid-self-compare
66+
- avoid-shadowing:
67+
ignore-parameters: true
68+
ignored-names:
69+
- context
70+
# - avoid-similar-names # way too pedantic
71+
- avoid-substring
2572
- avoid-throw-in-catch-block
73+
- avoid-throw-objects-without-tostring
2674
- avoid-top-level-members-in-tests
27-
- avoid-unnecessary-conditionals # already in Dart lints - avoid_bool_literals_in_conditional_expressions
75+
- avoid-unassigned-late-fields-keyword
76+
- avoid-unnecessary-conditionals
77+
- avoid-unnecessary-negations
78+
- avoid-unnecessary-nullable-return-type
79+
- avoid-unnecessary-return
2880
- avoid-unnecessary-type-assertions
2981
- avoid-unnecessary-type-casts
3082
- avoid-unrelated-type-assertions
83+
- avoid-unrelated-type-casts
84+
- avoid-unsafe-collection-methods
85+
- avoid-unused-generics
3186
- avoid-unused-parameters
32-
# - ban-name
87+
# - banned-usage
3388
- binary-expression-operand-order
3489
- double-literal-format
35-
- format-comment
36-
- list-all-equatable-fields
90+
- format-comment:
91+
only-doc-comments: true
92+
# - format-test-name # good but painful
93+
- function-always-returns-null
94+
# - match-positional-field-names-on-assignment # not compatible with avoid-redundant-positional-field-name
3795
- member-ordering:
38-
# alphabetize: true
3996
order:
4097
- public-fields
4198
- private-fields
@@ -59,28 +116,43 @@ dart_code_metrics:
59116
- public-methods
60117
- private-methods
61118
- build-method
62-
- missing-test-assertion:
63-
include-assertions:
64-
- assertAllTrue
119+
- missing-test-assertion
120+
- move-records-to-typedefs:
121+
min-fields: 3
122+
min-occurrences: 3
65123
- newline-before-return
66124
- no-boolean-literal-compare
67125
- no-empty-block
68126
- no-equal-arguments:
69127
ignored-parameters:
70128
- height
71129
- width
130+
- top
131+
- right
132+
- bottom
133+
- left
134+
- topLeft
135+
- topRight
136+
- bottomLeft
137+
- bottomRight
138+
- no-equal-conditions
139+
- no-equal-switch-case
140+
- no-equal-switch-expression-cases
72141
- no-equal-then-else
73142
#- no-magic-number: # way to strict for default values of parameters etc.
74-
# exclude:
75-
# - test/**
76143
- no-object-declaration
77144
- prefer-async-await
145+
- prefer-bytes-builder
78146
- prefer-commenting-analyzer-ignores
79147
- prefer-conditional-expressions
80-
# - prefer-correct-identifier-length
148+
# - prefer-correct-identifier-length # way too pedantic
149+
- prefer-correct-switch-length
81150
- prefer-correct-test-file-name
82151
- prefer-correct-type-name
152+
- prefer-declaring-const-constructor
153+
- prefer-early-return
83154
- prefer-enums-by-name
155+
- prefer-explicit-parameter-names
84156
- prefer-first
85157
- prefer-immediate-return
86158
- prefer-iterable-of
@@ -90,37 +162,75 @@ dart_code_metrics:
90162
- test/**
91163
- prefer-moving-to-variable:
92164
allowed-duplicated-chains: 3
165+
- prefer-return-await
166+
- prefer-returning-conditional-expressions
167+
- prefer-simpler-patterns-null-check
93168
- prefer-static-class:
94169
ignore-private: true
95170
ignore-names:
96171
- (.*)Provider
97172
- use(.*)
173+
- prefer-test-matchers
98174
# - prefer-trailing-comma # already in Dart lints - require_trailing_commas
175+
# - prefer-unwrapping-future-or # we are ok with awaiting values
176+
- prefer-visible-for-testing-on-members
177+
- prefer-wildcard-pattern
99178
- tag-name
179+
- unnecessary-trailing-comma:
180+
max-width: 80
100181

101182
### Flutter
183+
- add-copy-with
102184
- always-remove-listener
103185
- avoid-border-all
186+
- avoid-empty-setstate
187+
- avoid-expanded-as-spacer
188+
- avoid-incomplete-copy-with
189+
- avoid-inherited-widget-in-initstate
190+
- avoid-late-context
104191
- avoid-returning-widgets
105192
- avoid-shrink-wrap-in-lists
193+
- avoid-state-constructors
194+
- avoid-stateless-widget-initialized-fields
106195
- avoid-unnecessary-setstate
107-
- use-setstate-synchronously
108-
- avoid-expanded-as-spacer
196+
- avoid-unnecessary-stateful-widgets
109197
- avoid-wrapping-in-padding
110198
- check-for-equals-in-render-object-setters
111199
- consistent-update-render-object
200+
- dispose-fields
201+
- prefer-action-button-tooltip
112202
- prefer-const-border-radius
113203
- prefer-correct-edge-insets-constructor
204+
- prefer-define-hero-tag
114205
- prefer-extracting-callbacks
115206
- prefer-single-widget-per-file:
116207
ignore-private-widgets: true
117208
- prefer-using-list-view
209+
# - prefer-widget-private-members # cannot use this.field in constructor
210+
- proper-super-calls
211+
- use-setstate-synchronously
212+
213+
### Provider
214+
- avoid-instantiating-in-value-provider
215+
- avoid-read-inside-build
216+
- avoid-watch-outside-build
217+
- dispose-providers
218+
- prefer-multi-provider
219+
220+
### Bloc
221+
- avoid-bloc-public-methods
222+
# - avoid-cubits
223+
# - avoid-passing-bloc-to-bloc
224+
- check-is-not-closed-after-async-gap
225+
- prefer-correct-bloc-provider
226+
- prefer-multi-bloc-provider
227+
228+
### Equatable
229+
- extend-equatable
230+
- list-all-equatable-fields
231+
232+
### Flame - not used
118233

119-
### Intl
120-
# - prefer-intl-name
121-
# - provide-correct-intl-args
234+
### Intl - not used
122235

123-
### Angular
124-
# - avoid-preserve-whitespace-false
125-
# - component-annotation-arguments-ordering
126-
# - prefer-on-push-cd-strategy
236+
### Angular - not used

0 commit comments

Comments
 (0)