You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 16, 2023. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+50-29Lines changed: 50 additions & 29 deletions
Original file line number
Diff line number
Diff line change
@@ -29,15 +29,15 @@
29
29
align="right">
30
30
</a>
31
31
32
-
DCM is a static analysis tool that helps you analyse and improve your code quality.
32
+
DCM is a toolkit that helps you identify and fix problems in your Dart and Flutter code. These problems can range from potential runtime bugs and violations of best practices to styling issues. DCM includes over 70 built-in rules to validate your code against various expectations, and you can customize these rules to fit your specific needs.
- Can be used as [CLI](https://dcm.dev/docs/individuals/cli), [analyzer plugin](https://dcm.dev/docs/individuals/analyzer-plugin) or [library](https://dcm.dev/docs/individuals/getting-started/#library)
40
+
- Can be used as [CLI](https://dcm.dev/docs/individuals/cli) and the [analyzer plugin](https://dcm.dev/docs/individuals/analyzer-plugin)
Add configuration to `analysis_options.yaml` and reload IDE to allow the analyzer to discover the plugin config.
60
60
61
-
```yaml
62
-
dev_dependencies:
63
-
dart_code_metrics: ^5.5.1
64
-
```
61
+
You can read more about the configuration [on the website](https://dcm.dev/docs/individuals/configuration).
65
62
66
-
and then run
63
+
### Basic config example
67
64
68
-
```sh
69
-
$ dart pub get
65
+
```yaml title="analysis_options.yaml"
66
+
analyzer:
67
+
plugins:
68
+
- dart_code_metrics
70
69
71
-
# or for a Flutter package
72
-
$ flutter pub get
70
+
dart_code_metrics:
71
+
rules:
72
+
- avoid-dynamic
73
+
- avoid-redundant-async
74
+
- avoid-passing-async-when-sync-expected
75
+
- avoid-redundant-async
76
+
- avoid-unnecessary-type-assertions
77
+
- avoid-unnecessary-type-casts
78
+
- avoid-unrelated-type-assertions
79
+
- avoid-unused-parameters
80
+
- avoid-nested-conditional-expressions
81
+
- newline-before-return
82
+
- no-boolean-literal-compare
83
+
- no-empty-block
84
+
- prefer-trailing-comma
85
+
- prefer-conditional-expressions
86
+
- no-equal-then-else
87
+
- prefer-moving-to-variable
88
+
- prefer-match-file-name
73
89
```
74
90
75
-
## Basic configuration
91
+
### Basic config with metrics
76
92
77
-
Add configuration to `analysis_options.yaml`
93
+
```yaml title="analysis_options.yaml"
94
+
analyzer:
95
+
plugins:
96
+
- dart_code_metrics
78
97
79
-
```yaml
80
98
dart_code_metrics:
81
-
anti-patterns:
82
-
- long-method
83
-
- long-parameter-list
84
99
metrics:
85
100
cyclomatic-complexity: 20
86
-
maximum-nesting-level: 5
87
101
number-of-parameters: 4
88
-
source-lines-of-code: 50
102
+
maximum-nesting-level: 5
89
103
metrics-exclude:
90
104
- test/**
91
105
rules:
106
+
- avoid-dynamic
107
+
- avoid-redundant-async
108
+
- avoid-passing-async-when-sync-expected
109
+
- avoid-redundant-async
110
+
- avoid-unnecessary-type-assertions
111
+
- avoid-unnecessary-type-casts
112
+
- avoid-unrelated-type-assertions
113
+
- avoid-unused-parameters
114
+
- avoid-nested-conditional-expressions
92
115
- newline-before-return
93
116
- no-boolean-literal-compare
94
117
- no-empty-block
95
118
- prefer-trailing-comma
96
119
- prefer-conditional-expressions
97
120
- no-equal-then-else
121
+
- prefer-moving-to-variable
122
+
- prefer-match-file-name
98
123
```
99
124
100
-
Reload IDE to allow the analyzer to discover the plugin config.
101
-
102
-
You can read more about the configuration [on the website](https://dcm.dev/docs/individuals/configuration).
103
-
104
125
## Usage
105
126
106
127
### Analyzer plugin
107
128
108
129
DCM can be used as a plugin for the Dart `analyzer` [package](https://pub.dev/packages/analyzer) providing additional rules. All issues produced by rules or anti-patterns will be highlighted in IDE.
@@ -261,6 +280,8 @@ If you are interested in contributing, please check out the [contribution guidel
261
280
262
281
### En
263
282
283
+
- [What’s new in DCM for Teams 1.1.0](https://medium.com/@incendial/whats-new-in-dcm-for-teams-1-1-0-501fd6223b0)
284
+
- [Announcing DCM for Teams](https://incendial.medium.com/announcing-dcm-for-teams-84db2cffce99)
264
285
- [Finding Unused Files With DCM](https://medium.com/wriketechclub/finding-unused-files-with-dart-code-metrics-b9aba48ad7ca) - This article considers one of the first commands, checking unused Dart files, by [Dmitry Zhifarsky](https://github.com/incendial)
265
286
- [Improving Code Quality With DCM](https://medium.com/wriketechclub/improving-code-quality-with-dart-code-metrics-430a5e3e316d) - Advantages of using DCM, by [Dmitry Zhifarsky](https://github.com/incendial)
266
287
- [Creating a Custom Plugin for Dart Analyzer](https://medium.com/wriketechclub/creating-a-custom-plugin-for-dart-analyzer-48b76d81a239) - How to develop a custom Dart code analyzer plugin, by [Dmitry Zhifarsky](https://github.com/incendial)
0 commit comments