SCM provider autodetection failed. Please use "sonar.scm.provider" to define SCM of your project

We are getting a warning “SCM provider autodetection failed. Please use “sonar.scm.provider” to define SCM of your project, or disable the SCM Sensor in the project settings”. We are using Developer Edition Version 9.7.1. There is no coverage and another analysis report is present for PRs, after analysis got to know that SCM is used to find the files that changed and the lines that changed relative to the base branch. Without that, the PR analysis will not be very useful. Tried sonar.scm.provider also to set it as Git but after that getting the error: Sonarqube analysis fails Not Inside Git Work Tree. Anyone can help us to understand what is the issue and how we can solve this?

Hi,

Welcome to the community!

The wording of that warning is unfortunate, as you’ve discovered.

Okay, so you know why this is important. Now to figure out what to do about it…

The question is how your build agent is getting the code to analyze. Typically your pipeline would check out and then run analysis in the same directory - in that way the SCM files would be there to be read by analysis.

I guess you’re doing some processing between checkout and analysis? Can that not happen? Or happen in a different sequence?

 
Ann

Hi @ganncamp Thanks for quick reply, here with Pull request analysis, code coverage is always showing 0%, this is the issue I am facing

Hi,

We try to keep it to one topic per thread. Otherwise it can get messy, fast. Your initial post was about the SCM warning, so please create a new thread for the coverage question. Include your analysis log.

 
Ann