Error parsing lcov coverage report using SonarQube

  • ALM used - GitHub
  • CI system used - GitHub Actions
  • Scanner command - Run SonarSource/sonarqube-scan-action@v5.1.0
  • Languages of the repository - Python
  • Error observed:

[1785](https://github.com/unbounce/copilot/actions/runs/14844644112/job/41675513479?pr=149#step:7:1790)19:42:15.385 WARN Cannot read coverage report '/home/runner/work/copilot/copilot/src/coverage/cov.info', the following exception occurred: 'Error parsing the report '/home/runner/work/copilot/copilot/src/coverage/cov.info''

[1786](https://github.com/unbounce/copilot/actions/runs/14844644112/job/41675513479?pr=149#step:7:1791)

Hey team, I’m trying to get SonarQube to read my coverage report but its having issues trying to parse it. I’ve verified the file exists at that path and I’ve used a few libraries to validate the file (lowdb - npm, and lcov python library). They seem to parse my file correctly. I’m not exactly sure what’s going on. Adding the debug statements don’t seem to provide much information.

This is the command I’m using to generate the file report.

poetry run pytest --cov=tests/unit --cov-report lcov:src/coverage/cov.info tests/unit

Here’s the GitHub actions yaml definition

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4
      with:
        fetch-depth: 0  # Shallow clones should be disabled for a better relevancy of analysis

    - name: Build docker image
      run: make build-test

    - name: Run tests
      run: make unit-test

    - name: Run SonarQube Scan
      uses: SonarSource/sonarqube-scan-action@v5.1.0
      env:
        SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
        RUNNER_DEBUG: 1

And here’s my sonar-project.properties file

sonar.projectKey=unbounce_copilot
sonar.organization=unbounce

sonar.sources=src/
sonar.tests=tests/

sonar.exclusions=src/database/migrations/*.sql,src/envs/.env.example,src/langgraph_agent/llm_config.json

sonar.python.coverage.reportPaths=src/coverage/cov.info

Would you be able to provide me some assistance with this issue?

Hi,

I know you said that debug logging doesn’t add much information, but could you share those logs - and the report - anyway?

 
Thx,
Ann