Skip to content

Commit

Permalink
Merge pull request #16651 from hashicorp/td-semgrep-check-extraneous-…
Browse files Browse the repository at this point in the history
…flattenList-rule

semgrep: add rule to enforce flattenStringSet when converting list of strings to Set
  • Loading branch information
anGie44 authored Jan 11, 2021
2 parents 172d5fe + f3fbd79 commit 40ef37d
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .semgrep.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,17 @@ rules:
pattern: 'd.SetId(*$VALUE)'
severity: WARNING

- id: helper-schema-Set-extraneous-NewSet-with-flattenStringList
languages: [go]
message: Prefer `flattenStringSet()` function for casting a list of string pointers to a set
paths:
include:
- aws/
patterns:
- pattern: schema.NewSet(schema.HashString, flattenStringList($APIOBJECT))
- pattern-not-inside: func flattenStringSet(list []*string) *schema.Set { ... }
severity: WARNING

- id: helper-schema-ResourceData-GetOk-with-extraneous-conditional
languages: [go]
message: Zero value conditional check after `d.GetOk()` is extraneous
Expand Down

0 comments on commit 40ef37d

Please sign in to comment.