mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-04-04 19:26:52 +00:00
Remove @entry decorator (and misc cleanup)
This commit is contained in:
parent
9bfa01da81
commit
2f1d2bbe5b
13 changed files with 25 additions and 88 deletions
|
|
@ -4,11 +4,8 @@ import argparse
|
|||
import sys
|
||||
import simplejson
|
||||
|
||||
from pre_commit_hooks.util import entry
|
||||
|
||||
|
||||
@entry
|
||||
def check_json(argv):
|
||||
def check_json(argv=None):
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('filenames', nargs='*', help='JSON filenames to check.')
|
||||
args = parser.parse_args(argv)
|
||||
|
|
@ -17,8 +14,8 @@ def check_json(argv):
|
|||
for filename in args.filenames:
|
||||
try:
|
||||
simplejson.load(open(filename))
|
||||
except simplejson.JSONDecodeError as e:
|
||||
print('{0}: Failed to json encode ({1})'.format(filename, e))
|
||||
except simplejson.JSONDecodeError as exc:
|
||||
print('{0}: Failed to json encode ({1})'.format(filename, exc))
|
||||
retval = 1
|
||||
return retval
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue