2016-09-26 23:03:08 +00:00
|
|
|
#!/usr/bin/env python
|
2016-09-29 19:38:23 +00:00
|
|
|
from git_lint import load_config, run_linters, git_base
|
2016-09-26 23:03:08 +00:00
|
|
|
|
2016-09-30 01:36:27 +00:00
|
|
|
import gettext
|
|
|
|
_ = gettext.gettext
|
|
|
|
|
|
|
|
|
2016-09-26 23:03:08 +00:00
|
|
|
def main(*args):
|
2016-09-29 19:38:23 +00:00
|
|
|
if git_base is None:
|
2016-09-26 23:03:08 +00:00
|
|
|
sys.exit(_('A git repository was not found.'))
|
|
|
|
|
2016-09-30 01:36:27 +00:00
|
|
|
pre_commit_options = {
|
2016-09-26 23:03:08 +00:00
|
|
|
'staging': True,
|
2016-09-29 19:38:23 +00:00
|
|
|
'base': True
|
2016-09-26 23:03:08 +00:00
|
|
|
}
|
|
|
|
|
2016-09-30 01:36:27 +00:00
|
|
|
config = load_config(pre_commit_options, git_base)
|
|
|
|
|
|
|
|
(results,
|
|
|
|
unlintable_filenames,
|
|
|
|
cant_lint_filenames,
|
|
|
|
broken_linter_names,
|
|
|
|
unfindable_filenames) = run_linters(options, config)
|
|
|
|
|
|
|
|
print_report(results,
|
|
|
|
unlintable_filenames,
|
|
|
|
cant_lint_filenames,
|
|
|
|
broken_linter_names,
|
|
|
|
unfindable_filenames,
|
|
|
|
options)
|
|
|
|
|
|
|
|
if not len(results):
|
|
|
|
return 0
|
|
|
|
|
|
|
|
return max([i[2] for i in results if len(i)])
|
2016-09-26 23:03:08 +00:00
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
import sys
|
|
|
|
sys.exit(main(*sys.argv))
|