Skip to content

Commit 32332ba

Browse files
authored
Merge pull request #11 from netglade/adhere-to-dcm-1.7.0
Adhere to DCM 1.7.0
2 parents 87f85ec + c1626e1 commit 32332ba

File tree

5 files changed

+79
-17
lines changed

5 files changed

+79
-17
lines changed

.github/workflows/ci.yaml

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,20 @@ jobs:
2323
run: dart analyze .
2424

2525
- 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 }} --fatal-style --fatal-performance --fatal-warnings .
26+
uses: CQLabs/setup-dcm@v1.0.0
27+
with:
28+
github_token: ${{ secrets.GITHUB_TOKEN }}
29+
30+
- name: Run DCM
31+
uses: CQLabs/dcm-action@v1.0.0
32+
with:
33+
github_token: ${{ secrets.GITHUB_TOKEN }}
34+
ci_key: ${{ secrets.DCM_KEY }}
35+
email: ${{ secrets.DCM_EMAIL }}
36+
folders: .
37+
fatal_style: true
38+
fatal_performance: true
39+
fatal_warnings: true
3540

3641
- name: Dry Publish
3742
run: dart pub publish --dry-run

CHANGELOG.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,29 @@
1+
## 3.0.0
2+
- Adhere to DCM 1.7.0:
3+
- Add avoid-accessing-other-classes-private-members
4+
- Add avoid-generics-shadowing
5+
- Add avoid-keywords-in-wildcard-pattern
6+
- Add avoid-misused-wildcard-pattern
7+
- Add avoid-nested-futures
8+
- Add avoid-nested-streams-and-futures
9+
- Add avoid-shadowed-extension-methods
10+
- Add avoid-uncaught-future-errors
11+
- Add avoid-unnecessary-call
12+
- Add avoid-unnecessary-futures
13+
- Add map-keys-ordering
14+
- Add no-equal-nested-conditions
15+
- Add prefer-correct-future-return-type
16+
- Add prefer-correct-stream-return-type
17+
- Add prefer-parentheses-with-if-null
18+
- Add prefer-trailing-comma
19+
- Add avoid-missing-image-alt
20+
- Add avoid-unnecessary-overrides-in-state
21+
- Add prefer-dedicated-media-query-methods
22+
- Update allow-false for no-boolean-literal-compare
23+
- Disable in tests avoid-non-ascii-symbols
24+
- Disable in tests prefer-moving-to-variable
25+
- Remove avoid-long-parameter-list
26+
127
## 2.0.1
228
- Fix README logo
329

