Hi, I checked the given rule, and it looks like it is not enabled by default. Were you connected to the server when running the first analysis? When a project is connected to SonarQube or SonarCloud, configuration from the server applies.
If all the conditions are met(The project is correctly bound and a couple of minutes have passed for sync to happen with the quality profile after the change was made in the server) this should not happen
Could you duplicate the issue like this while being not connected and make sure there are no issues appearing for that rule:
public boolean isMonday(org.example.Weekday weekDay) {
weekDay.equals(org.example.Weekday.MONDAY);
return weekDay.equals(org.example.Weekday.MONDAY);
}
Then, could you connect to SonarQube and check without doing another analysis scan on the server that 2 issues will appear for this rule(1 that was found from the previous server analysis and the new one found by non-server analysis)?
Tried this … when disconnected nothing showed up as expected.
After connecting to SonarQube and waiting a few seconds, an issue for missing copyright header showed up as expected but not the issue for the enum ==
Repeated this in VS Code and confirmed the same behaviour.
Then I did a full scan analysis and the == issue appeared in both IntelliJ and VS Code after they got a notification that the quality gate stays had changed.
b4fullscan.txt (185.3 KB) contains logs for running SonarLint unconnected and then connected when copyright rule issue shows up but notate enum== rule issues see screenshot
I have confirmed that I can reproduce this behaviour using a quality profile that extends the Sonar Way profile and just adds the one additional enum== rule
[2024-10-24T12:00:26.027] [sonarlint-analysis-engine] WARN org.sonar.java.SonarComponents - Unresolved imports/types have been detected during analysis. Enable DEBUG mode to see them.
[2024-10-24T12:00:26.027] [sonarlint-analysis-engine] DEBUG org.sonar.java.SonarComponents - Unresolved imports/types:
- WeekDay cannot be resolved to a type
[2024-10-24T12:00:26.027] [sonarlint-analysis-engine] WARN org.sonar.java.SonarComponents - Use of preview features have been detected during analysis. Enable DEBUG mode to see them.
[2024-10-24T12:00:26.027] [sonarlint-analysis-engine] DEBUG org.sonar.java.SonarComponents - Use of preview features:
- WeekDay cannot be resolved to a variable
The Sonar Java analyzer could not find the WeekDay type. This could be because our analyzer relies on Bytecode for more accurate analysis. Could you try building the project and re-analyzing the project once more? This should likely fix the issue.