Skip to content

Commit 6377bb6

Browse files
committed
semgrep: add rule for RetryConfigContext
1 parent deeb917 commit 6377bb6

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

.semgrep.yml

+17-1
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ rules:
410410

411411
- id: helper-schema-TimeoutError-check-doesnt-return-output
412412
languages: [go]
413-
message: If the resource.Retry() or resource.RetryContext() function returns a value, ensure the isResourceTimeoutError() check does as well
413+
message: If the resource.Retry(), resource.RetryContext(), or tfresource.RetryConfigContext() function returns a value, ensure the isResourceTimeoutError() check does as well
414414
paths:
415415
exclude:
416416
- "*_test.go"
@@ -439,6 +439,14 @@ rules:
439439
})
440440
...
441441
if isResourceTimeoutError($ERR) { ... }
442+
- pattern-not-inside: |
443+
$ERR = tfresource.RetryConfigContext(..., func() *resource.RetryError {
444+
...
445+
_, $ERR2 = $CONN.$FUNC(...)
446+
...
447+
})
448+
...
449+
if tfresource.TimedOut($ERR) { ... }
442450
- patterns:
443451
- pattern: |
444452
if tfresource.TimedOut($ERR) {
@@ -460,6 +468,14 @@ rules:
460468
})
461469
...
462470
if tfresource.TimedOut($ERR) { ... }
471+
- pattern-not-inside: |
472+
$ERR = tfresource.RetryConfigContext(..., func() *resource.RetryError {
473+
...
474+
_, $ERR2 = $CONN.$FUNC(...)
475+
...
476+
})
477+
...
478+
if tfresource.TimedOut($ERR) { ... }
463479
severity: WARNING
464480

465481
- id: is-not-found-error

0 commit comments

Comments
 (0)