/
useless-eqeq.yaml
31 lines (31 loc) · 1.08 KB
/
useless-eqeq.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
rules:
- id: eqeq-is-bad
patterns:
- pattern-not-inside: assert(...)
- pattern-either:
- pattern: $X == $X
- pattern: $X != $X
- pattern-not: 1 == 1
message:
Detected useless comparison operation `$X == $X` or `$X != $X`. This will always return 'True' or 'False' and therefore
is not necessary. Instead, remove this comparison operation or use another comparison expression that is not deterministic.
languages: [go]
severity: INFO
metadata:
category: correctness
technology:
- go
- id: hardcoded-eq-true-or-false
message:
Detected useless if statement. 'if (True)' and 'if (False)' always result in the same behavior, and therefore is
not necessary in the code. Remove the 'if (False)' expression completely or just the 'if (True)' comparison depending
on which expression is in the code.
languages: [go]
severity: INFO
pattern-either:
- pattern: if (true) { ... }
- pattern: if (false) { ... }
metadata:
category: correctness
technology:
- go