Issue with PR analysis

Hello everyone,

This is my first post as a SonarCloud project administrator. So far, I was just a regular user of this tool. The project that I am trying to set up is a private C++ project on GitHub.

I have some folders (mainly third-parties) to exclude from the Sonar analysis, I create a and set the sonar.exclusions property. Because of this, I had to disable automatic analysis and setup a GitHub action as explained in the tutorial.

Here is my yaml file:

name: Build
      - main
    types: [opened, synchronize, reopened]
    name: Build
    runs-on: ubuntu-latest
      BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory
      - uses: actions/checkout@v3
          fetch-depth: 0

      - name: Install sonar-scanner and build-wrapper
        uses: SonarSource/sonarcloud-github-c-cpp@v1

      - name: Build
        run: |
          cmake --preset configure-default
          build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} cmake --build --preset build-default

But I am facing some issues now:

  1. There is no Sonar analysis of the new code in my pull request (in automatic way, Sonar posts a comment with an analysis of the new code)
  2. I find neither my dev branch or my pull request in my Sonar project.

Can you help me to fix it please?

Thank you.

Shame on me! I did a mistake when rebasing/merging two git branches. I remove the below part in my GitHub action:

      - name: Run sonar-scanner
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
        run: |
          sonar-scanner --define"${{ env.BUILD_WRAPPER_OUT_DIR }}"

It seems that it works now.

Sorry for the inconvenience.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.