summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimeon Simeonov2018-09-13 12:47:54 +0200
committerSimeon Simeonov2018-09-13 12:47:54 +0200
commitc0259c87a7a2343a21634e038a50ff549bc975e5 (patch)
treeca79b7780b55719d9ab529f428047de2df063c8e
Initial commit
-rwxr-xr-xpygitchecker.py38
1 files changed, 38 insertions, 0 deletions
diff --git a/pygitchecker.py b/pygitchecker.py
new file mode 100755
index 0000000..29c9167
--- /dev/null
+++ b/pygitchecker.py
@@ -0,0 +1,38 @@
1#!/usr/bin/env python3
2
3import argparse
4import sys
5
6import gitapi
7import pep8
8
9
10if __name__ == '__main__':
11 parser = argparse.ArgumentParser(
12 description='The following options are available')
13 parser.add_argument(
14 'repo_path',
15 metavar='REPO',
16 default='.',
17 type=str,
18 help='Git repo path (default: cwd)')
19 parser.add_argument(
20 '--disable-pep8-checks',
21 action='store_true',
22 dest='disable_pep8',
23 default=False,
24 help='Disable pep8 checks')
25 args = parser.parse_args()
26 git_repo = gitapi.Repo(args.repo_path)
27 status = git_repo.git_status()
28 if 'M' not in status:
29 print('No modifications')
30 sys.exit(0)
31 remarks = False
32 for mfile in status.get('M'):
33 if not args.disable_pep8:
34 checker = pep8.Checker(mfile)
35 if checker.check_all():
36 remarks = True
37 if remarks:
38 print('Done!')