1
0
mirror of https://github.com/mgechev/revive.git synced 2025-10-30 23:37:49 +02:00

doc: add before/after examples to bool-literal-in-expr description (#1500)

This commit is contained in:
chavacava
2025-08-31 10:25:19 +02:00
committed by GitHub
parent b89a95979b
commit 44e19927c0

View File

@@ -183,6 +183,32 @@ _Configuration_: N/A
_Description_: Using Boolean literals (`true`, `false`) in logic expressions may make the code less readable.
This rule suggests removing Boolean literals from logic expressions.
### Examples
Before (violation):
```go
if attachRequired == true {
// do something
}
if mustReply == false {
// do something
}
```
After (fixed):
```go
if attachRequired {
// do something
}
if !mustReply {
// do something
}
```
_Configuration_: N/A
## call-to-gc