highbyte / sonarscan-dotnet

GitHub Action SonarCloud/SonarQube scanner for .NET 8/7/6/5 and .NET Core applications with pull request decoration support
https://github.com/marketplace/actions/sonarscan-dotnet
MIT License
36 stars 24 forks source link

SonarCloud branch page is blank #12

Closed rcdailey closed 2 years ago

rcdailey commented 2 years ago

I followed the instructions in your main README.md and ended up with this workflow job (from this file):

env:
  dotnetVersion: 6.0.x
  SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:
  sonarcloud:
    name: SonarCloud
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
        with:
          fetch-depth: 0
      - uses: highbyte/sonarscan-dotnet@v2.1.2
        with:
          sonarProjectKey: rcdailey_trash-updater
          sonarProjectName: trash-updater
          sonarOrganization: rcdailey
          dotnetBuildArguments: ./src
          dotnetTestArguments: ./src

Here is the resulting build, which succeeded. However, the sonarcloud summary page for that branch shows no issues, and the code tab is blank!

What am I doing wrong?

highbyte commented 2 years ago

For "short-lived" branches SonarCloud only scans "new" code by default, maybe that could be the reason? When it's merged to main/master all code will be scanned.

https://sonarcloud.io/documentation/enriching/branch-analysis/#short-lived-branch-analysis

It's possible to change the definition of "long-lived" branches in the SonarCloud dashboard under the Branches tab, so a feature branch would get all its code scanned.

It's also possible to change the definition of what "new" code is

https://sonarcloud.io/documentation/improving/new-code/

rcdailey commented 2 years ago

I'm really late to this, but I think you solved my problem. Everything is working at this point. Thank you for the help. I'll close this one out.