potential workaround
The code above should prode a couple of errors. First there is an if without braces and then there is a commented line. However I get 0 errors. Why is that?
There are two reasons why you don’t see the issues you expected to see:
Not all rules are enabled by default. For instance, the one about braces is not (this is stylistic, and many people don’t want to follow this style). You can enable a rule (and see what is enabled) by going to Settings > Tools > SonarLint > Rules.
Please note also that if you work in connected mode, the list of active rules will be synchronized between SonarLint and SonarQube/SonarCloud.
For the commented code, there is another issue. It’s very difficult to decide is a comment is just a comment or is commented code. We need to rely on heuristics, and it can never be perfect. The code you currently have is not going to be considered as commented code. The same with a semicolon at the end would be.