mirror of
https://github.com/sourcegraph/sourcegraph.git
synced 2026-02-06 14:51:44 +00:00
@chrsmith suggested this idea, which I like very much as well. Pretty straightforward: - if you're adding something you really don't want to commit and suspect your future self to forget about it, you can add `FORBIDCOMMIT` anywhere in your changes, and precommit will prevent you from accidentally committing it. - check is case insensitive. I went for this instead of `NOCOMMIT` because it could be legitimately be used for a var with the number of commits for example. And that's not really something we want to add a pragma to disable the string itself for either. ## Test plan 
50 lines
1.5 KiB
YAML
50 lines
1.5 KiB
YAML
exclude: (^.*\.snap$)|(^internal/database/.*\.json)|(^internal/database/.*\.md)|(^migrations/[^/]+/squashed\.sql)
|
|
repos:
|
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
rev: v2.3.0
|
|
hooks:
|
|
- id: check-yaml
|
|
exclude: 'pnpm-lock.yaml'
|
|
- id: end-of-file-fixer
|
|
- id: trailing-whitespace
|
|
- repo: https://github.com/keith/pre-commit-buildifier
|
|
rev: 5.0.1
|
|
hooks:
|
|
- id: buildifier
|
|
- id: buildifier-lint
|
|
- repo: local
|
|
hooks:
|
|
- id: check-tokens
|
|
name: check-tokens
|
|
description: 'Check for common tokens being committed'
|
|
entry: ./dev/check-tokens.sh
|
|
language: script
|
|
'types': [text]
|
|
args: []
|
|
require_serial: false
|
|
- id: shellcheck
|
|
name: shellcheck
|
|
description: 'Run shellcheck'
|
|
entry: ./dev/check/shellcheck.sh
|
|
language: script
|
|
# TODO: adapt shellcheck.sh to only operate on passed-in files,
|
|
# and fallback to git ls-files when empty
|
|
pass_filenames: false
|
|
files: '.*\.(sh|bash)'
|
|
stages: [pre-push]
|
|
- id: shfmt
|
|
name: shfmt
|
|
description: 'Run shfmt'
|
|
entry: ./dev/check/shfmt.sh
|
|
language: script
|
|
# TODO: adapt shfmt.sh to only operate on passed-in files,
|
|
# and fallback to git ls-files when empty
|
|
pass_filenames: false
|
|
files: '.*\.(sh|bash)'
|
|
stages: [pre-push]
|
|
- id: forbidcommit
|
|
name: forbidcommit
|
|
description: 'Prevent commits with a FORBIDCOMMIT string in the diff'
|
|
entry: ./dev/forbidcommit.sh
|
|
language: script
|