"0 Lines of Code" in initial Github Actions .Net setup

This is a .NET 5 project (just a very small solution for testing) on Github and I am using Github Actions, here is my YAML:


  sonarcloud:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
      with:
        # Disabling shallow clone is recommended for improving relevancy of reporting
        fetch-depth: 0
    - name: SonarCloud Scan
      uses: sonarsource/sonarcloud-github-action@master
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
      with:
        args: >
          -Dsonar.verbose=true
          -Dsonar.loglevel=DEBUG

and here is my sonar-project.properties:

sonar.organization=[KEY]
sonar.projectKey=[KEY]
sonar.sources=.

It is working, but I am getting “0 Issues 0.0% Coverage 0.0% Duplications 0 Lines of Code”

Are my settings wrong? YAML?

Might be a dumb question, as this (https://github.com/marketplace/actions/sonarcloud-scan) says to not use it in a .NET solution - should I just use another method?

Hi Stan

The easiest was to set this up is to follow the tutorial from Sonarcloud which will generate the required YAML for you that you can paste into your action. The commands are different to the above for a .NET project. You can assess the tutorial when you select analyse new project from the + menu on the right of the top menu bar.

If you have time I’d be really interested to understand the steps you took that led you to where you are. When the setup journey isn’t clear I’d really like to understand where we can make it better :slight_smile:

Hope that helps

Tom

1 Like

When you are in Github Actions and edit, you can choose components:

If you “View full marketplace listing” you get sent here: https://github.com/marketplace/actions/sonarcloud-scan

Which does not tell you to do what you said, but to download an extension that was a hassle to get working as I somehow wasn’t recognized as in my organization, etc. There was really no direction from here, I had no idea that menu option existed… I eventually figured it out.

Hi Stan

Yes I can see the problem, I’m sorry for the hassle that caused you. Thanks for the feedback that’s really useful. I’ll see what I can do to improve the experience.

Tom