From e95da80fdbbf317917a106c8e1bcf8032c875c80 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 10 Aug 2026 22:36:37 +0530 Subject: [PATCH] check .slang file formatting in CI --- .github/workflows/ci.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/ci.py b/.github/workflows/ci.py index 5e1f15273..6a1c6e97a 100644 --- a/.github/workflows/ci.py +++ b/.github/workflows/ci.py @@ -353,6 +353,16 @@ def main() -> None: c_files = subprocess.check_output(['git', 'ls-files', '*.c', '*.h', '*.m']).decode().split() if c_files and subprocess.run(['clang-format', '--dry-run', '--Werror'] + c_files).returncode != 0: raise SystemExit('Some C/ObjC files are not formatted correctly') + slang_files = subprocess.check_output(['git', 'ls-files', '*.slang']).decode().split() + badly_formatted_slang = [] + for sf in slang_files: + assume_name = os.path.basename(sf) + '.cs' + with open(sf, 'rb') as f: + result = subprocess.run(['clang-format', '--style=file:.clang-format-for-slang', '--Werror', '-n', f'--assume-filename={assume_name}'], stdin=f) + if result.returncode != 0: + badly_formatted_slang.append(sf) + if badly_formatted_slang: + raise SystemExit('Some .slang files are not formatted correctly:\n' + '\n'.join(badly_formatted_slang)) elif action == 'check-dependencies': check_dependencies() else: