File tree 1 file changed +4
-49
lines changed
1 file changed +4
-49
lines changed Original file line number Diff line number Diff line change 1
1
#! /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.
9
4
10
5
exec 1>&2
11
6
@@ -14,48 +9,8 @@ RED='\033[0;31m'
14
9
YELLOW=' \033[0;33m'
15
10
NOCOLOR=' \033[0m'
16
11
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"
19
13
printf " pip install pre-commit\n"
20
14
printf " pre-commit install${NOCOLOR} \n"
21
15
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
You can’t perform that action at this time.
0 commit comments