We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5df84de commit 958bf40Copy full SHA for 958bf40
contrib/devtools/lint-python-shebang.sh
@@ -0,0 +1,11 @@
1
+#!/bin/bash
2
+# Shebang must use python3 (not python or python2)
3
+EXIT_CODE=0
4
+for PYTHON_FILE in $(git ls-files -- "*.py"); do
5
+ if [[ $(head -c 2 "${PYTHON_FILE}") == "#!" &&
6
+ $(head -n 1 "${PYTHON_FILE}") != "#!/usr/bin/env python3" ]]; then
7
+ echo "Missing shebang \"#!/usr/bin/env python3\" in ${PYTHON_FILE} (do not use python or python2)"
8
+ EXIT_CODE=1
9
+ fi
10
+done
11
+exit ${EXIT_CODE}
0 commit comments