Skip to content

Commit a75fa53

Browse files
committed
Closes #18348: Disable legacy pre-commit hook script
1 parent e75d327 commit a75fa53

File tree

1 file changed

+4
-49
lines changed

1 file changed

+4
-49
lines changed

scripts/git-hooks/pre-commit

+4-49
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
#!/bin/sh
2-
# Create a link to this file at .git/hooks/pre-commit to
3-
# force PEP8 validation prior to committing
4-
#
5-
# Ignored violations:
6-
#
7-
# W504: Line break after binary operator
8-
# E501: Line too long
2+
# TODO: Remove this file in NetBox v4.3
3+
# This script has been maintained to ease transition to the pre-commit tool.
94

105
exec 1>&2
116

@@ -14,48 +9,8 @@ RED='\033[0;31m'
149
YELLOW='\033[0;33m'
1510
NOCOLOR='\033[0m'
1611

17-
printf "${YELLOW}This script is obsolete and will be removed in a future release.\n"
18-
printf "Please use pre-commit instead:\n"
12+
printf "${YELLOW}The pre-commit hook script is obsolete. Please use pre-commit instead:${NOCOLOR}\n"
1913
printf " pip install pre-commit\n"
2014
printf " pre-commit install${NOCOLOR}\n"
2115

22-
if [ -d ./venv/ ]; then
23-
VENV="$PWD/venv"
24-
if [ -e $VENV/bin/python ]; then
25-
PATH=$VENV/bin:$PATH
26-
elif [ -e $VENV/Scripts/python.exe ]; then
27-
PATH=$VENV/Scripts:$PATH
28-
fi
29-
fi
30-
31-
if [ ${NOVALIDATE} ]; then
32-
echo "${YELLOW}Skipping validation checks${NOCOLOR}"
33-
exit $EXIT
34-
fi
35-
36-
echo "Linting with ruff..."
37-
ruff check netbox/
38-
if [ $? != 0 ]; then
39-
EXIT=1
40-
fi
41-
42-
echo "Checking for missing migrations..."
43-
python netbox/manage.py makemigrations --dry-run --check
44-
if [ $? != 0 ]; then
45-
EXIT=1
46-
fi
47-
48-
git diff --cached --name-only | if grep --quiet 'netbox/project-static/'
49-
then
50-
echo "Checking UI ESLint, TypeScript, and Prettier compliance..."
51-
yarn --cwd "$PWD/netbox/project-static" validate
52-
if [ $? != 0 ]; then
53-
EXIT=1
54-
fi
55-
fi
56-
57-
if [ $EXIT != 0 ]; then
58-
printf "${RED}COMMIT FAILED${NOCOLOR}\n"
59-
fi
60-
61-
exit $EXIT
16+
exit 1

0 commit comments

Comments
 (0)