When a PR is raised we are getting several quality gate issues as bellow.
“This file no longer exists in the latest pull request changes. It may have been moved or deleted”
/home/vsts/work/1/s/src/{ourApiProjectNameHere}/wwwroot/spa-page.html
These files are not as part of the PR and its not in source branch either.
This issue started happening suddenly.
CI CD used - Azure pipelines
SCM - Azure Devops
“Prepare Analysis Configuration” - Pipeline task is used to configure sonar parameters.
Any help how to avoid these files appearing in the PR?
Also, can you share your full analysis logs, please?
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.
Issue exactly started when we changed our azure pipeline agent from windows-2022 into ubuntu-latest.
I have added 3 log files for each of the pipeline tasks.
Specifically, I’m trying to figure out where the error is. Were the files changed in the PR, but SonarCloud analysis somehow mangled the paths? Or did analysis misunderstand what files were changed in the PR?
Only the wwwroot folder exists in the source code and no files in that folder.
And we have not modified any of those files inside wwwroot folder and actually its a empty folder.
But i am not sure during “build” whether any files get added to this folder.
Along with the other modified files, these few files getting displayed in the PR with those errors.
So the files do exist in the workspace during analysis, right?
And since they’re generated during the build, they would have new timestamps, which is probably related to why they’re picked up as being in the PR.
I see from your log that you’re using the Scanner for .NET, which I believe is supposed to ignore generated files, but I’m not finding that in the docs.
I’m not sure where else to go from here, so I’m going to flag this for more expert eyes.
Yes we have set sonar.exclusions parameter in our prepare analysis pipeline task.
Thank you for spending time on this. I hope if someone can provide a solution for this.
I think we have come closer to the issue, the fix will be included in the next release of the C# analyzer. The issue is coming from the analyzer not being loaded at the correct step during the analysis.
In the meantime, you can use the sonar.plugins.loadAll=true option. This will ensure the C# analyzer is loaded at the right step to detect the generated files and exclude them from the analysis.
If you are using the Azure DevOps extension, add this option in the SonarCloudPrepare task: