summaryrefslogtreecommitdiff
path: root/scripts/internal/git_pre_commit.py
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/internal/git_pre_commit.py')
-rwxr-xr-xscripts/internal/git_pre_commit.py10
1 files changed, 4 insertions, 6 deletions
diff --git a/scripts/internal/git_pre_commit.py b/scripts/internal/git_pre_commit.py
index 92bc0f0a..dca17ffb 100755
--- a/scripts/internal/git_pre_commit.py
+++ b/scripts/internal/git_pre_commit.py
@@ -22,6 +22,7 @@ Install this with "make install-git-hooks".
from __future__ import print_function
import os
+import shlex
import subprocess
import sys
@@ -118,24 +119,21 @@ def main():
# Python linters
if py_files:
- # Flake8
+ # flake8
assert os.path.exists('.flake8')
- # XXX: we should escape spaces and possibly other amenities here
cmd = "%s -m flake8 --config=.flake8 %s" % (PYTHON, " ".join(py_files))
- ret = subprocess.call(cmd, shell=True)
+ ret = subprocess.call(shlex.split(cmd))
if ret != 0:
return exit("python code is not flake8 compliant; "
"try running 'make fix-flake8'")
-
# isort
assert os.path.exists('.isort.cfg')
cmd = "%s -m isort --settings=.isort.cfg --check-only %s" % (
PYTHON, " ".join(py_files))
- ret = subprocess.call(cmd, shell=True)
+ ret = subprocess.call(shlex.split(cmd))
if ret != 0:
return exit("python code is not flake8 compliant; "
"try running 'make fix-imports'")
-
# C linter
if c_files:
# XXX: we should escape spaces and possibly other amenities here