[clang-tidy] Add check to flag use of early `return` or `continue` (readability-guard-clause)
Open
check-request
clang-tidy
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
Code like this:
```cpp
void foo() {
// some processing
if (cond) {
// a lot of code
}
}
```
can be transformed to:
```cpp
void foo() {
// some processing
if (!cond)
return
// a lot of code
}
```
And code like this:
```cpp
while (...) {
if (cond) {
// a lot of code
}
}
```
can be transformed to:
```cpp
while (...) { // could be 'for' too
if (!cond)
continue
// a lot of code
}
```
Contributor guide
Assessment
This issue has not been assessed yet.