Skip to content
Snippets Groups Projects
Verified Commit 4914b197 authored by Paul Dechamps's avatar Paul Dechamps :speech_balloon:
Browse files

(format) Changed format to clang 14

parent 2b05549d
No related branches found
No related tags found
1 merge request!1BLASTER v1.0
Pipeline #50743 failed
---
# https://clang.llvm.org/docs/ClangFormatStyleOptions.html#
# the "Visual Studio" style is similar to:
BasedOnStyle: LLVM
UseTab: Never
IndentWidth: 4
BreakBeforeBraces: Custom
BraceWrapping:
AfterNamespace: true
AfterClass: true
AfterStruct: true
AfterFunction: true
BeforeLambdaBody: false
AfterControlStatement: Always
BeforeElse: true
AfterCaseLabel: true
BeforeWhile: false
BeforeCatch: true
AfterEnum: true
AfterUnion: true
AfterExternBlock: true
SplitEmptyNamespace: false
SplitEmptyFunction: false
SplitEmptyRecord: false
IndentBraces: false
AccessModifierOffset: -4
SortIncludes: false
ColumnLimit: 0
...
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# This script runs "clang-format" recursively on all C/C++ files
# @authors A. Crovato, R. Boman
# Modified by P. Dechamps
import os
import fnmatch
import subprocess
def all_files(root,
patterns='*',
skips='*.git*;*build*;modules*',
single_level=False,
yield_folders=False):
# self.checkPath(root)
patterns = patterns.split(';')
skips = skips.split(';')
for path, subdirs, files in os.walk(root):
if yield_folders:
files.extend(subdirs)
files.sort()
for name in files:
for pattern in patterns:
if fnmatch.fnmatch(name, pattern):
fullname = os.path.join(path, name)
ok = True
for skip in skips:
if fnmatch.fnmatch(os.path.relpath(fullname, start=root), skip):
ok = False
if ok:
yield fullname
break
if single_level:
break
def main():
encs = {}
for f in all_files(os.getcwd(), patterns='*.cpp;*.c;*.h;*.hpp'):
print('Checking file', 'blaster'+f.split('blaster', 1)[-1], end='...')
cmd = ['clang-format-11', "-style=file", "-i", f]
retcode = subprocess.call(cmd)
if retcode != 0:
print(f'ERROR: retcode = {retcode}')
break
print('done.')
if __name__ == "__main__":
main()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment