Skip to content

Commit 6d10721

Browse files
Try to fix sonarqube coverage reporting. (#24)
1 parent 01c4f2f commit 6d10721

File tree

4 files changed

+7
-19
lines changed

4 files changed

+7
-19
lines changed

.github/workflows/stage-2-test.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ jobs:
5050
- name: "Save the coverage check result"
5151
uses: actions/upload-artifact@v4
5252
with:
53-
name: coverage
53+
name: coverage.xml
5454
path: coverage.xml
5555
test-lint:
5656
name: "Linting"
@@ -85,7 +85,7 @@ jobs:
8585
- name: "Get the coverage report"
8686
uses: actions/download-artifact@v4
8787
with:
88-
name: coverage
88+
name: coverage.xml
8989
- name: "Perform static analysis"
9090
uses: ./.github/actions/perform-static-analysis
9191
with:

pyproject.toml

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -83,17 +83,9 @@ log_format = "%(asctime)s %(levelname)s %(message)s"
8383
log_date_format = "%Y-%m-%d %H:%M:%S"
8484

8585
[tool.coverage.run]
86+
relative_files = true
8687
branch = true
87-
source = ["src/eligibility_signposting_api"]
88-
omit = [
89-
"tests/*",
90-
"*/__init__.py",
91-
"*/migrations/*",
92-
"*/settings/*",
93-
"*/venv/*",
94-
"*/.venv/*",
95-
"*/site-packages/*",
96-
]
88+
source = ["src"]
9789

9890
[tool.coverage.report]
9991
show_missing = true

scripts/config/sonar-scanner.properties

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,12 @@ sonar.host.url=https://sonarcloud.io
44
sonar.qualitygate.wait=true
55
sonar.sourceEncoding=UTF-8
66

7-
#sonar.python.coverage.reportPaths=.coverage/coverage.xml
8-
#sonar.[javascript|typescript].lcov.reportPaths=.coverage/lcov.info
9-
107
sonar.python.version=3.13
118

12-
sonar.sources=src/
9+
sonar.sources=src
1310
sonar.exclusions=**/test_*.py
1411

15-
sonar.tests=tests/
12+
sonar.tests=tests
1613
sonar.test.inclusions=**/test_*.py
1714

1815
sonar.python.coverage.reportPaths=coverage.xml

scripts/tests/unit.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,4 @@ cd "$(git rev-parse --show-toplevel)"
1818
# tasks in scripts/test.mk.
1919

2020
make dependencies install-python
21-
poetry run pytest tests/unit/ --durations=10 --cov-report= --cov src/
22-
poetry run python -m coverage xml
21+
poetry run pytest tests/unit/ --durations=10 --cov-report=xml --cov=src/

0 commit comments

Comments
 (0)