Skip to content

Commit 44e1992

Browse files
authored
doc: add before/after examples to bool-literal-in-expr description (#1500)
1 parent b89a959 commit 44e1992

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

RULES_DESCRIPTIONS.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,32 @@ _Configuration_: N/A
183183
_Description_: Using Boolean literals (`true`, `false`) in logic expressions may make the code less readable.
184184
This rule suggests removing Boolean literals from logic expressions.
185185

186+
### Examples
187+
188+
Before (violation):
189+
190+
```go
191+
if attachRequired == true {
192+
// do something
193+
}
194+
195+
if mustReply == false {
196+
// do something
197+
}
198+
```
199+
200+
After (fixed):
201+
202+
```go
203+
if attachRequired {
204+
// do something
205+
}
206+
207+
if !mustReply {
208+
// do something
209+
}
210+
```
211+
186212
_Configuration_: N/A
187213

188214
## call-to-gc

0 commit comments

Comments
 (0)