From b5145e64450f4642514418ee202aedfc6b09b103 Mon Sep 17 00:00:00 2001 From: Quoc Huynh Date: Mon, 13 May 2024 10:44:29 +0200 Subject: [PATCH] Replace DCM with DCL --- CHANGELOG.md | 4 +++ README.md | 8 ++--- example/analysis_options.yaml | 2 +- example/pubspec.lock | 68 +++++++++++++++++++++-------------- example/pubspec.yaml | 2 +- lib/core.yaml | 2 +- lib/metrics.yaml | 24 ++++++------- pubspec.yaml | 4 +-- 8 files changed, 67 insertions(+), 47 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7fa4252..088c3ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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/) diff --git a/README.md b/README.md index 783260a..e766099 100644 --- a/README.md +++ b/README.md @@ -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 ``` @@ -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 diff --git a/example/analysis_options.yaml b/example/analysis_options.yaml index 6165b9b..028e0bc 100644 --- a/example/analysis_options.yaml +++ b/example/analysis_options.yaml @@ -1,5 +1,5 @@ include: package:cosee_lints/analysis_options.yaml -dart_code_metrics: +dart_code_linter: extends: - package:cosee_lints/metrics.yaml diff --git a/example/pubspec.lock b/example/pubspec.lock index 59870c7..d9b24cd 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -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: @@ -71,7 +71,7 @@ packages: path: ".." relative: true source: path - version: "0.5.0" + version: "0.5.1" crypto: dependency: transitive description: @@ -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: @@ -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: @@ -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: @@ -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: @@ -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: @@ -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: @@ -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: @@ -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" diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 9666610..59e00fe 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -9,4 +9,4 @@ environment: dev_dependencies: cosee_lints: path: ../ - dart_code_metrics: ^5.7.6 + dart_code_linter: ^1.1.3 diff --git a/lib/core.yaml b/lib/core.yaml index 006669b..fc8106a 100644 --- a/lib/core.yaml +++ b/lib/core.yaml @@ -1,6 +1,6 @@ analyzer: plugins: - - dart_code_metrics + - dart_code_linter language: strict-casts: true diff --git a/lib/metrics.yaml b/lib/metrics.yaml index 002a111..8912ac8 100644 --- a/lib/metrics.yaml +++ b/lib/metrics.yaml @@ -1,4 +1,4 @@ -dart_code_metrics: +dart_code_linter: metrics: cyclomatic-complexity: 30 maximum-nesting-level: 7 @@ -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 @@ -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 diff --git a/pubspec.yaml b/pubspec.yaml index 0be39a8..eb1b98e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -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