Check if a file is properly formatted.
(file: Path)
| 42 | |
| 43 | |
| 44 | def check_file_format(file: Path) -> bool: |
| 45 | """Check if a file is properly formatted.""" |
| 46 | result = subprocess.run( |
| 47 | ["clang-format", "--dry-run", "--Werror", str(file)], |
| 48 | stdout=subprocess.PIPE, |
| 49 | stderr=subprocess.DEVNULL |
| 50 | ) |
| 51 | return result.returncode == 0 |
| 52 | |
| 53 | |
| 54 | def format_file(file: Path) -> None: |