dice-group / dice-group/tentris-cpp-coding-guidelines

Possible unintented formatting styles

Open
#11 4 comments 0 reactions 1 assignee Claimed by @mcb5637 View on GitHub
Dominant language
No language data
Stars
0
Forks
0
PR merge metrics
No merged PRs in 30d

Description

I have compiled a list of formatting styles that we might not want to follow.

A:
```
template
concept DummyConcept
= Dummy1
&& Dummy1
&& Expr1 == Expr2
&& Expr3 == Expr4

is formatted to a single line
```

@bigerl: this can probably be prevented with an `//` at the end of each line. Is it still wrapped if lines get too long?

B:
```
static_assert(Expr1
&& Expr 2)

is formatted to a single line
```

@bigerl: same as A

C:
```
template requires Dummy1 or Dummy2

is formatted to multiple lines. I do not think that it is an issue, but I wanted to double check if it intended
```

@bigerl: how does it look then?

D:
```
std::variant data;

`data` is pushed to a new line.
```

@bigerl: I think that should not happen.

E:
```
{ T::func(arg1, arg2) } -> Type;

in concepts, such definitions are formatted to multiple lines (example below)
{
T::func(arg1, arg2)
} -> Type;
```

@bigerl: I think that should not happen but I am afraid that clang-format might not allow us to configure that.

F:
```
if {
...
}
// comment
else {

}

the brace next to `else` is pushed to a new line
```
@bigerl: I would suggest to put the comment to the bracket like: `} else { // comment`

G:
```
auto val = []() -> auto {
...
}();
the parenthesis `()` for calling the lambda are pushed to a new line
```

@bigerl: I think that should not happen

H:
```
DICE_DEFER { tentris_solution_generator_free(q); };

is formatted to multiple lines
```

@bigerl: I think that should not happen but here I am also not sure if we can prevent clang-format to do that.

H:
```
function_call(
"..."
"..."
).another_function_call();

.anothert_function_call is pushed to a new line
```

@bigerl: I think that should not happen.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.