mirror of
https://github.com/LizardByte/Sunshine.git
synced 2026-02-04 13:25:42 +00:00
clang: adjust formatting rules (#1015)
This commit is contained in:
40
scripts/update_clang_format.py
Normal file
40
scripts/update_clang_format.py
Normal file
@ -0,0 +1,40 @@
|
||||
# standard imports
|
||||
import os
|
||||
import subprocess
|
||||
|
||||
# variables
|
||||
directories = [
|
||||
'src',
|
||||
'tools',
|
||||
os.path.join('third-party', 'glad'),
|
||||
os.path.join('third-party', 'nvfbc'),
|
||||
os.path.join('third-party', 'wayland-protocols')
|
||||
]
|
||||
file_types = [
|
||||
'cpp',
|
||||
'h',
|
||||
'm',
|
||||
'mm'
|
||||
]
|
||||
|
||||
|
||||
def clang_format(file: str):
|
||||
print(f'Formatting {file} ...')
|
||||
subprocess.run(['clang-format', '-i', file])
|
||||
|
||||
|
||||
def main():
|
||||
"""
|
||||
Main entry point.
|
||||
"""
|
||||
# walk the directories
|
||||
for directory in directories:
|
||||
for root, dirs, files in os.walk(directory):
|
||||
for file in files:
|
||||
file_path = os.path.join(root, file)
|
||||
if os.path.isfile(file_path) and file.rsplit('.')[-1] in file_types:
|
||||
clang_format(file=file_path)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
Reference in New Issue
Block a user