Skip to content

Commit

Permalink
Lint python commit script to satisfy PEP8 (#893)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexrudd2 committed Jun 21, 2022
1 parent 7002807 commit 35f2ea5
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions scripts/pre-commit.py
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -18,5 +23,5 @@ def gitleaksEnabled():
''')
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`)')

0 comments on commit 35f2ea5

Please sign in to comment.