Hi,
- Developer Edition
- Version 9.1
- Azure devops
- Swift
- MacOS M1
We keep getting Sonar error complaining code line out of range. The error message is:
ERROR: Error during SonarScanner execution
ERROR: Error during parsing of the generic coverage report ‘/XXX/XXX/XXX/_work/3/s/sonarqube-generic-coverage.xml’. Look at SonarQube documentation to know the expected XML format.
ERROR: Caused by: Line 44 is out of range in the file AppLinkable/Sources/AppLinkable/AppLinkable.swift (lines: 43)
The code it complains on has only 42 lines, we don’t understand how Sonar would expect line 44.
I get this error not only in this file but also in other files. This is not a persistent error. When I run it without making any changes, it works fine from time to time.
I use Azure Devops as the CI tool. The server it was built on has macos m1 operating system. I run it in pipeline with the following commands.
I never received this error in my other projects where I worked with the same standards and environment.
- script: |
bash xccov-to-sonarqube-generic.sh Build/Logs/Test/*.xcresult/ > sonarqube-generic-coverage.xml
- script: |
rm -rf sonar-reports
rm -rf reports/*
cp /XXX/XXX/sonar-project.properties .
sonar-scanner -Dsonar.host.url=$(SONAR_URL) -Dsonar.login=$(SONAR_KEY) -Dsonar.projectKey=$(SONAR_PROJECT_KEY) -Dsonar.projectName=$(SONAR_PROJECT_NAME) -Dsonar.coverageReportPaths=$(COVERAGE_PATH) -Dsonar.qualitygate.wait=true -Dsonar.exclusions=**/*.xml,**/*.m,**/*.html,/Frameworks/** -Dsonar.cfamily.build-wrapper-output. bypass=true