removing blank lines before 'else'

I have a colleague who likes to add blank lines before the else in an if-else statement, against rules. 

    if (a == 2)

    else if (a == 4)
        a = res1;

How can I set resharper to remove that blank line? I don't want to manually go regex'ing to remove them.

1 comment


R# built-in formatter can't do that currently. There's the “Keep max blank lines in code” setting but it affects all blank lines. I've filed You can switch to clang-format, but I don't think it can do that as well.

Thanks for the feedback!


Please sign in to leave a comment.