SonarQube version: Enterprise Edition Version 9.9 (build 65466)
problem detail : my pull request only contains one file changed, but sonar new code display that hava many file changed , does anyone know why the sonarqube new code and the pull request change file is not consistent? thank you !
here is my build.yml:
name: SonarQube
on:
push:
branches:
- develop, feature/* # the name of your main branch
pull_request:
branches:
- develop, feature/* # the name of your main branch
types: [opened, synchronize, reopened]
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 17
- name: Cache SonarQube packages
uses: actions/cache@v1
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache Maven packages
uses: actions/cache@v1
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Build and analyze
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar
# Check the Quality Gate status.
- name: SonarQube Quality Gate check
id: sonarqube-quality-gate-check
uses: sonarsource/sonarqube-quality-gate-action@master
# Force to fail step after specific time.
timeout-minutes: 5
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} #OPTIONAL
# Optionally you can use the output from the Quality Gate in another step.
# The possible outputs of the `quality-gate-status` variable are `PASSED`, `WARN` or `FAILED`.
- name: "Example show SonarQube Quality Gate Status value"
run: echo "The Quality Gate status is ${{ steps.sonarqube-quality-gate-check.outputs.quality-gate-status }}"
here is sonarqube report:
display there have 4k new lines
my PR only have one file changed:
and i try to add properties below, it is all the same problem.
-Dsonar.pullrequest.key=${{github.event.pull_request.number}} -Dsonar.pullrequest.branch=${{github.head_ref}} -Dsonar.pullrequest.base=refs/remotes/origin/develop -Dsonar.newCode.referenceBranch=refs/remotes/origin/develop
does any one know how to resolve the problem? is any configuration lossed ? thank you very much