Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
abf1447
Add sonar to project for quality checks
ArBridgeman May 28, 2025
ae27485
Move pysonar to direct dependencies
ArBridgeman Jun 3, 2025
53fb0a7
Add changelog entry
ArBridgeman Jun 3, 2025
d8f9a6f
Switch to nox task
ArBridgeman Jun 4, 2025
619f1ec
Merge branch 'main' into feature/451_add_pysonar
ArBridgeman Jun 4, 2025
741118d
Continue nox task, add to templates, & update documentation
ArBridgeman Jun 4, 2025
e975873
Fix template .gitignore & inherit secrets for report
ArBridgeman Jun 4, 2025
71a5ff4
Add new nox tasks to main tasks.py
ArBridgeman Jun 4, 2025
80e0736
Fix to relative path from . for coverage.xml & session
ArBridgeman Jun 4, 2025
cb43c0e
Add organization as required for pysonar
ArBridgeman Jun 4, 2025
fca58bb
Add statement to docs about adding to branch protections
ArBridgeman Jun 4, 2025
8395c69
Rename variable to avoid code smell, as built-in
ArBridgeman Jun 4, 2025
aeb6925
Remove f from non-f-string
ArBridgeman Jun 4, 2025
153adcb
Fix typo in documentation
ArBridgeman Jun 4, 2025
373c631
Move and rename to correct test folder
ArBridgeman Jun 4, 2025
d04be09
fixup! Rename variable to avoid code smell, as built-in
ArBridgeman Jun 4, 2025
dd250b6
Fix class name to fit convention
ArBridgeman Jun 4, 2025
c8ebdbc
Group copy_artifact tests together
ArBridgeman Jun 4, 2025
3f85359
Use variables to ensure names consistent throughout usually subsequen…
ArBridgeman Jun 4, 2025
3bb7f69
Simplify test and move into correct file
ArBridgeman Jun 4, 2025
cfc64e7
Remove file check as already done before validating them
ArBridgeman Jun 4, 2025
083c8ae
Switch validations to booleans and simplify to all or fail
ArBridgeman Jun 4, 2025
6d7d94f
Move over and simplify test for is_valid_lint_txt
ArBridgeman Jun 4, 2025
140875d
Move over and simplify test for is_valid_lint_json and mirror to is_v…
ArBridgeman Jun 4, 2025
64fa5d2
Move over and simplify test for is_valid_security_json
ArBridgeman Jun 4, 2025
48c8cee
Convert to handle validation error
ArBridgeman Jun 4, 2025
d66e5f0
Move over and simplify test for is_valid_coverage
ArBridgeman Jun 4, 2025
71f4070
Switch to simple assert
ArBridgeman Jun 4, 2025
02d7c4f
Add test for check_artifacts and switch prints to all bey stderr
ArBridgeman Jun 4, 2025
2fd5bf4
Fix warnings in sonar upload output
ArBridgeman Jun 4, 2025
0afc3fb
Remove code smells where non-f-strings
ArBridgeman Jun 4, 2025
7401da3
Switch python_files to be Iterable[str] as only used that way & restr…
ArBridgeman Jun 4, 2025
85ac99d
Add type ignore for unpacked list into session
ArBridgeman Jun 4, 2025
369705b
Project fix
ArBridgeman Jun 4, 2025
389c1e5
Fix comment
ArBridgeman Jun 5, 2025
ec5bf33
Add inherit secrets for sonar to pr-merge.ymls
ArBridgeman Jun 5, 2025
e19abd6
Merge branch 'main' into feature/451_add_pysonar
ArBridgeman Jun 10, 2025
5a35f66
Reduce scope of pylint to that of package
ArBridgeman Jun 10, 2025
254f905
Update documentation with summary and make clearer private vs public …
ArBridgeman Jun 10, 2025
e7fae9b
Re-lock dependencies
ArBridgeman Jun 10, 2025
95e97b8
Modify documentation per review
ArBridgeman Jun 12, 2025
12dca74
Rename to sonar:check
ArBridgeman Jun 12, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
pull_request:
types: [opened, synchronize, reopened]
schedule:
# At 00:00 on every 7th day-of-month from 1 through 31. (https://crontab.guru)
# At 00:00 on every 7th day-of-month from 1 through 31. (https://crontab.guru)
- cron: "0 0 1/7 * *"

