/
githubmirror
/
gitleaks
ΠΠ±Π·ΠΎΡ
ΠΠΎΠΊΡΠΌΠ΅Π½ΡΠ°ΡΠΈΡ
ΠΠΎΠΉΡΠΈ
/
githubmirror
/
gitleaks
ΠΠΎΠ΄
ΠΠ°Π΄Π°ΡΠΈ
ΠΠΈΠΊΠΈ
ΠΠ°ΠΊΠ΅ΡΡ
0
Π Π΅Π»ΠΈΠ·Ρ
0
ΠΠ½Π°Π»ΠΈΡΠΈΠΊΠ°
ΠΠ΅Π·ΠΎΠΏΠ°ΡΠ½ΠΎΡΡΡ
v8.19.3
scripts/pre-commit.py
27 ΡΡΡΠΎΠΊ
769 B
Alex
Lint python commit script to satisfy PEP8 (#893)
21 ΠΈΡΠ½ 2022, 14:55
ΠΠ΅ Π²Π΅ΡΠΈΡΠΈΡΠΈΡΠΎΠ²Π°Π½
21 ΠΈΡΠ½ 2022, 14:55
35f2ea5
ΠΠΎΠ΄
ΠΠ²ΡΠΎΡΡΡΠ²ΠΎ
Π ΡΡΠΌ ΠΊΠΎΠ΄?
#!/usr/bin/env python3 """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: print('''Warning: gitleaks has detected sensitive information in your changes. To disable the gitleaks precommit hook run the following command: git config hooks.gitleaks false ''') sys.exit(1) else: print('gitleaks precommit disabled\ (enable with `git config hooks.gitleaks true`)')