How to separate the branches in SonarQube?

I have used SonarQube Community Edition, and I work on projects with multiple future branches. After the scan, it shows issues that are related to other branches, and in the history, it displays the history of all branches.
the stage with gitlab.

sonarqube-check:
  image: maven:3.8.3-openjdk-17
  variables:
    SONAR_USER_HOME: "${CI_PROJECT_DIR}/.sonar"  # Defines the location of the analysis task cache
    GIT_DEPTH: "0"  # Tells git to fetch all the branches of the project, required by the analysis task
  stage: sonarqube-check
  except:
    refs:
      - develop
      - master
  tags:
    - dna    
  cache:
    key: "${CI_JOB_NAME}"
    paths:
      - .sonar/cache
  script: 
    - mvn verify sonar:sonar -Dsonar.qualitygate.wait=true -Dsonar.projectKey=conversational-talent-intelligence-platform_digital-platform_data-ms_AY3kz9DJ2Fa-uo6M99Vc

Hi,

Welcome to the community!

Community Edition doesn’t support multiple branches per project. If you’re using some 3rd-party functionality that supports that, you’ll need to talk to its maintainers.

 
Ann

could this also be experienced by scanning multiple branches “into” the same projectKey?

in that case, if i recall correctly, in community edition you need to specify distinct projectKey values for each of the branches you want to scan. HTH

1 Like