Is it an option for Sonar NOT to scan local git folder, and just focus on the project itself?

Yesterday I downloaded Sonar and scanned my Angular/TS project by running this inside the project folder in cmd:
sonar-scanner.bat -D"sonar.projectKey=Angular1" -D"sonar.sources=." -D"sonar.host.url=http://localhost:9000" -D"sonar.login=<token value>"

, noticed it found something it’s not exists at all which was deleted completely from the folder a while ago. After some study I realized it’s pulling from the .git folder.

  • sonarqube=8.9.0.43852, Windows 10 (64-bit), VSC=1.56.2, Angular=11
  • what are you trying to achieve = Tell Sonar not to look into .git folder at all, so it just focuses on latest build.
  • what have you tried so far to achieve this = Manually removed the outdated and no-long-exists content from local git using Git Bash.

Hi @Tom_Larry ,

SCM integration is essential if you want to track who modifies codes of lines, which can be linked to issues in SonarQube. If you not interested in assigning issues based on the git annotation data, you can skip such information by setting sonar.scm.disabled=false so in your case: -D"sonar.scm.disabled=false".

Joe

EDIT: I meant to set to true, not false! sonar.scm.disabled=true

1 Like

@Joe Is this setting to be set in file sonar-project.properties?

You can set it in sonar-project.properties or at your sonar-scanner.bat command line. Either place will work. You use sonar-project.properties file if you want to preserve the details of project-specific sonar-scanner properties without having to enter it everytime at the command line.

Joe, seems like it needs to be true to disable this feature.

@Tom_Larry You are correct, my apologies, I’ve updated the post.

1 Like

Hi again @Tom_Larry ,

Sorry to ping you again, but after 2nd thought, it seems the behavior you are seeing may be unusual and I’d like to see some more of the issue you are seeing. Can you share the DEBUG logs (add -X to sonar-scanner.bat command) with sonar.scm.disabled=false (yes, false since we want to see what you initial errors look like)?

Joe

@Joe After scan with -X switch, navigate to http://localhost:9002/, it only displays this:

{
“name” : “sonarqube”,
“cluster_name” : “sonarqube”,
“cluster_uuid” : “quKn_qEfSpyHM38QNlgerg”,
“version” : {
“number” : “7.12.1”,
“build_flavor” : “unknown”,
“build_type” : “unknown”,
“build_hash” : “3186837139b9c6b6d23c3200870651f10d3343b7”,
“build_date” : “2021-04-20T20:56:39.040728659Z”,
“build_snapshot” : false,
“lucene_version” : “8.8.0”,
“minimum_wire_compatibility_version” : “6.8.0”,
“minimum_index_compatibility_version” : “6.0.0-beta1”
},
“tagline” : “You Know, for Search”
}

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