Analysis Warning - Shallow Clone Detected

We are using SonarQube Cloud and integrated with Azure DevOps project. Our code base is primarily C# and we have added the below step in our pipeline but we are still getting the shallow clone warning in SonarQube Cloud.

jobs:

  • job: BuildCode
    displayName: ‘Build Solution’
    steps:
    • checkout: self
      fetchDepth: 0

Hey there.

SonarQube Cloud’s check to see if there’s a shallow clone is pretty simple – it checks for the existence of a .git/shallow directory – and if so, warns that a shallow clone as been performed.

Maybe performing a clean checkout will help?

steps:
- checkout: self
  clean: true
  fetchDepth: 0