INNER CODE UNIT · Python
check_file_format
ClickHouse/ai-sdk-cpp · scripts/format.py:47
def check_file_format(file: Path) -> bool:
"""Check if a file is properly formatted."""
result = subprocess.run(
["clang-format", "--dry-run", "--Werror", str(file)],
stdout=subprocess.PIPE,
stderr=subprocess.DEVNULL
)
return result.returncode == 0
def format_file(file: Path) -> None:
"""Format a file in place."""
subprocess.run(
["clang-format", "-i", str(file)],
check=True
)