Bugs are not reported when analyze PRs from one repo

We are analyzing about to 35 Java (maven) projects from AWS CodeCommit repositories.
All projects use same custom Quality Gate (change accepted metrics) and same custom Quality Profile (disable some rules we dont want to report smells).

Recently we implemented Sonar analysis for PR to analyze code to be merged before merge and then fix smells and bugs reported and avoid later technical debt on main branch.

Now we are adding Sonar Quality Gate as comment inside PR on Code Commit to log for each commit the analysis status.

All repos run the same command
mvn clean install org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.host.url=https://sonarcloud.io -Dsonar.organization={org} -Dsonar.project={project} -Dsonar.token={token} -Dsonar.qualitygate.wait=true -Dsonar.pullrequest.key={pr_id} -Dsonar.pullrequest.branch={pr_branch}

Then we introduce some bugs expecting quality gate failed. We modify code on 2 repos, in one of them bug is not reported (code smells are reported normally) and same bugs on other repo are reported correctly. Both projects have same configuration inside pom.xml.

Inside SonarCloud, at organization level or project level, any config show something to fix.


Welcome to the community!

Can you provide some more detail on the issues that weren’t raised?


For example rule java:S3655 should be reported if access get method from an Optional object without validate with isPresent before.
In 2 different repos we introduce some code without validate to get quality gate failed, but only in one repo we get error, on another repo we have quality gate ok.


Could you provide the code snippets (or screenshots) where an issue was/was not raised?