Skip to content

Commit

Permalink
PRMDR configure sonarcloud (#105)
Browse files Browse the repository at this point in the history
* update sonar project properties

* amend Makefile test cov command

* set relative files in .coveragerc

* set source in .coveragerc

* add sed command to sonarcube workflow

---------

Co-authored-by: Scott Alexander <scott.alexander@madetech.com>
  • Loading branch information
carlsmith101 and Scott Alexander authored Oct 23, 2023
1 parent 7585b5e commit 29e06b6
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/sonarcloud-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ jobs:
- name: Test with pytest
run: |
make test-unit-coverage
cd ./lambdas
sed -i "s@filename=\"@filename=\"lambda/@" coverage.xml
cd ..
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ test-unit:
cd ./lambdas && ./venv/bin/python3 -m pytest tests/

test-unit-coverage:
cd ./lambdas && ./venv/bin/python3 -m pytest --cov-report xml:coverage.xml --cov tests/
cd ./lambdas && ./venv/bin/python3 -m pytest --cov=. --cov-report xml:coverage.xml

test-unit-collect:
cd ./lambdas && ./venv/bin/python3 -m pytest tests/ --collect-only
Expand Down
4 changes: 4 additions & 0 deletions lambdas/.coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[run]
relative_files = True
source = lambdas/
branch = True
8 changes: 7 additions & 1 deletion sonar-project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,17 @@ sonar.organization=prm-repository
sonar.projectName=Repository
sonar.projectVersion=1.0

sonar.python.version=3.11

sonar.javascript.lcov.reportPaths=app/coverage/lcov.info
sonar.python.coverage.reportPaths=lambdas/coverage.xml

# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
#sonar.sources=.
sonar.sources=lambdas/,app/src/
sonar.tests=lambdas/tests/,app/src/

sonar.exclusions=**/*.test.tsx,app/src/helpers/test/
sonar.test.inclusions=**/*.test.tsx,app/src/helpers/test/

# Encoding of the source code. Default is default system encoding
#sonar.sourceEncoding=UTF-8

0 comments on commit 29e06b6

Please sign in to comment.