Skip to content

Instantly share code, notes, and snippets.

@invidian
Created May 4, 2022 12:27
Show Gist options
  • Save invidian/bf8db8741a28a60aa95f9953adf9641b to your computer and use it in GitHub Desktop.
Save invidian/bf8db8741a28a60aa95f9953adf9641b to your computer and use it in GitHub Desktop.
Semgrep file whitespace rules
rules:
- 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment