There is indeed an issue with this rule. However, it seems to be related to how SonarQube for IDE (Sonar Lint) analyses files. When you open a file, it only analyzes the opened file. As this rule requires multiple files to be analysed, the rule does not behave correctly.
On my side, the rule worked correctly when using the “Analyze All Project Files” feature in the SonarQube for IDE console in the IDE.
Does it work incorrectly when analyzing the whole project on your side?