BasLeijdekkers/MetricsReloaded

Export csv report via java code

Opened this issue · 11 comments

Hi,
Thanks for your great work. I'd like to generate a .csv report for java package and export it directly through java code. Is there an existing library that could be used or any suggestion to directly call your module without Intellij installed?
Any advice would be helpful. Thanks
Best,
Susan

Sorry, it is not possible to use the MetricsReloaded plugin without IntelliJ IDEA. It needs on IntelliJ IDEA's Java parser and abstract syntax tree. Furthermore I also do not know of any library that can do this.

What is possible is invoking IntelliJ IDEA from the command line and collecting the desired metrics, without user interface. Perhaps that could be useful?

Bas

Hi,
Thanks for your reply. It is helpful!
Best,
Susan

Hi,
I have tried to use the command line to calculate the metric, but are all failed.
I have tried to use the profile name like "complexity", "Complexity", "complexity metrics", and "complexity.metrics.profile.name". However, all the metric profile names I've tried show "profile not found."
Could you list the valid or existing metric profile names that can be used to calculate the metrics, thank you!!
Best,
Susan

On MacOS the following works for me:
/Applications/IntelliJ\ IDEA\ 2020.3.app/Contents/MacOS/idea metrics /Users/bas/Projects/MyProject "Complexity metrics" output.xml
The capitalization of the name has to match exactly.

I also noticed running metrics from the command line could use some improvements. Please keep this issue open as a reminder, and i will try to implement this for the next release.

Hi,
Oh~ Thank you for your help.
Is this solution also works on Windows?
Thanks for your great work!!!

Best,
Susan

Hello,
I've tried on Windows, I use "idea.bat project_path "Complexity metrics" output.xml"
In the beginning, it says file "output.xml" not found, so I create an empty file.
However, it turns to display this error:
image
image

Can you help me what's wrong >_<

Thank!!!
Best,
Susan

It appears all of these are just warnings produced by IntelliJ IDEA. I don't see any errors.

oh~Understand.
But the output.xml is not written.
Is there any wrong with my command?
"idea.bat project_path "Complexity metrics" output.xml"
BTW, my OS is Windows.
Thanks^_^

Best,
Susan

I don't see anything wrong with your command. Is there any more output on the command line? When it working you should see messages like:

MetricsReloaded running on IntelliJ IDEA 2020.3.2
Opening project...
Project MyProject opened.
Calculating metrics
Finished.

Hi,
I have a problem,How can windows calculate the complexity information from the command line
Thanks for your great work!!!
Best,
memory

oh~Understand. But the output.xml is not written. Is there any wrong with my command? "idea.bat project_path "Complexity metrics" output.xml" BTW, my OS is Windows. Thanks^_^

Best, Susan

Hi
I have the same problem,How can windows calculate the complexity information from the command line,What specific command should I execute."idea.bat project_path "Complexity metrics" output.xml" ,Execute this command, I will open idea and generate some empty files.
Best
memory