Skip to content

Commit 89ad700

Browse files
committed
Add sonar to project for quality checks
1 parent 65069f1 commit 89ad700

File tree

7 files changed

+268
-14
lines changed

7 files changed

+268
-14
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,6 @@ jobs:
2222
Metrics:
2323
needs: [ CI ]
2424
uses: ./.github/workflows/report.yml
25+
secrets: inherit
2526
permissions:
2627
contents: read

.github/workflows/report.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
- name: Copy Artifacts into Root Folder
3030
working-directory: ./artifacts
3131
run: |
32-
poetry run -- coverage combine --keep coverage-python3.9*/.coverage
32+
poetry run -- coverage combine --keep coverage-python*/.coverage
3333
# Errors during copying are ignored because they are checked in the next step
3434
cp .coverage ../ || true
3535
cp lint-python3.9/.lint.txt ../ || true
@@ -42,6 +42,18 @@ jobs:
4242
- name: Generate Report
4343
run: poetry run -- nox -s project:report -- --format json | tee metrics.json
4444

45+
- name: Prepare files for sonar
46+
run: |
47+
poetry run -- coverage xml -o ci-coverage.xml --include="exasol/toolbox/*"
48+
49+
- name: Upload to sonar
50+
run: |
51+
poetry run -- pysonar --sonar-token ${{ secrets.SONAR_TOKEN }} \
52+
--sonar-branch-name ${{ github.ref_name }} \
53+
--sonar-python-coverage-report-paths ci-coverage.xml \
54+
--sonar-python-pylint-report-path .lint.json \
55+
--sonar-python-mypy-report-paths .security.json
56+
4557
- name: Upload Artifacts
4658
uses: actions/[email protected]
4759
with:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ odbcconfig/odbcinst.ini
77
.html-documentation
88

99
.coverage
10+
.sonar
1011

1112
_build/
1213

doc/changes/unreleased.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ pyupgrade_args = ("--py310-plus",)
1717
## ✨ Features
1818

1919
* [#441](https://github.com/exasol/python-toolbox/issues/441): Switched nox task for `version:check` to use the config value of `version_file` to specify the location of the `version.py`
20+
* [#451](https://github.com/exasol/python-toolbox/issues/451): Added Sonar to project for quality checks
2021

2122
## ⚒️ Refactorings
2223

poetry.lock

Lines changed: 234 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ version = "1.2.0"
44
requires-python = ">=3.9,<4.0"
55
description = "Your one-stop solution for managing all standard tasks and core workflows of your Python project."
66
authors = [
7-
{name = "Nicola Coretti", email = "[email protected]"},
8-
{name = "Ariel Schulz", email = "[email protected]"},
7+
{ name = "Nicola Coretti", email = "[email protected]" },
8+
{ name = "Ariel Schulz", email = "[email protected]" },
99
]
1010
readme = "README.md"
1111
license = "MIT"
@@ -50,7 +50,7 @@ myst-parser = ">=2.0.0,<4"
5050
nox = ">=2022.8.7"
5151
pluggy = "^1.5.0"
5252
pre-commit = ">=4"
53-
prysk = {extras = ["pytest-plugin"], version = ">0.17.0,<1"}
53+
prysk = { extras = ["pytest-plugin"], version = ">0.17.0,<1" }
5454
pylint = ">=2.15.4"
5555
pytest = ">=7.2.2,<9"
5656
pyupgrade = ">=2.38.2,<4.0.0"
@@ -59,15 +59,17 @@ sphinx = ">=5.3,<8"
5959
sphinx-copybutton = "^0.5.0"
6060
sphinx-inline-tabs = "^2023.4.21"
6161
sphinx-design = ">=0.5.0,<1"
62-
typer = {extras = ["all"], version = ">=0.7.0"}
63-
bandit = {extras = ["toml"], version = "^1.7.9"}
62+
typer = { extras = ["all"], version = ">=0.7.0" }
63+
bandit = { extras = ["toml"], version = "^1.7.9" }
6464
jinja2 = "^3.1.6"
6565
pip-licenses = "^5.0.0"
6666
pip-audit = "^2.7.3"
6767
pydantic = "^2.11.5"
68+
lxml = "^5.4.0"
6869

6970
[tool.poetry.group.dev.dependencies]
7071
autoimport = "^1.4.0"
72+
pysonar = "^1.0.1.1548"
7173

7274
[build-system]
7375
requires = ["poetry-core>=2.0.0"]
@@ -104,6 +106,7 @@ max-module-lines = 800
104106

105107
[tool.mypy]
106108
plugins = ['pydantic.mypy']
109+
xml_report = 'mypy.xml'
107110

108111
[[tool.mypy.overrides]]
109112
module = [

sonar-project.properties

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
sonar.projectKey=com.exasol:python-toolbox
2+
sonar.projectName=python-toolbox
3+
sonar.organization=exasol
4+
sonar.language=py
5+
sonar.host.url=https://sonarcloud.io
6+
7+
sonar.sources=exasol/toolbox
8+
sonar.tests=test
9+
sonar.python.version=3.9,3.10,3.11,3.12,3.13
10+
sonar.branch.target=main

0 commit comments

Comments
 (0)