Skip to content

Commit 0ab5a5f

Browse files
author
“jagnd1”
committed
fix sonarcloud source configuration for coverage detection
- change sonar.sources from specific dirs to project root (.) - add comprehensive exclusions for non-source directories - remove unnecessary path fixing in workflow - this aligns sonar sources with coverage file structure - should resolve 0% coverage display by matching file paths correctly
1 parent 4dc3748 commit 0ab5a5f

2 files changed

Lines changed: 4 additions & 10 deletions

File tree

.github/workflows/sonarcloud.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -114,12 +114,6 @@ jobs:
114114
--cov-report=html:htmlcov \
115115
--junitxml=test-results.xml \
116116
-v
117-
118-
# Fix coverage.xml paths for SonarCloud
119-
sed -i 's|filename="../|filename="|g' coverage.xml
120-
sed -i 's|<source>/home/runner/work/fmcrypto/fmcrypto/common</source>|<source>common</source>|g' coverage.xml
121-
sed -i 's|<source>/home/runner/work/fmcrypto/fmcrypto/crypto_service</source>|<source>crypto_service</source>|g' coverage.xml
122-
sed -i 's|<source>/home/runner/work/fmcrypto/fmcrypto/pki_service</source>|<source>pki_service</source>|g' coverage.xml
123117
124118
- name: stop services
125119
if: always()

testing/sonar-project.properties

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ sonar.projectKey=jagnd1_fmcrypto
99
sonar.projectName=fmcrypto Service
1010
sonar.projectVersion=1.0.0
1111

12-
# source code directories (exclude tests)
13-
sonar.sources=crypto_service,pki_service,common
12+
# source code directories (exclude tests)
13+
sonar.sources=.
1414
sonar.tests=testing
1515

16-
# exclude test files from source analysis
17-
sonar.exclusions=**/test_*.py,**/tests/**,**/*_test.py,**/test.py
16+
# exclude test files and non-source directories from analysis
17+
sonar.exclusions=**/test_*.py,**/tests/**,**/*_test.py,**/test.py,testing/**,deployment/**,.github/**,**/.venv/**,**/htmlcov/**,**/.pytest_cache/**,**/__pycache__/**
1818

1919
# test execution and coverage (paths relative to project root)
2020
sonar.python.coverage.reportPaths=testing/coverage.xml

0 commit comments

Comments
 (0)