mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-04-02 02:56:52 +00:00
add tests, test sample files and minor refactor of exit codes in actual hook in order to facilitate testing
This commit is contained in:
parent
88725503c4
commit
02e8bdc9d8
6 changed files with 66 additions and 2 deletions
|
|
@ -3,6 +3,7 @@ from __future__ import unicode_literals
|
|||
|
||||
import argparse
|
||||
import os
|
||||
|
||||
from six.moves import configparser
|
||||
|
||||
|
||||
|
|
@ -12,7 +13,7 @@ def get_your_keys(credentials_file):
|
|||
"""
|
||||
aws_credentials_file_path = os.path.expanduser(credentials_file)
|
||||
if not os.path.exists(aws_credentials_file_path):
|
||||
exit(2)
|
||||
return None
|
||||
|
||||
parser = configparser.ConfigParser()
|
||||
parser.read(aws_credentials_file_path)
|
||||
|
|
@ -37,13 +38,15 @@ def main(argv=None):
|
|||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('filenames', nargs='*', help='Filenames to run')
|
||||
parser.add_argument(
|
||||
"--credentials-file",
|
||||
"--credentials-file",
|
||||
default='~/.aws/credentials',
|
||||
help="location of aws credentials file from which to get the secret "
|
||||
"keys we're looking for",
|
||||
)
|
||||
args = parser.parse_args(argv)
|
||||
keys = get_your_keys(args.credentials_file)
|
||||
if not keys:
|
||||
return 2
|
||||
|
||||
retv = 0
|
||||
for filename in args.filenames:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue