mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-04-05 19:46:54 +00:00
Merge 582c917016 into 219c70a9c1
This commit is contained in:
commit
d722548fa0
1 changed files with 6 additions and 4 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
BLACKLIST = [
|
BLACKLIST = [
|
||||||
|
|
@ -22,10 +23,11 @@ def detect_private_key(argv=None):
|
||||||
private_key_files = []
|
private_key_files = []
|
||||||
|
|
||||||
for filename in args.filenames:
|
for filename in args.filenames:
|
||||||
with open(filename, 'rb') as f:
|
if os.path.isfile(filename):
|
||||||
content = f.read()
|
with open(filename, 'rb') as f:
|
||||||
if any(line in content for line in BLACKLIST):
|
content = f.read()
|
||||||
private_key_files.append(filename)
|
if any(line in content for line in BLACKLIST):
|
||||||
|
private_key_files.append(filename)
|
||||||
|
|
||||||
if private_key_files:
|
if private_key_files:
|
||||||
for private_key_file in private_key_files:
|
for private_key_file in private_key_files:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue