Commented code rule

Hi everyone,

I have problem with commented code rule,

I’m sure in another versions of Quality Profiles, exists a rule for lines of code commented. But in my current versión of SonarCloud. I only have “Sections of code should not be commented out”, so when I have line commented, Sonar don’t detected (the rule works in sections or blocks, but the “problem” is in the logic lines of code commented).

Thanks and greetings!

Hey there.

Can you share a sample of code where a single line is commented out and not detected? The rule is not precious about the number of lines (and a single line counts as a “section”) :slight_smile:

Hi Colin, thanks for your answer.

For example:

public static boolean validToken(string idNumber) {
   String idToken = Util.getTokenById(idNumber);
   if(idToken != null) { // || idToken != "") {
   return idToken;

I this days I checked the issues is detected, sometimes, in code like:

String error = Util.convertToJson(ex.getStatusText(), Example.class) // gson.FromJson(ex.getStatus(), Error.class)