From 35f2ea5da2934ccce2ffb3b5e0c09b67e4bb78d6 Mon Sep 17 00:00:00 2001 From: Alex <52292902+alexrudd2@users.noreply.github.com> Date: Tue, 21 Jun 2022 06:55:43 -0500 Subject: [PATCH] Lint python commit script to satisfy PEP8 (#893) --- scripts/pre-commit.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/scripts/pre-commit.py b/scripts/pre-commit.py index 87c30bae..64d48d59 100644 --- a/scripts/pre-commit.py +++ b/scripts/pre-commit.py @@ -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`)')