-
ALM used: GitLab
-
CI system used: GitLab CI
-
Scanner command used: sonar-scanner
-
Languages of the repository: C#, JS
-
Error observed: No issues are shown in GitLab merge request SonarCloud Code Analysis box. Yet SonarLint shows around 1500 issues in repo and 10 within the changed file
Hi,
Welcome to the community!
For a merge request, it’s not surprising you see few issues or none.
Merge request analysis is designed to only show the issues being added by that MR. It won’t show all existing issues in the overall code. (If it does, something’s been misconfigured.)
And by default SonarLint focuses on issues in the file you’re working in. In both cases, the focus is on helping you Clean as You Code.
HTH,
Ann
Hi Ann,
Many thanks for your reply.
I am trying to test SonarCloud to see how useful it might be for us.
I have tried committing the following C# code which I took from the SonarCloud ruleset so that my commit deliberately has code issues and should report them.
public void WriteMatrix(int[][] matrix) // Noncompliant: data type is not intuitive
{
// ...RSPEC-2368
}
public bool GetTrue() => true;
public bool GetFalse() => true;
public bool RSPEC_2178()
{
if (GetTrue() | GetFalse()) // Noncompliant: both sides evaluated
{
return true;
}
return false;
}
Still nothing is being reported.
I would expect something to happen or what is the point of SonarCloud right?
I’m sure I am doing something wrong but I have no idea what?
Hi,
When you look at that PR in SonarCloud, do the expected lines show up as “new”?
Also, can you provide the analysis log of your PR?
The analysis / scanner log is what’s output from the analysis command. Hopefully, the log you provide - redacted as necessary - will include that command as well.
This guide will help you find them.
Ann