ament / ament/ament_lint

Cannot satisfy both cpplint and uncrustify

オープン
#158 コメント 11 件 リアクション 3 件 担当者 0 名 GitHub で見る
help wanted
主要言語
Python
スター
50
フォーク
129
平均マージ
3日 10時間
マージ済み PR(30日)
3

説明

I've seen one case, where I can't make both pass (maybe, it's just my error).

If you have an `else if`, where the condition have to be split in two lines because it's too long, e.g.:
```cpp
if (...) {
...
} else if ( )
{
...
}
```

`cpplint` shows this failure:
`If an else has a brace on one side, it should have it on both [readability/braces] [5]`

For every other possibility I've tried, `uncrustify` don't pass.
For example:
```cpp
if (...) {
...
} else if ( ) {
...
}
```
```cpp
if (...) {
...
}
else if ( )
{
...
}
```

The only way of working it around, is putting the `if` clause nested in the `else`. But that's only acceptable for one `else if`, not for multiple.
e.g.:
```cpp
if (...) {
...
} else {
if ( )
{
...
}
}
```

----

Triggered by https://github.com/ros2/rclcpp/pull/778#issuecomment-514236125.
I've also used the last workaround somewhere else (I don't remember where).

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。