Jelajahi Sumber

Lint python commit script to satisfy PEP8 (#893)

Alex 3 tahun lalu
induk
melakukan
35f2ea5da2
1 mengubah file dengan 8 tambahan dan 3 penghapusan
  1. 8 3
      scripts/pre-commit.py

+ 8 - 3
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`)')