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