lib/dcm.yaml

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# version 1.6.0 - https://dcm.dev/changelog/
1+
# version 1.7.0 - https://dcm.dev/changelog/
22
dart_code_metrics:
33
pubspec-rules:
44
### Pubspec
@@ -14,9 +14,11 @@ dart_code_metrics:
1414
rules:
1515
### Common
1616
# - arguments-ordering # way too pedantic
17+
- avoid-accessing-other-classes-private-members
1718
# - avoid-banned-file-names
1819
# - avoid-banned-imports
1920
# - avoid-banned-types
21+
# - avoid-barrel-files # for now we use them
2022
- avoid-bottom-type-in-patterns
2123
- avoid-bottom-type-in-records
2224
- avoid-cascade-after-if-null
@@ -33,23 +35,33 @@ dart_code_metrics:
3335
# - avoid-explicit-type-declaration # public API
3436
- avoid-function-type-in-records
3537
- avoid-future-tostring
38+
- avoid-generics-shadowing
3639
- avoid-global-state
3740
- avoid-ignoring-return-values
41+
# - avoid-importing-entrypoint-exports: false # TODO: has false positives in monorepo
3842
- avoid-inverted-boolean-checks
43+
- avoid-keywords-in-wildcard-pattern
3944
# - avoid-late-keyword
4045
# - avoid-long-functions # way too pedantic
41-
- avoid-long-parameter-list:
42-
ignore-optional: true # exclude optional and (required) named parameters
46+
# - avoid-long-parameter-list: # way too pedantic
47+
# ignore-optional: true # exclude optional and (non-required) named parameters
4348
- avoid-long-records
4449
- avoid-missed-calls
4550
- avoid-missing-enum-constant-in-map
51+
- avoid-misused-wildcard-pattern
4652
- avoid-mixing-named-and-positional-fields
53+
# - avoid-mutating-parameters # we use ValueNotifier etc.
54+
# - avoid-negated-conditions # sometimes it might be better
4755
- avoid-nested-conditional-expressions:
4856
acceptable-level: 2
57+
- avoid-nested-futures
4958
- avoid-nested-records
59+
- avoid-nested-streams-and-futures
5060
- avoid-nested-switch-expressions
5161
- avoid-nested-switches
52-
- avoid-non-ascii-symbols
62+
- avoid-non-ascii-symbols:
63+
exclude:
64+
- test/**
5365
- avoid-non-null-assertion:
5466
exclude:
5567
- test/**
@@ -64,6 +76,7 @@ dart_code_metrics:
6476
- avoid-redundant-pragma-inline
6577
- avoid-self-assignment
6678
- avoid-self-compare
79+
- avoid-shadowed-extension-methods
6780
- avoid-shadowing:
6881
ignore-parameters: true
6982
ignored-names:
@@ -74,7 +87,10 @@ dart_code_metrics:
7487
- avoid-throw-objects-without-tostring
7588
- avoid-top-level-members-in-tests
7689
- avoid-unassigned-late-fields-keyword
90+
- avoid-uncaught-future-errors
91+
- avoid-unnecessary-call
7792
- avoid-unnecessary-conditionals
93+
- avoid-unnecessary-futures
7894
- avoid-unnecessary-negations
7995
- avoid-unnecessary-nullable-return-type
8096
- avoid-unnecessary-return
@@ -92,6 +108,9 @@ dart_code_metrics:
92108
only-doc-comments: true
93109
# - format-test-name # good but painful
94110
- function-always-returns-null
111+
- map-keys-ordering:
112+
exclude:
113+
- test/**
95114
# - match-positional-field-names-on-assignment # not compatible with avoid-redundant-positional-field-name
96115
- member-ordering:
97116
order:
@@ -122,7 +141,8 @@ dart_code_metrics:
122141
min-fields: 3
123142
min-occurrences: 3
124143
- newline-before-return
125-
- no-boolean-literal-compare
144+
- no-boolean-literal-compare:
145+
allow-false: true # allows `variable == false` instead of just `!variable`
126146
- no-empty-block
127147
- no-equal-arguments:
128148
ignored-parameters:
@@ -137,6 +157,7 @@ dart_code_metrics:
137157
- bottomLeft
138158
- bottomRight
139159
- no-equal-conditions
160+
- no-equal-nested-conditions
140161
- no-equal-switch-case
141162
- no-equal-switch-expression-cases
142163
- no-equal-then-else
@@ -146,7 +167,10 @@ dart_code_metrics:
146167
- prefer-bytes-builder
147168
- prefer-commenting-analyzer-ignores
148169
- prefer-conditional-expressions
170+
# - prefer-correct-error-name # we use `e`
171+
- prefer-correct-future-return-type
149172
# - prefer-correct-identifier-length # way too pedantic
173+
- prefer-correct-stream-return-type
150174
- prefer-correct-switch-length
151175
- prefer-correct-test-file-name
152176
- prefer-correct-type-name
@@ -163,6 +187,9 @@ dart_code_metrics:
163187
- test/**
164188
- prefer-moving-to-variable:
165189
allowed-duplicated-chains: 3
190+
exclude:
191+
- test/**
192+
- prefer-parentheses-with-if-null
166193
- prefer-return-await
167194
# - prefer-returning-conditional-expressions # annoying sometimes
168195
- prefer-simpler-patterns-null-check
@@ -172,7 +199,8 @@ dart_code_metrics:
172199
- (.*)Provider
173200
- use(.*)
174201
- prefer-test-matchers
175-
# - prefer-trailing-comma # already in Dart lints - require_trailing_commas
202+
- prefer-trailing-comma
203+
# - prefer-type-over-var # we prefer inference
176204
# - prefer-unwrapping-future-or # we are ok with awaiting values
177205
- prefer-visible-for-testing-on-members
178206
- prefer-wildcard-pattern
@@ -189,10 +217,12 @@ dart_code_metrics:
189217
- avoid-incomplete-copy-with
190218
- avoid-inherited-widget-in-initstate
191219
- avoid-late-context
220+
- avoid-missing-image-alt
192221
- avoid-returning-widgets
193222
- avoid-shrink-wrap-in-lists
194223
- avoid-state-constructors
195224
- avoid-stateless-widget-initialized-fields
225+
- avoid-unnecessary-overrides-in-state
196226
- avoid-unnecessary-setstate
197227
- avoid-unnecessary-stateful-widgets
198228
- avoid-wrapping-in-padding
@@ -202,6 +232,7 @@ dart_code_metrics:
202232
- prefer-action-button-tooltip
203233
- prefer-const-border-radius
204234
- prefer-correct-edge-insets-constructor
235+
- prefer-dedicated-media-query-methods
205236
- prefer-define-hero-tag
206237
- prefer-extracting-callbacks
207238
- prefer-single-widget-per-file:

lib/netglade_analysis.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
/// NetGlade Dart and Flutter analyzer settings and best practices
2-
/// used internally at [netglade](https://netglade.cz/en).
2+
/// used internally at [netglade](https://netglade.com).
33
library 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: 2.0.1
2+
version: 3.0.0
33
description: Lint rules for Dart and Flutter used internally at netglade.
44
repository: https://github.com/netglade/netglade_analysis
55
issue_tracker: https://github.com/netglade/netglade_analysis/issues

0 commit comments

Comments
 (0)