Azure Devops (GitHub repository) + SonarCloud = No issues found in Pull Requests

scanner
sonarcloud

(Jakub Kisielewski) #1

I’ve setup a simple CI pipeline with Azure Devops (Prepare -> Run -> Publish). When pushing directly to the master branch code is properly analyzed. However when a pull request is analyzed, the worker reports issues (see Run Code Analysis log: https://dev.azure.com/sourcemod-donations/sourcemod-donations/_build/results?buildId=19) but they’re not visible on SonarCloud, I get the “No issues.” message (see: https://sonarcloud.io/project/issues?id=sourcemod-donations_sm-donations-api&pullRequest=1&resolved=false).
The strange part is that Sonar detects 4 changed lines in the Code tab but no changes in Measures tab.

How do I make it work?


(Colin Mueller) #2

Hey Jakub,

You’ll note that the file cannot be parsed, which is not an issue that will be reported on SonarQube. SonarQube can’t analyze the file because… it can’t parse it.

I would remove your invalid syntax (line 21, “n o t ph p c o d e”) and try again.

Colin


(Jakub Kisielewski) #3

Hi,

Thanks for the answer. I added this part because earlier Sonar wouldn’t pickup stuff I left there intentionally either (unused variables and wrong code formatting). Now I reverted the code to mentioned state and the issue still persists. Please see: https://sonarcloud.io/project/issues?id=sourcemod-donations_sm-donations-api&pullRequest=4&resolved=false and https://dev.azure.com/sourcemod-donations/sourcemod-donations/_build/results?buildId=39


(Colin Mueller) #4

You’ve elected to use a very small Quality Profile (which defines the rules applied to a project), “PSR-2”, try using the default Sonar Way. :slight_smile:

Colin


(Jakub Kisielewski) #5

Wow! This worked, thank you! There should be a big red warning that the PSR2 code check most probably isn’t what the user wants :slight_smile: