Lint python commit script to satisfy PEP8 (#893)

This commit is contained in:
Alex authored and GitHub committed 2022-06-21 06:55:43 -05:00
1 parent 70028079b4
commit 35f2ea5da2
1 file changed
+8 -3
+8 -3
View File
@@ -1,13 +1,18 @@
#!/usr/bin/env python3
import os,sys
"""Helper script to be used as a pre-commit hook."""
import os
import sys
import subprocess
def gitleaksEnabled():
"""Determine if the pre-commit hook for gitleaks is enabled."""
out = subprocess.getoutput("git config --bool hooks.gitleaks")
if out == "false":
return False
return True
if gitleaksEnabled():
exitCode = os.WEXITSTATUS(os.system('gitleaks protect -v --staged'))
if exitCode == 1:
@@ -18,5 +23,5 @@ To disable the gitleaks precommit hook run the following command:
''')
sys.exit(1)
else:
print('gitleaks precommit disabled (enable with `git config hooks.gitleaks true`)')
print('gitleaks precommit disabled\
(enable with `git config hooks.gitleaks true`)')