SonarQube

SonarQube is a tool for static code analysis that aims to detect potential issues and guide development towards the Clean Code principles defined by Sonar.

sonarqube.it.helsinki

The IT center maintains a SonarQube environment based on the open-source community version here.

Since it is a free community version, it does not support separate analysis of different code branches.

Usage Principles

Creating a New Project

  1. Log in to the service
  2. Select Projects → Create Project → Manually and enter the requested information.
  3. Choose how new code is defined (descriptions of different options can be found via the link on the page)
    • Note: The community version in use does not support branch-level analysis.
  4. Projects are created as public by default, so all logged-in users can see the code and the observations made. Specify permissions as needed.
    • Select Project Settings → Permissions.
    • From the top, choose Public or Private.
    • The project founder automatically receives all rights to the project.
    • You can set permissions either for a user group (IAM group, see creation notice in usage principles) or for individual users.
  5. Overview tab provides instructions on how to send code for analysis.
    • Options include using the SonarScanner application from the command line or integrating analysis directly as part of a GitLab CI or GitHub Actions pipeline.

Project-Specific Analysis Rules

SonarQube reporting is based on Quality Gates and Quality Profiles settings.

Quality Gates

Quality Gates define the conditions under which new code passes inspection. This can be assessed by parameters such as (default in parentheses):

Default settings are the result of SonarQube’s development work. It’s advisable to read about Clean as You Code principles before modifying.

Quality Profiles

Quality Profiles define language-specific inspection rules and the severity of findings raised.

Settings modification

Custom quality gates and profiles can be set for a project.

All quality gates and profiles are public, and their creation requires separate permissions. See the Usage Principles section for instructions on how to obtain these permissions.

Individuals granted access can create new rules from the Quality Profiles/Quality Gates menu at the top. It is advisable to copy an old rule as a base for the new one.

Name your own rules in the format “--<name, e.g., project>", such as "Tike-Ohtu-Ryhti". __Rules named otherwise will be removed.__

Change the desired rule for the project at Project Settings → Quality Profiles/Quality Gates.

Guidelines

SonarQube documentation can be found here.

SonarLint

SonarLint is an analyzer that integrates directly into development software, evaluating the same aspects as SonarQube and can be directly linked to your SonarQube project.