Skip to content

Commit 83aa3b9

Browse files
committed
✨ DCM Workflow and Setup
- Created a DCM enabled code quality PR check workflow in code-quality.yaml. - Added necessary dependency and configuration for DCM in analysis_options.yaml and pubspec.yaml.
1 parent 3076f41 commit 83aa3b9

File tree

3 files changed

+72
-0
lines changed

3 files changed

+72
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: code-quality
2+
3+
on:
4+
pull_request:
5+
branches: [main]
6+
push:
7+
branches: [main]
8+
9+
jobs:
10+
check:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout
14+
uses: actions/[email protected]
15+
16+
- name: Install Dart and Flutter
17+
uses: subosito/[email protected]
18+
with:
19+
flutter-version: '3.16.5'
20+
cache: true
21+
cache-key: 'flutter-macos-stable-3.16.5-apple'
22+
cache-path: '${{ runner.tool_cache }}/flutter/macos-stable-3.16.5-apple'
23+
pub-cache-key: 'flutter-pub-macos-stable-3.16.5-apple'
24+
25+
- name: Install dependencies
26+
run: flutter clean && flutter pub get
27+
28+
- name: Install DCM
29+
uses: CQLabs/setup-dcm@v1
30+
with:
31+
github_token: ${{ secrets.GITHUB_TOKEN }}
32+
33+
- name: Run DCM
34+
uses: CQLabs/[email protected]
35+
with:
36+
github_token: ${{ secrets.GITHUB_TOKEN }}
37+
github_pat: ${{ secrets.PAT }}
38+
ci_key: ${{ secrets.DCM_CI_KEY }}
39+
email: ${{ secrets.DCM_EMAIL }}

analysis_options.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,38 @@
99
# packages, and plugins designed to encourage good coding practices.
1010
include: package:flutter_lints/flutter.yaml
1111

12+
dart_code_metrics:
13+
monorepo: true
14+
extends:
15+
- package:dart_code_metrics_presets/all.yaml
16+
- recommended
17+
metrics:
18+
cyclomatic-complexity: 20
19+
number-of-parameters: 4
20+
maximum-nesting-level: 5
21+
weight-of-class: 0.33
22+
tight-class-cohesion: 0.33
23+
weighted-methods-per-class: 35
24+
response-for-class: 55
25+
coupling-between-object-classes: 12
26+
number-of-added-methods: 10
27+
depth-of-inheritance-tree: 5
28+
widgets-nesting-level: 10
29+
source-lines-of-code: 50
30+
number-of-used-widgets: 20
31+
maintainability-index: 50
32+
lines-of-code: 100
33+
halstead-volume: 150
34+
technical-debt:
35+
threshold: 1
36+
todo-cost: 161
37+
ignore-cost: 320
38+
ignore-for-file-cost: 396
39+
as-dynamic-cost: 322
40+
deprecated-annotations-cost: 37
41+
file-nullsafety-migration-cost: 41
42+
unit-type: "INR"
43+
1244
linter:
1345
# The lint rules applied to this project can be customized in the
1446
# section below to disable rules from the `package:flutter_lints/flutter.yaml`

pubspec.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ dev_dependencies:
4646
# package. See that file for information about deactivating specific lint
4747
# rules and activating additional ones.
4848
flutter_lints: ^2.0.0
49+
dart_code_metrics_presets: ^2.12.0
4950

5051
# For information on the generic Dart part of this file, see the
5152
# following page: https://dart.dev/tools/pub/pubspec

0 commit comments

Comments
 (0)