pisa-engine/pisa

Update clang-format rules

elshize opened this issue · 2 comments

First, let's update the version of clang-format we use in CI -- the current one is 9, which is quite old by now. Since then, some options have actually been changed such that upgrading changes the formatting slightly.

So while we're doing that, I suggest updating our AlignAfterOpenBracket option to BlockIndent, which will change this:

auto long_function_with_many_arguments(
    arg1, arg2, arg3)

to this:

auto long_function_with_many_arguments(
    arg1, arg2, arg3
) -> very_long<return_type<with_templates>>

This will also affect function calls (among other things) and make scope delineation clearer.

(more info https://clang.llvm.org/docs/ClangFormatStyleOptions.html#alignafteropenbracket)

Once that is is done, I also suggest to update our brace wrapping after functions to false, since now we have that closing parenthesis.

Both of those changes will make our functions to format very similarly to Rust standard format:

auto long_function_with_many_arguments(
    arg1, arg2, arg3
) -> very_long<return_type<with_templates>> {
    return arg1 + arg2 + arg3;
}

auto short_func() {
    return "hello, world";
}

@amallia @JMMackenzie Please let me know your thoughts.

Looks like rust, sounds good to me!