dart-code-metrics
dart-code-metrics copied to clipboard
[FEATURE REQUEST] Export CliRunner
It would be useful to have CliRunner exported.
Use case
We have a package where we customize analyzer rules to share the settings across our products. Recently we've added dart_code_metrics as a dependency to share its configuration as well. The only problem so far is that we cannot use the CLI analyzer because of the restriction "Cannot run executables in transitive dependencies".
Exporting CliRunner would allow creating an executable in our package and proxy all the calls to CliRunner.
@ookami-kb could you share, why you don't want to call dart_code_metrics executable in target packages directly?
@incendial we add dependency for dart_code_metrics to our mews_pedantic package. It means that for our product apps (they depend on mews_pedantic) dart_code_metrics is a transitive dependency. It means that in this product app I cannot just run flutter pub run dart_code_metrics:metrics lib since it will give an error: "Cannot run executables in transitive dependencies".
Ah, I see, thanks. Have you tried global activate or it's less convenient for you? I'm asking, because I think we should avoid exporting CliRunner since it's more like our internal implementation and it's better to avoid a situation when we'll need to create major package updates to update it.
Yeah, it's less convenient since:
- We cannot enforce some specific package version if needed;
- We need another step in CI pipeline.
But I can understand your point as well.
I've checked Dart SDK repo and it looks like this limitation for execution of transitive dependencies is intentional: https://github.com/dart-lang/sdk/issues/23426
How do you solve this problem right now? Maybe you can start with src imports and see how it goes?
Maybe you can start with src imports and see how it goes?
Yes, it's exactly what I did for now.
@ookami-kb cli runner will become a part of public API. It's occurred, that this use-case is pretty common, so we'll support it officially
Available in 5.0.0 🚀