示例#1
0
    def test_args_have_correct_positional_added_modified_and_deleted(self, pos, added, modified, deleted):
        sys.argv = ['foo'] + pos + ['--added-files'] + added + ['--modified-files'] + modified + ['--deleted-files'] + deleted

        args = pre_commit()

        self.assertListEqual(pos, args.files)
        self.assertListEqual(added, args.added)
        self.assertListEqual(modified, args.modified)
        self.assertListEqual(deleted, args.deleted)
示例#2
0
#!/usr/bin/env python

import subprocess
import sys
import re

from githooks import args

files = [f for f in args.pre_commit().files if re.match('.*\.py$', f)]

if files:
    sys.exit(subprocess.call(['mypy'] + files))
示例#3
0
#!/usr/bin/env python

from __future__ import print_function

from githooks import args

files = args.pre_commit()

print('\nFiles:', *files.files, sep='\n')
print('\nModified:', *files.modified, sep='\n')
print('\nAdded:', *files.added, sep='\n')
print('\nDeleted:', *files.deleted, sep='\n')