Skip to content

Commit

Permalink
Replace DCM with DCL
Browse files Browse the repository at this point in the history
  • Loading branch information
quoc-huynh-cosee committed May 13, 2024
1 parent ccbd034 commit b5145e6
Show file tree
Hide file tree
Showing 8 changed files with 67 additions and 47 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.5.1

* Replace [dart_code_metrics](https://pub.dev/packages/dart_code_metrics) with [dart_code_linter](https://pub.dev/packages/dart_code_linter).

## 0.5.0

* Add [`avoid-banned-imports`](https://dcm.dev/docs/rules/common/avoid-banned-imports/)
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ For a package:
include: package:cosee_lints/analysis_options_package.yaml
```

If you are using [dart_code_metrics][dart_code_metrics] you can extend our preset by adding the
If you are using [dart_code_linter][dart_code_linter] you can extend our preset by adding the
following line in `analysis_options.yaml`:

```yaml
dart_code_metrics:
dart_code_linter:
extends:
- package:cosee_lints/metrics.yaml
```
Expand All @@ -61,12 +61,12 @@ flutter analyze
The Dart Code Metrics can be run using the following command:

```sh
dart run dart_code_metrics:metrics analyze lib
dart run dart_code_linter:metrics analyze lib
```

[cosee]: https://www2.cosee.biz/

[dart_code_metrics]: https://dartcodemetrics.dev/
[dart_code_linter]: https://dcl.apps.bancolombia.com/

[pub_badge]: https://img.shields.io/pub/v/cosee_lints.svg

Expand Down
2 changes: 1 addition & 1 deletion example/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
include: package:cosee_lints/analysis_options.yaml

dart_code_metrics:
dart_code_linter:
extends:
- package:cosee_lints/metrics.yaml
68 changes: 42 additions & 26 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,26 @@ packages:
dependency: transitive
description:
name: _fe_analyzer_shared
sha256: ae92f5d747aee634b87f89d9946000c2de774be1d6ac3e58268224348cd0101a
sha256: "0b2f2bd91ba804e53a61d757b986f89f1f9eaed5b11e4b2f5a2468d86d6c9fc7"
url: "https://pub.dev"
source: hosted
version: "61.0.0"
version: "67.0.0"
analyzer:
dependency: transitive
description:
name: analyzer
sha256: ea3d8652bda62982addfd92fdc2d0214e5f82e43325104990d4f4c4a2a313562
sha256: "37577842a27e4338429a1cbc32679d508836510b056f1eedf0c8d20e39c1383d"
url: "https://pub.dev"
source: hosted
version: "5.13.0"
version: "6.4.1"
analyzer_plugin:
dependency: transitive
description:
name: analyzer_plugin
sha256: c1d5f167683de03d5ab6c3b53fc9aeefc5d59476e7810ba7bbddff50c6f4392d
sha256: "9661b30b13a685efaee9f02e5d01ed9f2b423bd889d28a304d02d704aee69161"
url: "https://pub.dev"
source: hosted
version: "0.11.2"
version: "0.11.3"
ansicolor:
dependency: transitive
description:
Expand Down Expand Up @@ -71,7 +71,7 @@ packages:
path: ".."
relative: true
source: path
version: "0.5.0"
version: "0.5.1"
crypto:
dependency: transitive
description:
Expand All @@ -88,22 +88,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.0.0"
dart_code_metrics:
dart_code_linter:
dependency: "direct dev"
description:
name: dart_code_metrics
sha256: "3dede3f7abc077a4181ec7445448a289a9ce08e2981e6a4d49a3fb5099d47e1f"
name: dart_code_linter
sha256: ce99c032aae6fb607099eca24ad99204cf264aaed17c8a89c05ebe9b2329b9ca
url: "https://pub.dev"
source: hosted
version: "5.7.6"
dart_code_metrics_presets:
dependency: transitive
description:
name: dart_code_metrics_presets
sha256: b71eadf02a3787ebd5c887623f83f6fdc204d45c75a081bd636c4104b3fd8b73
url: "https://pub.dev"
source: hosted
version: "1.8.0"
version: "1.1.3"
dart_style:
dependency: transitive
description:
Expand All @@ -120,6 +112,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "6.1.4"
fixnum:
dependency: transitive
description:
name: fixnum
sha256: "25517a4deb0c03aa0f32fd12db525856438902d9c16536311e76cdc57b31d7d1"
url: "https://pub.dev"
source: hosted
version: "1.1.0"
glob:
dependency: transitive
description:
Expand All @@ -140,10 +140,10 @@ packages:
dependency: transitive
description:
name: http
sha256: "5895291c13fa8a3bd82e76d5627f69e0d85ca6a30dcac95c4ea19a5d555879c2"
sha256: "761a297c042deedc1ffbb156d6e2af13886bb305c2a343a4d972504cd67dd938"
url: "https://pub.dev"
source: hosted
version: "0.13.6"
version: "1.2.1"
http_parser:
dependency: transitive
description:
Expand Down Expand Up @@ -220,10 +220,10 @@ packages:
dependency: transitive
description:
name: pub_updater
sha256: "05ae70703e06f7fdeb05f7f02dd680b8aad810e87c756a618f33e1794635115c"
sha256: b06600619c8c219065a548f8f7c192b3e080beff95488ed692780f48f69c0625
url: "https://pub.dev"
source: hosted
version: "0.3.0"
version: "0.3.1"
source_span:
dependency: transitive
description:
Expand All @@ -232,6 +232,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.10.0"
sprintf:
dependency: transitive
description:
name: sprintf
sha256: "1fc9ffe69d4df602376b52949af107d8f5703b77cda567c4d7d86a0693120f23"
url: "https://pub.dev"
source: hosted
version: "7.0.0"
string_scanner:
dependency: transitive
description:
Expand Down Expand Up @@ -260,10 +268,10 @@ packages:
dependency: transitive
description:
name: uuid
sha256: "648e103079f7c64a36dc7d39369cabb358d377078a051d6ae2ad3aa539519313"
sha256: "814e9e88f21a176ae1359149021870e87f7cddaf633ab678a5d2b0bff7fd1ba8"
url: "https://pub.dev"
source: hosted
version: "3.0.7"
version: "4.4.0"
watcher:
dependency: transitive
description:
Expand All @@ -272,6 +280,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.1.0"
web:
dependency: transitive
description:
name: web
sha256: "97da13628db363c635202ad97068d47c5b8aa555808e7a9411963c533b449b27"
url: "https://pub.dev"
source: hosted
version: "0.5.1"
xml:
dependency: transitive
description:
Expand All @@ -289,4 +305,4 @@ packages:
source: hosted
version: "3.1.2"
sdks:
dart: ">=3.2.0 <4.0.0"
dart: ">=3.3.0 <4.0.0"
2 changes: 1 addition & 1 deletion example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ environment:
dev_dependencies:
cosee_lints:
path: ../
dart_code_metrics: ^5.7.6
dart_code_linter: ^1.1.3
2 changes: 1 addition & 1 deletion lib/core.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
analyzer:
plugins:
- dart_code_metrics
- dart_code_linter

language:
strict-casts: true
Expand Down
24 changes: 12 additions & 12 deletions lib/metrics.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
dart_code_metrics:
dart_code_linter:
metrics:
cyclomatic-complexity: 30
maximum-nesting-level: 7
Expand All @@ -8,6 +8,17 @@ dart_code_metrics:

rules:
# Dart
- avoid-banned-imports:
entries:
- paths: [ 'lib\/domain(\/\w+)+\.dart' ]
deny: [ '^package:\w*\/ui(\/\w+)+\.dart$' ]
message: 'Do not import UI classes within domain layer'
- paths: [ 'lib\/infrastructure(\/\w+)+\.dart' ]
deny: [ '^package:\w*\/ui(\/\w+)+\.dart$' ]
message: 'Do not import UI classes within infrastructure layer'
- paths: [ 'lib\/domain(\/\w+)+\.dart' ]
deny: [ '^package:\w*\/infrastructure(\/\w+)+\.dart$' ]
message: 'Do not import infrastructure layer classes within domain layer'
- avoid-cascade-after-if-null
- avoid-collection-methods-with-unrelated-types
- avoid-double-slash-imports
Expand Down Expand Up @@ -52,17 +63,6 @@ dart_code_metrics:
- test/**
- integration_test/**
- prefer-trailing-comma
- avoid-banned-imports:
entries:
- paths: ['lib\/domain(\/\w+)+\.dart']
deny: ['^package:\w*\/ui(\/\w+)+\.dart$']
message: 'Do not import UI classes within domain layer'
- paths: ['lib\/infrastructure(\/\w+)+\.dart']
deny: ['^package:\w*\/ui(\/\w+)+\.dart$']
message: 'Do not import UI classes within infrastructure layer'
- paths: ['lib\/domain(\/\w+)+\.dart']
deny: ['^package:\w*\/infrastructure(\/\w+)+\.dart$']
message: 'Do not import infrastructure layer classes within domain layer'

# Flutter
- always-remove-listener
Expand Down
4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ description: Lint rules and metrics for Dart and Flutter used internally at cose
repository: https://github.com/cosee/cosee_lints
homepage: https://pub.dev/publishers/cosee.biz/packages
issue_tracker: https://github.com/cosee/cosee_lints/issues
version: 0.5.0
version: 0.5.1
topics:
- lints

environment:
sdk: '>=3.0.0 <4.0.0'
sdk: ^3.0.0

0 comments on commit b5145e6

Please sign in to comment.