dart-code-checker / dart-code-metrics

Software analytics tool that helps developers analyse and improve software quality.
https://dcm.dev
Other
860 stars 265 forks source link

[BUG] IntelliJ IDEA couldn't find a DCM executable #1199

Closed dmbaranov closed 1 year ago

dmbaranov commented 1 year ago

Environment and configuration

DCM version: 5.6.0 Dart SDK version: 2.19.2 analyzer: 5.6.0 OS: MacOS 13.2.1 IDE: IntelliJ IDEA 2023.1 EAP

Configuration ```yaml include: package:lints/recommended.yaml analyzer: plugins: - dart_code_metrics dart_code_metrics: rules: - avoid-dynamic - avoid-redundant-async - avoid-passing-async-when-sync-expected - avoid-redundant-async - avoid-unnecessary-type-assertions - avoid-unnecessary-type-casts - avoid-unrelated-type-assertions - avoid-unused-parameters - avoid-nested-conditional-expressions - newline-before-return - no-boolean-literal-compare - no-empty-block - prefer-conditional-expressions - no-equal-then-else - prefer-moving-to-variable ```

What did you do?

Screenshot 2023-02-26 at 03 14 05

When I'm trying to use DCM as a plugin for IDEA, there's an annoying error message at the top of the IDE that says "Could not find a DCM executable" and there's no way to close it.

It seems like the plugin itself works since I'm able to get actual errors/warnings for my code. Also, I'm able to run it from the terminal using dart run dart_code_metrics:metrics analyze lib and get an analysis of my project.

I also tried to use .../.pub-cache/hosted/pub.dev/dart_code_metrics-5.6.0/bin as an executable path in the plugin's settings, but it has no effect and the error message is still there.

What did you expect to happen?

I wouldn't expect to see an error message in the IDE saying that the plugin doesn't work.

What actually happened?

The error message is shown to me despite the fact that the plugin does work.

Participation

Additional comments

Thank you for your amazing work! This plugin helped me to identify quite some issues in my code :)

incendial commented 1 year ago

@dmbaranov the IDEA plugin is for the Teams version which has a separate executable. If you use the pub version (and looks like you do), you need to uninstall the IDEA plugin.

incendial commented 1 year ago

And thank you for the kind words!

dmbaranov commented 1 year ago

Hey @incendial, I got it, thanks for the explanation! Small idea, maybe it'd be great to add a line to the plugin's docs and mention that it's available for the Teams only.

incendial commented 1 year ago

It's explicitly mentioned here https://dcm.dev/docs/individuals/getting-started/#analyzer-plugin, here https://dcm.dev/docs/individuals/analyzer-plugin/, here https://dcm.dev/for-teams/ (first section) and here https://plugins.jetbrains.com/plugin/20856-dcm This plugin provides integration for the [Teams version](https://dcm.dev/for-teams/)..

Plugin for the analyzer and plugin for the IntelliJ are different things though.