Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Branch analysis is not working #1025

Open
crcaguilerapo opened this issue Jan 9, 2025 · 2 comments
Open

Branch analysis is not working #1025

crcaguilerapo opened this issue Jan 9, 2025 · 2 comments
Labels
bug Something isn't working

Comments

@crcaguilerapo
Copy link

crcaguilerapo commented Jan 9, 2025

Describe the bug
When performing an analysis on a branch that is not yet associated with a PR, the new code is not being analyzed according to the project's Sonar configuration.

To Reproduce

  1. Configure a Sonar project with New Code set to: Compared to master.
  2. Checkout a branch derived from master.
  3. Add defective code.
  4. Perform an analysis of the created branch:
    sonar-scanner-5.0.1.3006-linux/bin/sonar-scanner \
      -Dsonar.organization=${SONAR_ORG} \
      -Dsonar.projectKey=${SONAR_PROJECTKEY} \
      -Dsonar.host.url=${SONAR_HOST_URL} \
      -Dsonar.token=${SONAR_TOKEN} \
      -Dsonar.branch.name=${BRANCH}
  1. No malicious code detected:
    image

Expected behavior
The analysis should yield the same result as when scanning the same branch associated with a PR:

    sonar-scanner-5.0.1.3006-linux/bin/sonar-scanner \
      -Dsonar.organization=${SONAR_ORG} \
      -Dsonar.projectKey=${SONAR_PROJECTKEY} \
      -Dsonar.host.url=${SONAR_HOST_URL} \
      -Dsonar.token=${SONAR_TOKEN} \
      -Dsonar.pullrequest.branch=${BRANCH} \
      -Dsonar.pullrequest.key=${PULL_REQUEST} 

Software Versions

  • SonarQube Version: sonarqube:10.3-community
  • Plugin Version: sonarqube-community-branch-plugin-1.18.0.jar
@crcaguilerapo crcaguilerapo added the bug Something isn't working label Jan 9, 2025
@gaaplex
Copy link

gaaplex commented Jan 10, 2025

Thanks for the contribution!

@crcaguilerapo
Copy link
Author

Hi @mc1arke,
Could you help me with this? Maybe I’m doing something wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants