I run Sonar code analyses with the following setup:
Java source code
While code analyses on PR work fine in most cases, we do experience issues when Duplicated Blocks on New Code are introduced.
According to our Quality Profile there should be an issue with Major severity and the quality gate check should fail, when duplicated block on new code is detected.
The ignored rule on PR analysis is:
Source files should not have any duplicated blocks
During PR analyses, Duplicated Blocks on New Code are detected and those code blocks are marked grey, the Percents of Duplicated Code are increased as well, but the issue is not recognised as Major, and as a result the Quality Gate is successful.
When the PR code is merged into the main branch, new Major issues (Duplicated Blocks on New Code) are registered and the Quality Gate fails as expected.
Could you please help to understand this different behaviour?