Skip to content

Instantly share code, notes, and snippets.

@deanwilson
Last active June 27, 2024 20:52
Show Gist options
  • Save deanwilson/96003b54b71a6b9803a9e52356029aa8 to your computer and use it in GitHub Desktop.
Save deanwilson/96003b54b71a6b9803a9e52356029aa8 to your computer and use it in GitHub Desktop.
File extension restrictions in pre-commit
repos:
- repo: local
hooks:
- id: restricted-filenames
name: Check commits for unexpected file extensions
entry: These file extensions are unusual and should be checked
language: fail
files: '.*\.(xlsx|doc)'
- id: restricted-file-types
name: Check commits for unexpected file types
entry: These file types are unusual and should be checked
language: fail
types: ['binary']
exclude_types: ['image']
# Don't commit large files
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.4.0 # Use the ref you want to point at
hooks:
- id: check-added-large-files
args: ['--maxkb=20']
- id: check-merge-conflict
- id: no-commit-to-branch
args: [--branch, master] # default but be explicit
- id: detect-aws-credentials
args: [--allow-missing-credentials]
- id: detect-private-key
# Prevent secrets being commited
- repo: [email protected]:Yelp/detect-secrets
rev: v0.13.0
hooks:
- id: detect-secrets
args: ['--baseline', '.secrets.baseline']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment