Skip to content
This repository was archived by the owner on Jul 16, 2023. It is now read-only.

feat: export cli runner and add documentation for use-case #1040

Merged
merged 3 commits into from
Oct 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Unreleased

* feat: make CliRunner a part of public API in order to support transitive executable calls use-case.
* feat: add static code diagnostic [`avoid-cascade-after-if-null`](https://dartcodemetrics.dev/docs/rules/common/avoid-cascade-after-if-null).

## 4.21.2
Expand Down
1 change: 1 addition & 0 deletions lib/cli_runner.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export 'package:dart_code_metrics/src/cli/cli_runner.dart';
14 changes: 14 additions & 0 deletions website/docs/cli/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,17 @@ metrics:
Run `dart_code_metrics` in all packages.
- Note: you can also rely on your IDEs Dart Analysis / Issues window.
```

## Calling the cli from your own package with the linter configuration

If you have a separate package with all the linter and DCM configurations which is used by your other packages and you want to call DCM transitively add a `bin` folder with a Dart file, for example

```dart metrics.dart
import 'package:dart_code_metrics/cli_runner.dart';

Future<void> main(List<String> args) async {
await CliRunner().run(args);
}
```

After that you will be able to run DCM by calling your package executable.