MetricsReloaded icon indicating copy to clipboard operation
MetricsReloaded copied to clipboard

Export csv report via java code

Open fdj612 opened this issue 4 years ago • 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

fdj612 avatar Feb 02 '21 10:02 fdj612

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

BasLeijdekkers avatar Feb 02 '21 17:02 BasLeijdekkers

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

fdj612 avatar Feb 03 '21 03:02 fdj612

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

fdj612 avatar Feb 08 '21 01:02 fdj612

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.

BasLeijdekkers avatar Feb 08 '21 16:02 BasLeijdekkers

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

Best, Susan

fdj612 avatar Feb 09 '21 02:02 fdj612

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

fdj612 avatar Feb 09 '21 06:02 fdj612

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

BasLeijdekkers avatar Feb 09 '21 09:02 BasLeijdekkers

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

fdj612 avatar Feb 09 '21 09:02 fdj612

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.

BasLeijdekkers avatar Feb 09 '21 11:02 BasLeijdekkers

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

runexperiment avatar Jul 22 '22 09:07 runexperiment

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

runexperiment avatar Jul 22 '22 09:07 runexperiment