ci: check code metrics
This commit is contained in:
parent
3130139bde
commit
ffea21a309
|
|
@ -82,6 +82,22 @@ code_analyze:
|
||||||
- dart format lib/ test/ test_driver/ --set-exit-if-changed
|
- dart format lib/ test/ test_driver/ --set-exit-if-changed
|
||||||
- dart analyze
|
- dart analyze
|
||||||
|
|
||||||
|
code_quality:
|
||||||
|
tags:
|
||||||
|
- docker
|
||||||
|
stage: coverage
|
||||||
|
image: google/dart
|
||||||
|
before_script:
|
||||||
|
- dart pub global activate dart_code_metrics
|
||||||
|
script:
|
||||||
|
- dart pub global run dart_code_metrics:metrics lib -r gitlab > code-quality-report.json
|
||||||
|
artifacts:
|
||||||
|
reports:
|
||||||
|
codequality: code-quality-report.json
|
||||||
|
# also create an actual artifact for inspection purposes
|
||||||
|
paths:
|
||||||
|
- code-quality-report.json
|
||||||
|
|
||||||
build_doc:
|
build_doc:
|
||||||
tags:
|
tags:
|
||||||
- docker
|
- docker
|
||||||
|
|
|
||||||
|
|
@ -19,3 +19,36 @@ analyzer:
|
||||||
- example/main.dart
|
- example/main.dart
|
||||||
# needed until crypto packages upgrade
|
# needed until crypto packages upgrade
|
||||||
- lib/src/database/database.g.dart
|
- lib/src/database/database.g.dart
|
||||||
|
plugins:
|
||||||
|
# Show code metrics in IDE
|
||||||
|
- dart_code_metrics
|
||||||
|
|
||||||
|
dart_code_metrics:
|
||||||
|
metrics:
|
||||||
|
cyclomatic-complexity: 20
|
||||||
|
number-of-arguments: 4
|
||||||
|
maximum-nesting-level: 5
|
||||||
|
source-lines-of-code: 50
|
||||||
|
# This is still unstable, so handle with care
|
||||||
|
maintainability-index: 40
|
||||||
|
metrics-exclude:
|
||||||
|
- test/**
|
||||||
|
rules:
|
||||||
|
#- newline-before-return
|
||||||
|
- no-boolean-literal-compare
|
||||||
|
- no-empty-block
|
||||||
|
#- prefer-trailing-comma
|
||||||
|
- prefer-conditional-expressions
|
||||||
|
- no-equal-arguments
|
||||||
|
- no-equal-then-else
|
||||||
|
- no-magic-number:
|
||||||
|
severity: style # too noisy otherwise atm
|
||||||
|
- avoid-late-keyword:
|
||||||
|
severity: style # too noisy otherwise atm
|
||||||
|
- avoid-non-null-assertion:
|
||||||
|
severity: style # too noisy otherwise atm
|
||||||
|
- avoid-unused-parameters
|
||||||
|
- binary-expression-operand-order
|
||||||
|
anti-patterns:
|
||||||
|
- long-method
|
||||||
|
- long-parameter-list
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ dependencies:
|
||||||
collection: ^1.15.0
|
collection: ^1.15.0
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
|
dart_code_metrics: ^4.4.0
|
||||||
pedantic: ^1.11.0
|
pedantic: ^1.11.0
|
||||||
test: ^1.15.7
|
test: ^1.15.7
|
||||||
coverage: ">=0.15.0 <2.0.0"
|
coverage: ">=0.15.0 <2.0.0"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue