Skip to content

Instantly share code, notes, and snippets.

@RoseSecurity
Created March 22, 2024 14:40
Show Gist options
  • Save RoseSecurity/51fde2d0a698203d71dfa7eb380e4569 to your computer and use it in GitHub Desktop.
Save RoseSecurity/51fde2d0a698203d71dfa7eb380e4569 to your computer and use it in GitHub Desktop.
Validate JSON, clean up markdown, eliminate trailing whitespace, detect secrets, and format Terraform with this Pre-Commit hook!
repos:
# pre-commit install --hook-type pre-push
- repo: https://github.com/pre-commit/pre-commit-hooks # Generic review/format
rev: v4.4.0
hooks:
- id: check-json
- id: detect-private-key
- id: end-of-file-fixer
- id: no-commit-to-branch
args: ["--branch", "master"]
- id: trailing-whitespace
- repo: https://github.com/pre-commit/mirrors-prettier/ # Generic review/format
rev: v3.0.0-alpha.6
hooks:
- id: prettier
- repo: https://github.com/igorshubovych/markdownlint-cli # Format markdown
rev: v0.32.2
hooks:
- id: markdownlint
args: ["--fix", "--disable", "MD036"]
- repo: https://github.com/antonbabenko/pre-commit-terraform
rev: v1.77.1 # Get the latest from: https://github.com/antonbabenko/pre-commit-terraform/releases
hooks:
- id: terraform_fmt
- id: terraform_tflint
- id: terraform_docs
- repo: local
hooks:
- id: trufflehog
name: TruffleHog
description: Detect secrets in your data.
entry: bash -c 'trufflehog git file://. --since-commit HEAD --only-verified --fail'
language: system
stages: ["commit", "push"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment