Problem with detecting changes on PRs in Azure DevOps

Hey folks, I use SonarCloud in the Azure DevOps pipeline for analyzing PRs. The problem is after a PR was created and analyzed by SonarCloud, the comments added to the PR do not belong to the PR changes and contain all issues related to the whole repository. is there any way to change this behavior?
the stack of my repository is .net this is my pipeline code.

- task: UseDotNet@2
  displayName: 'Use .NET Core sdk'
  inputs:
    packageType: 'sdk'
    includePreviewVersions: true
    useGlobalJson: true

- task: MSBuild@1
  inputs:
    solution: '$(solutionPath)'
    msbuildVersion: '17.5.1'
    configuration: 'Release'
    msbuildArguments: '-t:restore,build -p:RestorePackagesConfig=true /p:configuration="release" /p:VisualStudioVersion="17.5.1"'
  displayName: 'Build - Generate Codes'

- task: SonarCloudPrepare@1
  inputs:
    SonarCloud: '*******'
    organization: '*******'
    scannerMode: 'MSBuild'
    projectKey: '*******'
    projectName: '*******'
    extraProperties: |
      sonar.exclusions=**/Migrations/**

- task: MSBuild@1
  inputs:
    solution: '$(solutionPath)'
    msbuildVersion: '17.5.1'
    configuration: 'Release'
    msbuildArguments: '-t:restore,build -p:RestorePackagesConfig=true /p:configuration="release" /p:VisualStudioVersion="17.5.1"'
  displayName: 'Build Solution'

- task: SonarCloudAnalyze@1
  displayName: 'Run Code Analysis'

- task: SonarCloudPublish@1
  displayName: 'Publish Quality Gate Result'

Hey there.

Can you check if shallow fetch is enabled or not?

Thanks Colin for your reply, I checked pipeline setting and shallow fetch was the cause of my problem. I appreciate your help

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.