b3k
Elixir projects in SonarQube
Hi!
Has anyone integrated the elixir project in SonarQube?
I saw the GitHub - arthepsy/sonar-elixir: SonarQube Elixir plugin · GitHub repo, but it did’t bring anything valuable to Sonar in case of Elixir.
Most Liked
adrienmo
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:
- generic code coverage: I made a pull request that was accepted by the library: GitHub - parroty/excoveralls: Coverage report tool for Elixir with coveralls.io integration. · GitHub, you can generate the report with: “mix excoveralls.xml”
- generic issues: I made a plugin for credo GitHub - adrienmo/credo_sonarqube: Add option to credo to generate sonarqube generic issue file · GitHub
- generic test execution: I made an ExUnit formatter: GitHub - adrienmo/ex_unit_sonarqube: Generate a generic test execution file to be used with SonarQube · GitHub
You then need to configure your:
sonar.externalIssuesReportPathssonar.coverageReportPathssonar.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 ![]()
Hope it helps!
hpopp
I’ve been checking in on this thread periodically over the last several years and finally just decided to build my own plugin: GitHub - hpopp/sonar-elixir: Community SonarQube plugin for the static analysis of Elixir projects. · GitHub
It’s still in early development, but it already supports some amazing features:
- Static analysis (with some caveats). It requires Elixir to be installed in your CI when running sonar-scanner, but that’s a non-issue for most.
- Proper syntax highlighting in the SonarQube UI.
- Some of the basic Sonar LOC metrics.
- Test code coverage using a new Sonar Mix coverage task GitHub - hpopp/mix-sonarqube: Mix utilities for the sonar-elixir SonarQube plugin. · GitHub.
At the moment, it only provides a few checks in the quality profile (it’s v0.1.1), but the long term goal is to achieve parity with Credo and Sobelow. I’m effectively rewriting these checks in Java to get the proper native Sonar experience. Help would be greatly appreciated if you want to contribute.
gausby
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #security
- #hex









