Hi brand new to SonarCloud, thank you for reading. What brings me here today is the following message on our summary page where I see a warning at the upper right:
The last analysis has a warning. See details
I click on the “See details”
Last analysis has warnings
Your project contains only TEST-code for language C# and no MAIN-code for any language, so only TEST-code related results are imported. Many of our rules (e.g. vulnerabilities) are raised only on MAIN-code. Read more about how the SonarScanner for .NET detects test projects: Analysis of product projects vs. test projects · SonarSource/sonar-scanner-msbuild Wiki · GitHub
I appreciate how informative and comprehensive this Github wiki page is, but I’m not gonna sugar coat or attempt to preserve any pride here, I don’t follow. It’s a ton of context, none of which I’m able to connect the dots with my error. I hope to see something on this page about TEST-code or MAIN-code – nothing.
We run our CICD out of Bitbucket Pipelines, this is what I have stubbed out which a former engineer had working with another project.
script:
- cd src/projectName
- dotnet restore
- dotnet build --configuration=Release --no-restore
- |
dotnet sonarscanner begin \
/k:"${BITBUCKET_REPO_SLUG}" \
/d:sonar.login="${SONAR_TOKEN}" \
/o:"extendedstay-website" \
/d:"sonar.host.url=https://sonarcloud.io" \
/d:sonar.cs.opencover.reportsPaths="test-results/**/coverage.opencover.xml"
- dotnet test --configuration=Release --no-restore
- dotnet sonarscanner end /d:sonar.login="${SONAR_TOKEN}"
Our project lives in src/projectName
where I’ve updated the respective .csproj
file with the following XML (there’s more here, omitting for this community post):
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<SonarQubeTestProject>false</SonarQubeTestProject>
</PropertyGroup>
</Project>
I expect SonarCloud to test code in here, clearly it isn’t.
Is there a troubleshooting guide I can follow? Possible to access paid support? I’m not sure where to go next, any help provided will be greatly appreciated.