dart-code-metrics
dart-code-metrics copied to clipboard
[New feature: blocked] Run `dart_code_metrics` when running `dart analyze` command
Actually, this is not just a question and closer to feature request. But there is almost nothing should be done in dart_code_metrics to implement this feature.
A relatively new dart analyze command (which replaces dartanalyzer) uses analysis server to perform linting. dart tool launches analysis server and communicates with it to get code analysis issues. I actually spent some time and investigated this scenario. I see that plugins (and dart_code_metrics plugin) in such scenario are being loaded and work properly.
But issues found by dart_code_metrics are not reported in this scenario: analysis server shutted down too early by dart tool.
There is an issue in Dart SDK repository which blocks us from using the plugin inside dart analyze workflow:
dart analyze does not know when analyzer plugin results are complete
I decided to open this issue just to track Dart SDK issue . The issue has P3 status and I hope it will be fixed relatively soon. My proposal is document ability to run dart_code_metrics using dart analyze after Dart SDK issue is fixed.
I suppose it would be more convenient to use the plugin with "standard" workflow with dart analyze , please let me know what do you think about this.
Yeah, we faced situations when running dart analyze could eventually fail because of a plugin issue report (like this one), but unfortunately had no time to investigate it further or even help fix it.
I think it'd be great to have this feature.
But we have other ideas for Cli commands, so we will not be able to remove it completely.
But we have other ideas for Cli commands, so we will not be able to remove it completely.
Actually, I am proposing just to have new feature and document it when Dart SDK issue is fixed. I understand that CLI integration can give us more than just analyzer plugin so I am not proposing to remove CLI commands.
Let's have this issue open if you don't mind: I will try to track it myself and hopefully will provide documentation PR when DartSDK issue is resolved.
Considering the overall direction with the DCM as a separate executable, this feature request is now obsolete.