-
Notifications
You must be signed in to change notification settings - Fork 1
Documentation/510 consolidate metrics and sonar #511
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
ArBridgeman
merged 22 commits into
main
from
documentation/510_consolidate_metrics_and_sonar
Jul 30, 2025
Merged
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
21dff06
Start to add onto collecting metrics & add files for reporting metrics
ArBridgeman 007eca3
Move and try to reformat/reduce metrics.rst to project_report.rst
ArBridgeman 0cb855f
Remove empty nox.rst and nothing-to-see-here.png as no longer used
ArBridgeman dacca29
Move sonar configuration to sonar file
ArBridgeman 605d56e
Fix links
ArBridgeman 756b0a7
Merge branch 'main' into documentation/510_consolidate_metrics_and_sonar
ArBridgeman a9ed17c
update text to be more direct with PTB as actor per review
ArBridgeman e94fc8d
reduce words & use proper nouns to make intent clearer per review
ArBridgeman f0a23a6
be more explicit that GitHub repository, not just project, per review
ArBridgeman ff93440
be more explicit that GitHub repository, not just project, per review
ArBridgeman 99d8482
Switch one .lint.json to .lint.txt
ArBridgeman c53fc4b
Fix underline issue from review comments
ArBridgeman 8810c34
Switch to paragraph form for instructions so clearer who is actor & w…
ArBridgeman 97d1177
Reduce duplicated text. Most details should be on individual pages & …
ArBridgeman c7d8597
Switch from direct to generated metrics
ArBridgeman 3b845e2
Switch text to be a bit shorter & still accurate
ArBridgeman b303973
Remove length text and use passive to avoid other issues
ArBridgeman 17cea71
Switch to passive text
ArBridgeman d1cf11e
Switch we with fact statement with are
ArBridgeman f31c76b
Alter text to be clearer what we do per review
ArBridgeman 521fc44
Fix typo
ArBridgeman 0fbc465
Apply changes per review
ArBridgeman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,5 +4,4 @@ Modules | |
| .. toctree:: | ||
| :maxdepth: 2 | ||
|
|
||
| nox | ||
| nox_tasks | ||
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| Collecting metrics | ||
| ================== | ||
|
|
||
| .. toctree:: | ||
| :maxdepth: 2 | ||
|
|
||
| project_report | ||
| sonar | ||
|
|
||
| .. _generated_metrics: | ||
|
|
||
| Generated metrics | ||
| +++++++++++++++++ | ||
|
|
||
| The PTB allows you to collect various metrics on the quality of your project | ||
| regarding Coverage, Security, and Static Code Analysis. | ||
|
|
||
| For each metric, there is a dedicated nox session, generating one or multiple | ||
| files and based on a selected external Python tool. | ||
|
|
||
| +------------------------------------+-----------------------------+--------------+ | ||
| | Nox session | Generated files | Based on | | ||
| +====================================+=============================+==============+ | ||
| | ``lint:code`` | ``lint.txt``, ``lint.json`` | ``pylint`` | | ||
| +------------------------------------+-----------------------------+--------------+ | ||
| | ``lint:security`` | ``.security.json`` | ``bandit`` | | ||
| +------------------------------------+-----------------------------+--------------+ | ||
| | ``test:unit -- --coverage`` | ``.coverage`` | ``coverage`` | | ||
| +------------------------------------+-----------------------------+--------------+ | ||
| | ``test:integration -- --coverage`` | ``.coverage`` | ``coverage`` | | ||
| +------------------------------------+-----------------------------+--------------+ | ||
|
|
||
| These metrics are computed for each element in your build matrix, e.g. for each | ||
| Python version defined in the file ``noxconfig.py``: | ||
|
|
||
| .. code-block:: python | ||
|
|
||
| @dataclass(frozen=True) | ||
| class Config: | ||
| python_versions = ["3.9", "3.10", "3.11", "3.12", "3.13"] | ||
|
|
||
| The GitHub workflows of your project can: | ||
|
|
||
| * Use a build matrix, e.g. using different Python versions as shown above | ||
| * Define multiple test sessions, e.g. for distinguishing fast vs. slow or expensive tests. | ||
|
|
||
|
|
||
| Reporting metrics | ||
| +++++++++++++++++ | ||
|
|
||
| Currently, the PTB offers two methods to aggregate the :ref:`generated_metrics` | ||
| into a report: | ||
|
|
||
| #. the nox session ``project:report`` | ||
| This is an Exasol-specific summarization tool. For more information, see :ref:`project_report`. | ||
|
|
||
| #. SonarQube analysis | ||
| This summarization tool feeds into a feature-rich UI provided by | ||
| `Sonar <https://docs.sonarsource.com/sonarqube-server/latest/>`__. For further | ||
| details, see :ref:`sonarqube_analysis` | ||
|
|
||
| Both of these reporting options require that the generated files from the :ref:`generated_metrics` | ||
| are existing and in the expected formats. As there are metrics for different Python | ||
| versions, the PTB uses only the metrics associated with the Python version named first | ||
| in the attribute ``python_versions`` of class ``Config`` to the reporting metrics tools. | ||
|
|
||
| To perform this validation, there are two nox sessions. Due to the direct | ||
| dependence on the nox session ``project:report`` and SonarQube Analysis on the | ||
| aforementioned nox sessions, all of these are executed in succession in the CI's ``report.yml``. | ||
|
|
||
| +--------------------------+----------------------------------------------------------+ | ||
| | Nox session | Actions | | ||
| +==========================+==========================================================+ | ||
| | ``artifacts:copy`` | * Combines coverage artifacts from various test sources | | ||
| | | (unit, integration ...) | | ||
| | | * Copies downloaded artifacts to their parent directory | | ||
| +--------------------------+----------------------------------------------------------+ | ||
| | ``artifacts:validate`` | * Verifies that the ``.lint.json``, ``.lint.txt``, | | ||
| | | ``.security.json``, and ``.coverage`` are present | | ||
| | | * Checks that each file contains the expected attributes | | ||
| | | for that file type | | ||
| +--------------------------+----------------------------------------------------------+ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| .. _project_report: | ||
|
|
||
| ``project:report`` | ||
| ================== | ||
| After collecting the metrics described in by :ref:`generated_metrics`, you can use the | ||
| nox session ``project:report`` to create a report using one of the following formats: | ||
|
|
||
| * JSON | ||
| This format is usually used in the CI. The created JSON file is uploaded as an | ||
| artifact, which can be downloaded and aggregated for multiple projects | ||
| (see :ref:`metrics_schema`). | ||
| * markdown | ||
| This is displayed in the GitHub Action's summary for a given CI run. Displaying | ||
| this content per CI run gives the developer immediate feedback as to how the code | ||
| quality has changed between code modifications. | ||
|
|
||
|
|
||
| .. _metrics_schema: | ||
|
|
||
| Metrics schema | ||
| ++++++++++++++ | ||
| The PTB supports the uniform json schema for metrics used by all projects | ||
| of the Exasol Product Integration Team: | ||
|
|
||
| * `Exasol Schemas`_ | ||
| * `Metrics Schema`_ | ||
| * `Metrics Schema Project`_ | ||
|
|
||
| The Integration team runs regular aggregation of the metrics from all projects into a centralized data sink | ||
| as decribed in the company Wiki. | ||
|
|
||
| Development | ||
| ----------- | ||
|
|
||
| If the metrics schema needs to be updated, the `Metrics Schema Project`_ provides a | ||
| convenient way (via a Pydantic model) to update and generate an updated schema for the | ||
| metrics. | ||
|
|
||
| .. note:: | ||
|
|
||
| The updated version needs to be first integrated into the `Exasol Schemas Project`_. | ||
|
|
||
|
|
||
| .. _Exasol Schemas: https://schemas.exasol.com | ||
| .. _Exasol Schemas Project: https://github.com/exasol/schemas | ||
| .. _Metrics Schema: https://schemas.exasol.com/project-metrics-0.2.0.html | ||
| .. _metrics.py: https://github.com/exasol/python-toolbox/blob/main/exasol/toolbox/metrics.py | ||
| .. _Metrics Schema Project: https://github.com/exasol/python-toolbox/tree/main/metrics-schema | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.