jobs:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/pr-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,6 @@ jobs:
metrics:
needs: [ ci-job ]
uses: ./.github/workflows/report.yml
secrets: inherit
permissions:
contents: read
32 changes: 19 additions & 13 deletions doc/changes/unreleased.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,29 @@
# Unreleased

## Summary
This version of the PTB adds nox task `artifacts:sonar`, see #451. This allows us to
use SonarQube Cloud to analyze, visualize, & track linting, security, & coverage. In
order to properly set it up, you'll need to do the following instruction for each **public** project.
At this time, we do not currently support setting up SonarQube for a **private** project.

This version of the PTB adds nox task `artifacts:sonar`, see #451.
This requires the following changes for each public project:
1. specify in the `noxconfig.py` the path to its source code in `Config.source`
2. add the 'SONAR_TOKEN' to the 'Organization secrets'
1. specify in the `noxconfig.py` the relative path to the project's source code in `Config.source`
```python
source: Path = Path("exasol/toolbox")
```
2. add the 'SONAR_TOKEN' to the 'Organization secrets'
3. activate the SonarQubeCloud App
4. create a project on SonarCloud
5. add the following information to their `pyproject.toml`
5. add the following information to the project's `pyproject.toml`
```toml
[tool.sonar]
projectKey = "com.exasol:<project-key>"
hostUrl = "https://sonarcloud.io"
organization = "exasol"
```
6. post-merge, update the branch protections to include SonarQube analysis
```toml
[tool.sonar]
projectKey = "com.exasol:<project-key>"
hostUrl = "https://sonarcloud.io"
organization = "exasol"
```

## ✨ Features
* #451: Added nox task to execute pysonar & added Sonar to the CI

* #426: Allowed configuring the python version used for coverage
* #451: Added nox task to execute pysonar & added Sonar to the PTB CI
## ⚒️ Refactorings
* #451: Reduced scope of nox tasks `lint:code` (pylint) and `lint:security` (bandit) to analyze only the package code
19 changes: 12 additions & 7 deletions doc/user_guide/getting_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -202,21 +202,26 @@ We also need to configure settings for github-pages environment:
8. Set up for Sonar
+++++++++++++++++++
We use SonarQube Cloud to analyze, visualize, & track linting, security, & coverage. In
order to properly set it up, you'll need to do the following for each public project:
order to properly set it up, you'll need to do the following instructions for each **public** project.
At this time, we do not currently support setting up SonarQube for a **private** project.

1. specify in the `noxconfig.py` the path to the project's source code in `Config.source`
1. specify in the `noxconfig.py` the relative path to the project's source code in `Config.source`
.. code-block:: python

source: Path = Path("exasol/toolbox")
2. add the 'SONAR_TOKEN' to the 'Organization secrets'
3. activate the SonarQubeCloud App
4. create a project on SonarCloud
5. add the following information to the project's `pyproject.toml`
.. code-block:: toml

[tool.sonar]
projectKey = "com.exasol:<project-key>"
hostUrl = "https://sonarcloud.io"
organization = "exasol"
6. post-merge, update the branch protections to include SonarQube analysis

.. code-block:: toml

[tool.sonar]
projectKey = "com.exasol:<project-key>"
hostUrl = "https://sonarcloud.io"
organization = "exasol"

9. Go 🥜
+++++++++++++
Expand Down
2 changes: 1 addition & 1 deletion exasol/toolbox/nox/_lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def report_illegal(illegal: dict[str, list[str]], console: rich.console.Console)
@nox.session(name="lint:code", python=False)
def lint(session: Session) -> None:
"""Runs the static code analyzer on the project"""
py_files = python_files(PROJECT_CONFIG.root)
py_files = python_files(PROJECT_CONFIG.root / PROJECT_CONFIG.source)
_pylint(session, py_files)


Expand Down
2 changes: 1 addition & 1 deletion exasol/toolbox/templates/github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
pull_request:
types: [opened, synchronize, reopened]
schedule:
# At 00:00 on every 7th day-of-month from 1 through 31. (https://crontab.guru)
# At 00:00 on every 7th day-of-month from 1 through 31. (https://crontab.guru)
- cron: "0 0 1/7 * *"

jobs:
Expand Down
1 change: 1 addition & 0 deletions exasol/toolbox/templates/github/workflows/pr-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@ jobs:
metrics:
needs: [ ci-job ]
uses: ./.github/workflows/report.yml
secrets: inherit
permissions:
contents: read
44 changes: 22 additions & 22 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.