mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-29 20:54:22 +01:00
Lint python commit script to satisfy PEP8 (#893)
This commit is contained in:
1 file changed
+8
-3
@@ -1,13 +1,18 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import os,sys
|
"""Helper script to be used as a pre-commit hook."""
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
|
|
||||||
def gitleaksEnabled():
|
def gitleaksEnabled():
|
||||||
|
"""Determine if the pre-commit hook for gitleaks is enabled."""
|
||||||
out = subprocess.getoutput("git config --bool hooks.gitleaks")
|
out = subprocess.getoutput("git config --bool hooks.gitleaks")
|
||||||
if out == "false":
|
if out == "false":
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
if gitleaksEnabled():
|
if gitleaksEnabled():
|
||||||
exitCode = os.WEXITSTATUS(os.system('gitleaks protect -v --staged'))
|
exitCode = os.WEXITSTATUS(os.system('gitleaks protect -v --staged'))
|
||||||
if exitCode == 1:
|
if exitCode == 1:
|
||||||
@@ -18,5 +23,5 @@ To disable the gitleaks precommit hook run the following command:
|
|||||||
''')
|
''')
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
else:
|
else:
|
||||||
print('gitleaks precommit disabled (enable with `git config hooks.gitleaks true`)')
|
print('gitleaks precommit disabled\
|
||||||
|
(enable with `git config hooks.gitleaks true`)')
|
||||||
Reference in new issue
Block a user