Azure DevOps Shallow clone warning when fetchDepth set to 0

  • ALM used: Azure DevOps
  • CI system used: Azure DevOps
  • Language: C#
  • Current behavior: All analyses are getting the following warning:
    • Warning in last analysis:
      • Shallow clone detected during the analysis. Some files will miss SCM information. This will affect features like auto-assignment of issues. Please configure your build to disable shallow clone.
  • Steps to reproduce
    • Setup with as monorepo in SonarQube Cloud
    • Use SonarCloudPrepare and SonarCloudAnalyze v2 tasks
    • Use pipeline template for
      • Checkout self and 1 other repo
      • Set both to fetchDepth of 0
    • Include pipeline template in each pipeline for monorepo:
      • Provide extraProperties to sonar.projectBaseDir to help find .git folder
      • Use MSBuild scanner mode
    • Run the pipeline
  • No known workarounds

Generally it seems to get the git info and will only report issues/comment on the files that actually changed except in some edge cases but it doesn’t pick up on what lines of the file were changed and for some of our older and larger code files that have issues, this could produce the max number of issues even though they are unrelated to the changes. Since we are getting this warning, I’m assuming something is being missed in the setup but it’s not the obvious fetchDepth that I’ve stated above we already set.

Any ideas what I’m missing?

Hi,

Could you share your pipeline?

 
Thx,
Ann