diff --git a/pre_commit_hooks/check_json.py b/pre_commit_hooks/check_json.py index 51e0f21c..ef4629a2 100644 --- a/pre_commit_hooks/check_json.py +++ b/pre_commit_hooks/check_json.py @@ -3,7 +3,8 @@ import argparse import json import re -from typing import Any, Sequence +from typing import Any +from typing import Sequence def raise_duplicate_keys( @@ -17,6 +18,7 @@ def raise_duplicate_keys( d[key] = val return d + def check_mixed_indentation(content: str, filename: str) -> bool: """ Checks a string content for mixed indentation (tabs and spaces) in leading whitespace. @@ -41,6 +43,7 @@ def check_mixed_indentation(content: str, filename: str) -> bool: return not found_mixed + def main(argv: Sequence[str] | None = None) -> int: parser = argparse.ArgumentParser() parser.add_argument('filenames', nargs='*', help='Filenames to check.') @@ -48,7 +51,7 @@ def main(argv: Sequence[str] | None = None) -> int: retval = 0 for filename in args.filenames: - with open(filename, 'r') as f: + with open(filename) as f: content = f.read() # Check for mixed indentation first