Uploaded image for project: 'SonarQube'
  1. SonarQube
  2. SONAR-11365

Analysis of a PR targeting a short living branch analyzed only as a PR is using wrong configuration

    XMLWordPrintable

    Details

    • Edition:
      Developer
    • Production Notes:
      None

      Description

      Steps to reproduce:

      • analyze master as a long living branch
      • create a branch feature/common, and analyze it as a PR: -Dsonar.pullrequest.key=common_on_master -Dsonar.pullrequest.base=master -Dsonar.pullrequest.branch=feature/common
      • create a branch feature/short, and analyze it as a PR: -Dsonar.pullrequest.key=pr_on_pr -Dsonar.pullrequest.base=feature/common -Dsonar.pullrequest.branch=feature/short

      In debug logs, you'll see:

      Load branch configuration
      The merge branch is a pull request. Resolving to its base instead: 'feature/common'
      Load branch configuration (done) | time=5ms
      Load project repositories
      GET 404 http://localhost:9000/batch/project.protobuf?key=org.sonarsource.clirr%3Asonar-clirr-plugin&branch=feature/common | time=6ms
      Project repository not available - continuing without it
      Load project repositories (done) | time=11ms
      

      The analysis will not fail, but the PR will be analyzed like if it was a new project (using global settings and default quality profile). This may ends up with unrelated issues.

      For a PR analysis, there is a confusion on scanner side between:

      • the base branch of the PR from an ALM point of view (sometimes also called target) that we will use to determine changed files/lines
      • the long living branch SQ analysis we will use as a reference to load settings/quality profiles and later do issue tracking.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              julien.henry Julien Henry
              Reporter:
              julien.henry Julien Henry
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Due:
                Created:
                Updated:
                Resolved: