Hi,
We’re using SonarQube Server v2025.1 (102418) with Azure DevOps and the latest Azure Extension 7.1.1.
New code is defined as Reference branch (master), so we want to analyze only the files that have changed between the branch and master.
When we modify only one file in a Pull Request, SonarQube correctly scans that file and add comments for the issues in it :
But in the Pull Request in the bottom, we have 8 comments and we have this error message for the files that are not par of the PR :
This file no longer exists in the latest pull request changes. It may have been moved or deleted. View the comment in its original context.
We don’t understand why it scans this file as it has not changed in the branch and the Pull Request?
We took one issue on a file that has not changed and open this file from the PR in SonarQube Code for this PR, we can see here that file is detected as new code. Then we open the same file from master and we compared the two version, they are identitical!!. We did the same with the file that has changed in the PR and we can see the changes!!
Same file but detected as new code :
This is our Azure pipeline :
parameters:
- name: 'NugetVersion'
type: string
- name: 'SolutionName'
type: string
- name: 'SonarProjectKey'
default: ''
type: string
- name: 'SonarExclusion'
default: ''
type: string
steps:
- task: NuGetToolInstaller@1
displayName: 'Use NuGet ${{ parameters.NugetVersion }}'
inputs:
versionSpec: ${{ parameters.NugetVersion }}
- task: NuGetCommand@2
displayName: 'NuGet restore'
inputs:
feedsToUse: config
nugetConfigPath: ./nuget.config
externalFeedCredentials: 'Telerik Nuget Feed'
- task: SonarQubePrepare@7
displayName: 'Sonar Prepare Analysis'
inputs:
SonarQube: 'SonarQube Gu'
projectKey: ${{ parameters.SonarProjectKey }}
projectVersion: '$(Nuget.Version)'
extraProperties: |
sonar.exclusions=${{ parameters.SonarExclusion }}
- task: VSBuild@1
displayName: 'Build solution ${{ parameters.SolutionName }}'
inputs:
solution: '${{ parameters.SolutionName }}.sln'
platform: 'any cpu'
configuration: 'Release'
maximumCpuCount: true
- task: DotNetCoreCLI@2
displayName: 'Tests'
inputs:
command: test
projects: '**/*Test*.csproj'
arguments: '-c Release --logger trx --no-build --collect "Code Coverage"'
publishTestResults: true
- task: SonarQubeAnalyze@7
displayName: 'Sonar Code Analysis'
- task: SonarQubePublish@7
displayName: 'Sonar Quality Gate Result'
Is it a bug? What is wrong with our configuration?
Thanks for support