Elixir projects in SonarQube

Hi!

Has anyone integrated the elixir project in SonarQube?

I saw the https://github.com/arthepsy/sonar-elixir repo, but it did’t bring anything valuable to Sonar in case of Elixir.

1 Like

What’s a sonar cube ?

1 Like

Well it seems that is a tool for Continuous Code Quality, first time I come across it…

@b3k What issues did you encounter using

See business proposition Q7: why YOUR business needs SonarQube.

Any update on this?

https://github.com/peterquicken/sonar-elixir fork seems to have had some activity

Thanks, I will check that fork

It has only basic support (LoC, module counting), without any code rules like code smells etc, from my organization perspective its kind important thing.

Same here. It’s not even considered if there is no sonarqube support.

1 Like

Is not possible to integrate Credo with Sonar?

I’ve tried to make it work with some duct tape!

Here is the plugin:

Which I just found out there and compiled, basically it just give you the ability to scan .ex and .exs files.

Then I extended elixir existing tools to create generic reports:

You then need to configure your:

  • sonar.externalIssuesReportPaths
  • sonar.coverageReportPaths
  • sonar.testExecutionReportPaths

accordingly.

Coverage and execution works fine, credo plugin need some work to classify correctly bug/codesmell/vulnerability and time effort (right now it reports everything as code smell with 90 minutes time resolution) but it works :slight_smile:

Hope it helps!

12 Likes

Hi, I can’t run the generic issues script. Maybe i’m doing something wrong ?
I’ve installed the credo_sonarqube package, but, when I run mix credo --sonarqube-base-folder cover/ --sonarqube-file credo_sonarqube.json it fails with the message

** (credo) Unknown switch: --sonarqube-base-folder
** (credo) Unknown switch: --sonarqube-file

Was something I misconfigured ?

And I wish to help with further development of this plugin. Is there any collaboration guidelines I should use ?

I did just check out the issues tab and found out that I didn’t configured the credo plugins properly. Solved.
But having this on docs would be nice. I can create a pull request documenting this

Could you share the configuration you did? I am facing the same issues.

Here you can check the configuration Error calling credo with parameters · Issue #1 · adrienmo/credo_sonarqube · GitHub it’s basically credo configuration (enable credo sonar plugin)

Thanks @adrienmo , i am able to integrate elixir to sonarqube recently with your help!
It need a little bit of adjustment though on recent version of sonarqube (community edition, version 9.5):

  1. need to adjust a bit output of coveralls.xml: sed -i 's/file path="\//file path="/g' cover/excoveralls.xml
  2. need to adjust a bit output of credo_sonarqube: sed -i 's/startLine": null/startLine": 1/g' credo_sonarqube.json