MCPcopy Index your code
hub / github.com/pre-commit/pre-commit-hooks / main

Function main

pre_commit_hooks/check_json.py:21–34  ·  view source on GitHub ↗
(argv: Sequence[str] | None = None)

Source from the content-addressed store, hash-verified

19
20
21def main(argv: Sequence[str] | None = None) -> int:
22 parser = argparse.ArgumentParser()
23 parser.add_argument('filenames', nargs='*', help='Filenames to check.')
24 args = parser.parse_args(argv)
25
26 retval = 0
27 for filename in args.filenames:
28 with open(filename, 'rb') as f:
29 try:
30 json.load(f, object_pairs_hook=raise_duplicate_keys)
31 except ValueError as exc:
32 print(f'{filename}: Failed to json decode ({exc})')
33 retval = 1
34 return retval
35
36
37if __name__ == '__main__':

Callers 3

test_mainFunction · 0.90
test_non_utf8_fileFunction · 0.90
check_json.pyFile · 0.70

Calls

no outgoing calls

Tested by 2

test_mainFunction · 0.72
test_non_utf8_fileFunction · 0.72