forked from hashicorp/terraform-provider-aws
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.semgrep.yml
59 lines (58 loc) · 1.79 KB
/
.semgrep.yml
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
rules:
- id: helper-schema-ResourceData-GetOk-with-extraneous-conditional
languages: [go]
message: Zero value conditional check after `d.GetOk()` is extraneous
paths:
include:
- aws/
patterns:
- pattern-either:
- pattern: if $VALUE, $OK := d.GetOk($KEY); $OK && $VALUE.(bool) { $BODY }
- pattern: if $VALUE, $OK := d.GetOk($KEY); $OK && $VALUE.(int) != 0 { $BODY }
- pattern: if $VALUE, $OK := d.GetOk($KEY); $OK && $VALUE.(int) > 0 { $BODY }
- pattern: if $VALUE, $OK := d.GetOk($KEY); $OK && $VALUE.(string) != "" { $BODY }
- pattern: if $VALUE, $OK := d.GetOk($KEY); $OK && len($VALUE.(string)) > 0 { $BODY }
severity: WARNING
- id: helper-schema-resource-Retry-without-TimeoutError-check
languages: [go]
message: Check resource.Retry() errors with tfresource.TimedOut()
paths:
exclude:
- "*_test.go"
include:
- aws/
patterns:
- pattern-either:
- pattern: |
$ERR := resource.Retry(...)
...
return ...
- pattern: |
$ERR = resource.Retry(...)
...
return ...
- pattern-not: |
$ERR := resource.Retry(...)
...
if isResourceTimeoutError($ERR) { ... }
...
return ...
- pattern-not: |
$ERR = resource.Retry(...)
...
if isResourceTimeoutError($ERR) { ... }
...
return ...
- pattern-not: |
$ERR := resource.Retry(...)
...
if tfresource.TimedOut($ERR) { ... }
...
return ...
- pattern-not: |
$ERR = resource.Retry(...)
...
if tfresource.TimedOut($ERR) { ... }
...
return ...
severity: WARNING