Cannot set indentation size to none for Java indentation consistency code smell rule

  • SonarQube version:: 8.4.1
  • Rule: Source code should be indented consistently
  • Language: Java

There is no way to set the number of spaces for indentation to none for the indentation consistency rule for Java. This leads to the requirement to enforce a number of spaces for indent across the organization where the organization may just want to enforce consistent indentation.

Hi,

Welcome to the community!

As I’m sure you’ve discovered, if you blank-out the rule parameter it just used the default value. Why? Well it needs something to measure consistency with.

Your best bet here is to create inherited profiles and grant Administer on them to representatives of the subsections of the organization. I believe they’ll then be able to tune the rule param to “local” requirements.

 
HTH,
Ann

Hi Ann,

Thank you for the reply.

I get what you are saying here but in our structure we are trying to make the configuration hands-off and centralized for the entire organization.
I have seen in other indentation validators where the indentation consistency will be inferred by either the starting few indented lines or the file in total. This is the functionality I was hoping for.
I see in the general rule (https://jira.sonarsource.com/browse/RSPEC-1120) that this sort of configuration should be supported but it seems like the Java implementation of the rule deviates.

Thanks,
-Mike