Github Actions scan showing no code and no coverage

  • ALM used: GitHub
  • CI system used: Github Actions
  • SonarSource/sonarqube-scan-action@v5
  • Languages of the repository: Python, Typescript
  • Only if the SonarCloud project is public: SonarQube Cloud
  • Error observed: None

We are trying to configure the repository to report code coverage, which requires turning off the automatic analysis. However, the branch we’re working on this in reports no code coverage, nor does it even show code files.

The sonar-project.properties file. A recent scan run where it did find the backend and frontend coverage files, but seems to have not reported the information. I’m not sure what is wrong with the configuration.

Hey @stumpylog

I suspect the issue is going to be with the merged reports somehow. Could you maybe upload them as an artifact in the build so they’re easy to review?

An interesting idea. I’ve added a run which uploaded the merged data as well. The frontend has some problems I’ll have to look into, but the backend file appears to be generally fine.

https://github.com/paperless-ngx/paperless-ngx/actions/runs/17833909175

It’s quite odd that besides coverage, the branch view doesn’t show any code files either. I’m not sure how no code would be found: SonarQube Cloud

Hey @stumpylog!

So I think you’ve got everything right in the branch. If I hop into the Web API:

// https://sonarcloud.io/api/measures/component?metricKeys=coverage&componentKey=paperless-ngx_paperless-ngx&branch=chore%2Fsonar-qube-actions
{
  "component": {
    "id": "AZlP1eAVzUoshXiB2Q67",
    "key": "paperless-ngx_paperless-ngx",
    "name": "paperless-ngx",
    "qualifier": "TRK",
    "measures": [
      {
        "metric": "coverage",
        "value": "63.6",
        "bestValue": false
      }
    ],
    "branch": "chore/sonar-qube-actions"
  }
}

But because you are on a short-lived branch with no code changed to actual code, only workflow files, SonarQube Cloud sees the branch as empty.

I agree this is not a great experience when you’re just trying to set up coverage reporting. IMO, we should always show an “Estimated after merge” figure, instead of the misleading “not enough lines” message.

For better testing you can either reanalyze as a long-lived branch… or cross your fingers and merge.

Hi Colin thanks so much for your help, we’ve managed to get this further down the road and it seems like coverage and scanning is working—just without any comments on our PRs. I tried re-reading the docs, searching (even with your helpful AI assistant) but to no avail.

For example: Feature: Remote OCR (Azure AI) by shamoon · Pull Request #10320 · paperless-ngx/paperless-ngx · GitHub hasnt been updated even though Merge branch 'dev' into feature-remote-ocr-2 · paperless-ngx/paperless-ngx@e5cafff · GitHub / Feature: Remote OCR (Azure AI) by shamoon · Pull Request #10320 · paperless-ngx/paperless-ngx · GitHub seems to have worked correctly.

Heres the workflow: Merge branch 'dev' into feature-remote-ocr-2 · paperless-ngx/paperless-ngx@e5cafff · GitHub

Are we missing something obvious??

Thank you again!

Oh, I just saw Troubleshooting Missing Pull Request Decoration in SonarQube Cloud

  1. Check Organization Binding (Org Admins) :white_check_mark:
  2. Check Project Binding (Project Admins) :white_check_mark:
  3. DevOps Platform-specific Troubleshooting :white_check_mark: Ensured access to the repo for the app

Screenshots below

Thank you!

Hey @shamoon,

Glad to hear you made some progress. I’ve taken a look at your project and I admit, your workflow file is quite large and a bit hard to follow all the details :laughing:

Looking at your most recent PR, I can see that SQ analysis ran on the branch (triggered by a push event), but it doesn’t appear to have run specifically in the pull_request context. This means only a branch analysis has been performed, not a PR analysis.

This distinction is important because running in the PR context is needed for SQC to post its comment on the pull request.

What is stopping all those PR jobs that your PRs appear to expect to be run from… running? I think that’s what you have to figure out.

Amazing I think you’re right! We’re working out the details but indeed that seems to be the crux of it. Thank you!