SonarCloud is a cloud based SaaS platform used to analyse code quality, vulnerabilities, technical debt and more. In other words, it helps developers get fast feedback regarding their work and helps them understand how and why they can code a better alternative of their code. It also provides an easy and relatively complete overview of the overall quality and keeps track of the quality evolution of projects. Sonarcloud uses common analysis rules defined by default, but it also allows to configure custom rules.
To get a better understanding of the features offered by this platform, feel free to explore some some projects that currently uses SonarCloud. This is the best way to get to know this tool, since large projects have been using this for a while now.
Best of all, SonarCloud is free of charge for public repositories and it integrates nicely with any GitHub repository, while also providing analysis for many languages.
24 to be exact:
Java, JavaScript, TypeScript, C#, Python, C++, Go, Kotlin, Ruby, Swift, ABAP, Apex, Apache Flex, C, CSS, HTML, Objective-C, PHP, Scala, T-SQL, PL/SQL, VB, XML, COBOL.
As such, in order to facilitate the refactoring of proc_image_processing, we integrated SonarCloud as a GitHub Action that runs at every commit on any branch (see .github/workflows/sonarcloud.yml
). The current status of the project can be found here.
C and C++ projects need a manual configuration because they can't use the GitHub Action that SonarCloud developped due to the complexity of those projects.
As such, the easiest way to add SonarCloud for a SONIA ROS project is to create another Dockerfile based on the current one that includes build-wrapper-linux and sonar-scanner-cli. Feel free to reuse Dockerfile.sonarcloud from proc_image_processing in order to setup new repositories for C/C++ projects. Afterwards, all is needed is to build the Sonarcloud Dockerfile in your CI, ideally after you built the actual Dockerfile of your project, since it's based on it.
In order to setup Sonarcloud for a repository that is not a C/C++ project, follow these steps: