mirror of
https://github.com/kovidgoyal/kitty.git
synced 2026-09-04 16:58:21 +00:00
check .slang file formatting in CI
This commit is contained in:
parent
953ac19e77
commit
e95da80fdb
1 changed files with 10 additions and 0 deletions
10
.github/workflows/ci.py
vendored
10
.github/workflows/ci.py
vendored
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue