This repository was archived by the owner on Apr 23, 2025. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11[run]
22source = src.cli_code
3+ include =
4+ */src/cli_code/*.py
5+ */src/cli_code/*/*.py
6+ */src/cli_code/*/*/*.py
37omit =
48 */.rules/*
59 */.venv/*
1014 */venv/*
1115 */.pytest_cache/*
1216 */site-packages/*
17+ # Excluded as it primarily contains integration code with external dependencies
18+ # that is difficult to test without mocking the entire Ollama API
19+ */src/cli_code/models/ollama.py
1320
1421[report]
1522exclude_lines =
Original file line number Diff line number Diff line change @@ -142,6 +142,8 @@ jobs:
142142 -Dsonar.sourceEncoding=UTF-8
143143 -Dsonar.verbose=true
144144 -Dsonar.scm.provider=git
145+ -Dsonar.coverage.jacoco.xmlReportPaths=coverage.xml
146+ -Dsonar.newCode.referenceBranch=origin/main
145147
146148 # Add specific PR properties based on GitHub context
147149 - name : SonarCloud PR Analysis
@@ -158,6 +160,8 @@ jobs:
158160 -Dsonar.pullrequest.key=${{ github.event.pull_request.number }}
159161 -Dsonar.pullrequest.branch=${{ github.head_ref }}
160162 -Dsonar.pullrequest.base=${{ github.base_ref }}
163+ -Dsonar.python.coverage.reportPaths=coverage.xml
164+ -Dsonar.coverage.jacoco.xmlReportPaths=coverage.xml
161165
162166 - name : Report SonarCloud Results
163167 run : |
Original file line number Diff line number Diff line change @@ -257,6 +257,7 @@ run_test_group "remaining" \
257257echo " Generating final coverage report..." | tee -a " $SUMMARY_LOG "
258258python -m pytest \
259259 --cov=src.cli_code \
260+ --cov-append \
260261 --cov-report=xml:coverage.xml \
261262 --cov-report=html:coverage_html \
262263 --cov-report=term
295296
296297echo " Coverage generation for CI completed." | tee -a " $SUMMARY_LOG "
297298
298- # Determine exit code based on errors and CI environment
299- # In CI we might want to exit gracefully for some failures
300- CI_EXIT_ON_TEST_FAILURE=${CI_EXIT_ON_TEST_FAILURE:- 1}
299+ # Use the CI_EXIT_ON_TEST_FAILURE value set at the beginning of the script (=1)
300+ # to determine whether to exit with an error code on test failures
301301
302302if [ $FAILED_TESTS -gt 0 -o $TIMED_OUT_TESTS -gt 0 ]; then
303303 echo " Test run had $FAILED_TESTS failing tests and $TIMED_OUT_TESTS timed out tests" | tee -a " $SUMMARY_LOG "
Original file line number Diff line number Diff line change @@ -15,8 +15,16 @@ sonar.tests=test_dir
1515sonar.python.coverage.reportPaths =coverage.xml
1616
1717# Configure test coverage exclusions
18+ # ollama.py is excluded as it primarily contains integration code with external dependencies
19+ # that is difficult to test without mocking the entire Ollama API
1820sonar.coverage.exclusions =test_dir/**/*,tests/**/*,src/cli_code/models/ollama.py
1921
22+ # Force SonarCloud to see all files as new code to get proper coverage metrics
23+ # Note: We're using this temporarily to establish accurate baseline coverage
24+ # TODO: Remove this line after initial coverage baseline is established to ensure
25+ # future PRs are evaluated correctly for new code coverage
26+ sonar.newCode.referenceBranch =origin/main
27+
2028# Specify Python version
2129sonar.python.version =3.11
2230
You can’t perform that action at this time.
0 commit comments