Hello! We have a .Net Core repository and I’d like to test our default branch (called develop) by Sonar scanner.
I renamed the “main branch” to develop in the sonarqube server.
I’ve set the SourceSource File Inclusions (relative from the Sonar.Test project).:
../src,
../Application.Integration.Test
and Source File Exclusions.:
../src/WebUI/wwwroot/**,
**/*.xml.. and so on…
I execute the scanner in the Sonar.Test project.
After scanning I got the message from sonarqube server:
“The main branch has no lines of code”
I found a message in the scanner report:
INFO: 0 files indexed
INFO: 728 files ignored because of inclusion/exclusion patterns
I’ve tried so set the SourceSource File Inclusions so many way. But I always get same message.
These are the versions: dotnet-sonarscanner version: 8.0.3 SonarQube server version: 9.9.6 (ZIP)
What am I doing wrong? Could anyone help to me? Thanks,
Zoltan
Our plan was to analyze the contents of the src folder, including its subfolders, except for the wwwroot and 3rdPartyLibs subfolders. (those are full of 3rd party libaries)
So we set the analysis scope this way:
sonar.sources set to ../src
sonar.exclusions set to ../src/WebUI/wwwroot/**, ../src/Infrastructure/3rdPartyLibs/** and **/*.xml
The wwwroot and 3rdPartyLibs is under the src folders (see the relative path before)
I will remove the Application.Integration.Test from sonar.source.
Your use of ../ in this context is highly unusual. I’ve seen ./, which while completely superfluous, is a harmless notation that means “start from this current directory”. But ../ means “go to the parent directory of the current directory, and…”. So its use here implies that you’re triggering analysis from a sister directory of src. Is that the case? And if so, why?
We liked to separate the config of the sonarqube into a “sister directory” as you said.
We didn’t know that it is not possible or “bad practise”
If your opinion is, its a bad practise and we should run the scanner from the root, than we will move the sonar config to the root.