There is a fileA
on master
(say it consists of 1000 lines)
We are on feature_branch
, where fileA
has length of say 1050 lines.
On our CI pipeline, we are running coverage
(it is a Python project) and it produces coverage.xml
, to be used as cov input to SQ.
Our SQ preview stage is as follows:
- git config --global user.name "SonarQube"
- git config --global user.email "sonarqube@somedomain.com"
- git checkout origin/master
- git merge $CI_BUILD_REF --no-commit --no-ff
- sonar-scanner -Dsonar.analysis.mode=preview -Dsonar.gitlab.project_id=$CI_PROJECT_PATH -Dsonar.login=$SONARQUBE_TOKEN -Dsonar.gitlab.commit_sha=$CI_COMMIT_SHA -Dsonar.gitlab.ref_name=$CI_COMMIT_REF_NAME
except:
- master@mainprojectnamespace
The problem is the following:
AFTER the merge, fileA
ends up having (again) 1000 lines
HOWEVER, coverage
was run BEFORE the merge (in a previous job) so it includes results for lines > 1000 (which is fileA
's length after the merge)
This causes (I believe) the following error:
ERROR: Error during SonarQube Scanner execution
java.lang.IllegalStateException: Line 1040 is out of range in the file path/to/fileA.py (lines: 1000)
How do we go about this?