Can I allow mixed indentation styles?
My team mixes indentation styles for calling methods. All these styles are accepted:
var myVariable = SomeMethod(
param1
);
var myVariable = SomeMethod(
param1
);
var myVariable = SomeMethod(
param1);
I managed to make the last case not get flagged by solution analysis by turning off incorrect line breaks warnings, which is less than ideal, but ultimately acceptable.
I'm much more hesitant to take the same approach for making both the first and second examples appear clean, since that would require that I turn off warnings for all incorrect indents. It's important to me that I catch issues like method bodies being idented incorrectly, because that could cause confusion regarding blocked code. For example, I would want this code to show a warning, since Statement3() at a quick glance might look like it's part of the conditional block:
if (condition)
{
Statement1();
// ...
Statement2();
}
Statement3();
Is there a way to make the solution analysis more flexible regarding these without turning it off?
Please sign in to leave a comment.
Hello Thomas,
For me the following configuration worked (see the screenshot). Turn on `Around statement braces` checkbox to keep warning in your second case, and turn off `Line should be indented or outdented elsewhere` to get rid of it in the first case.
Hope this helps! Let me know if you have any questions.