Sonar report generator for RTE prescription enforcement
Overview
This project offers a suite of Python packages designed to generate PDF reports that serve as requirements for deploying applications in RTE production environments.
Features
- Automatic generation of a PDF report that includes all necessary information for validating the deployment of an application in RTE production environments.
- Utilization of multiple sources for retrieving Sonar metrics (e.g., SonarQube and Sonarcloud), depending on the application module.
- Automatic retrieval of all module metrics directly from Sonar servers for the specified branch (or the default branch if none is explicitly provided).
- Calculation of an aggregated backend code coverage indicator for multi-module application based on SonarQube description of "coverage" metric
- Generation of a traffic light indicator:
- Green light indicates that all current and future prescription criteria are validated by the application.
- Orange light signifies that while all current prescription criteria are validated, some future ones are not.
- Red light means that some current prescription criteria are not validated.
Usage
Build and/or install
A wheel can be built with following command, at base directory of the project:
python -m build
Project can also be directly installed with following command:
python -m pip install .
Generate Sonar report
Sonar report can be generated with following command:
python -m rte_sonar_reports -a <path-to-application-description-file> -c <path-to-sonar-configuration-file> -o <path-to-output-report-file>
Default log level threshold is set to INFO, but it is possible to override it using the LOGLEVEL environment variable.
LOGLEVEL=ERROR python -m rte_sonar_reports -a ... -c ... -o ...
LOGLEVEL=DEBUG python -m rte_sonar_reports -a ... -c ... -o ...
Sonar servers configuration
The Sonar servers configuration files is an ini file that contains the connection information to the Sonar instances that may be referenced while generating the final report. Each section of the file define a Sonar instance used to retrieve static code analysis results.
Supported keys in each section are:
| Key | Value type | Field type | Description |
|---|---|---|---|
| base_url | string | Mandatory | Base URL to be used to reach Sonar server using Sonar API |
| token | string | Optional | Authentication token to get access to the Sonar analysis results. Can be omitted if analysis results are access free (e.g. public analysis on SonarCloud) |
Example:
[SonarQube]
base_url = https://my.sonarqube.instance
token = my_sonarqube_token
[SonarCloud]
base_url = https://sonarcloud.io
Application description
The application description allows to define the information needed to define your application and all its attributes used to generate the final report.
An application is defined by:
- its name
- its version
- the list of its modules. Each module is an individual package which is associated to an individual Sonar project. It may be a microservice, a library, or a monolith as soon as its Sonar quality report is contained in a unique Sonar project.
A module is defined by:
- its name
- its type (backend, frontend, ...): type is important because some requirements (e.g. code coverage) may be
different between backend and frontend. The script does all the following values:
- backend
- frontend
- other
- its sonar_config attributes, which is the name of the Sonar configuration to use to retrieve the module's metrics, as defined in the Sonar servers configuration
- its project_key used to locate the project on the Sonar server
- its branch to get metrics from
The application description is provided through a yaml formatted file, of the following form:
application:
name: My complete test application
version: 1.0.0
modules:
- name: Frontend module
sonar_config: SonarCloud
project_key: frontend
type: frontend
- name: First backend module
sonar_config: SonarCloud
project_key: backend
branch: release-patch-1.0.1
type: backend
- name: Second backend module
sonar_config: SonarQube
project_key: backend
type: backend
- name: Other module
sonar_config: SonarQube
project_key: other
type: other
Proxy settings
The script relies on the proxy configuration defined by standard environment variables http_proxy, https_proxy, no_proxy, and all_proxy. Uppercase variants of these variables are also supported.
Metadata
Release files for rte-sonar-reports 2025.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| rte_sonar_reports-2025.3.1.tar.gz | 30.6 kB | With provenance | Details for rte_sonar_reports-2025.3.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| rte_sonar_reports-2025.3.1-py3-none-any.whl | Python 3 | none | any | Details for rte_sonar_reports-2025.3.1-py3-none-any.whl |
Total release size: 57.7 kB
Release files / rte_sonar_reports-2025.3.1.tar.gz
| Download URL | rte_sonar_reports-2025.3.1.tar.gz |
|---|---|
| Size | 30.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0876b85c3f5f4197919b6445ed80b392374058be916e18e25cff1f8bab859bf4
|
|
BLAKE2b-256 checksum How to use checksums |
248c5ca637c0b46d845287c0de5f843191507a7703aa47817b30bc0174876e8c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 29, 2025.
Transparency logRelease files / rte_sonar_reports-2025.3.1-py3-none-any.whl
| Download URL | rte_sonar_reports-2025.3.1-py3-none-any.whl |
|---|---|
| Size | 27.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c9dc0b5ff7e862348e0a985f0f497b95a79d3074876aacc8177d096c09393d9e
|
|
BLAKE2b-256 checksum How to use checksums |
81f5184e2ef78c853b473f4ece87f65d26c9dcde32ce04d214b5765856700335
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 29, 2025.
Transparency logSecurity for rte-sonar-reports 2025.3.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for rte_sonar_reports-2025.3.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 29, 2025.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.