Add a check for missing files befor commit
This commit is contained in:
parent
7dd6412e59
commit
52370e3c09
@ -14,14 +14,21 @@ repos:
|
|||||||
- id: trailing-whitespace
|
- id: trailing-whitespace
|
||||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||||
# Ruff version.
|
# Ruff version.
|
||||||
rev: v0.9.9
|
rev: v0.11.8
|
||||||
hooks:
|
hooks:
|
||||||
# Run the linter.
|
# Run the linter.
|
||||||
- id: ruff
|
- id: ruff
|
||||||
types_or: [ python, pyi ]
|
types_or: [ python, pyi ]
|
||||||
args: [ --fix ]
|
args: [ --fix ]
|
||||||
- repo: https://github.com/Riverside-Healthcare/djLint
|
- repo: https://github.com/Riverside-Healthcare/djLint
|
||||||
rev: v1.32.0
|
rev: v1.36.4
|
||||||
hooks:
|
hooks:
|
||||||
- id: djlint-reformat-django
|
- id: djlint-reformat-django
|
||||||
- id: djlint-django
|
- id: djlint-django
|
||||||
|
- repo: local
|
||||||
|
hooks:
|
||||||
|
- id: check-untracked
|
||||||
|
name: "Check untracked and unignored files"
|
||||||
|
entry: ./scripts/check-untracked.sh
|
||||||
|
language: script
|
||||||
|
always_run: true
|
||||||
|
9
scripts/check-untracked.sh
Executable file
9
scripts/check-untracked.sh
Executable file
@ -0,0 +1,9 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
untracked=$(git ls-files --others --exclude-standard)
|
||||||
|
|
||||||
|
if [ -n "$untracked" ]; then
|
||||||
|
echo "Error: The following files are untracked and not ignored:"
|
||||||
|
echo "$untracked"
|
||||||
|
echo "Please add them to Git or ignore them in .gitignore before committing."
|
||||||
|
exit 1
|
||||||
|
fi
|
Loading…
x
Reference in New Issue
Block a user