forked from flexkube/libflexkube
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.semgrep.yml
43 lines (43 loc) · 1.48 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
rules:
- id: bad-error-wrap-wording
patterns:
- pattern-regex: fmt\.Errorf\(".?([Ff]ailed|[]Uu]nable|[Cc]ould|([Ee]rror))
message: Word "fail", "failed", "unable", "could not" should not be used when wrapping errors. Use verb in continuous form instead!
languages: [go]
severity: ERROR
- id: printed-messages-must-be-captialized
patterns:
- pattern-regex: (fmt.Print(ln|f)|\bt\.(Error|Fatal|Log)(|f))\("[a-z]
message: Printed messages must be capitalized.
languages: [go]
severity: ERROR
- id: strings-must-be-quoted-using-q
patterns:
- pattern-regex: "'%s'"
message: When formatting, strings must be quoted using %q instead of e.g. '%s'.
languages: [go]
severity: ERROR
- id: error-wrapping-must-be-preceded-by-space
patterns:
- pattern-regex: '[^ ]%w'
message: When wrapping errors, %w must be preceded by space.
languages: [go]
severity: ERROR
- id: files-must-not-have-trailing-whitespace
patterns:
- pattern-regex: '[[:blank:]]$'
message: Files must not have any trailing whitespace.
languages: [generic]
severity: ERROR
- id: files-must-not-have-trailing-newlines
patterns:
- pattern-regex: '\n\n\Z'
message: Files must not have any trailing newlines.
languages: [generic]
severity: ERROR
- id: all-lines-must-end-with-newline
patterns:
- pattern-regex: '\S\z'
message: All lines must end with newline.
languages: [generic]
severity: ERROR