We have a CI pipeline set up to build our C# .net core 3.1 project in a docker container, which also runs the sonarcloud scanner. We have successfully analysed the master branch and the homepage for the project displays code smells, coverage, bugs and everything we would expect.
However, when we run the analysis for a branch specifying the pull request parameters, the analysis always reports as successful but doesn’t look like it’s actually analysed any code from the sonarcloud UI. I have introduced code that breaks the rules in the quality profile, but they are never picked up. The UI always displays this:
thanks for your answer. Can you please go to “Administration” then “Background Tasks” of your project, and give me a task id of your “failing” pull request ? (with the subsequent date/time)
I work with Jack and I’ve managed to get a step further with this analysis. It now recognises that there’s some code in the PR and flags the issues. To fix it I copied the entire folder into the docker build image instead of just copying the source and test folders (although Jack was correct, we were already copying the .git folder).
I don’t know why the PR decoration isn’t working though. I’ve created a new PAT to double check that is valid and has the right permissions.
This is the same across more than one of our projects.
Task ID: AXFVaTWEbQ5Zeg8ke7vX or AXFVXxQEavOoMrtIGnhh should be similar.
It’d be great to get quality gates working from within the docker file too.
Hi @Ben_Criniion and thanks for the further insight.
The PAT is needed only for SonarCloud to post comment inside the pull request thread, so it’s not needed at this point in time (as there are currently no issues reported, no comment will be posted).
Can you please send me the log of the Run Code Analysis task, with debug enabled, so i can check indexing of files, etc… I can send to one of you a PM to send me the logs if you need so.
The PR comments are what we’re trying to get working. I did have some issues in that branch but removed them again. We didn’t get any PR comments when there were issues.
I’ve re-introduced some issues and built again. Task ID is AXFY7JfobQ5Zeg8ke9fC
I believe this should add a PR comment about the incorrect implementation of ISerializable on BadException in the file AllocateShipmentController.cs.
I don’t think there should be any secrets in our build script so I’ve put it in a gist. If you download it, let me know and I’ll remove it just incase.
Hi @mickaelcaro, is that log any use? Is there anything else that would be helpful? Perhaps I should start a new thread specifically about PR comments?
I don’t see any error on our internal logs so that’s a bit weird that comments are not posted on your AzDo Pull request.
Do you see the issues you mention in the SonarCloud dashboard at first ? Can you try adding //TODO simple markup to see if this is reported on SC, and then try to see on your AzDo PR if that pops out.