Skip to content

Commit

Permalink
Update format command.
Browse files Browse the repository at this point in the history
Signed-off-by: James Goppert <[email protected]>
  • Loading branch information
jgoppert committed Jul 20, 2023
1 parent 8e42039 commit adbed9f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,16 @@ on:
jobs:
build:
runs-on: ubuntu-22.04
container: ghcr.io/zephyrproject-rtos/ci:v0.26.2
container: ghcr.io/zephyrproject-rtos/ci:v0.26.4
env:
CMAKE_PREFIX_PATH: /opt/toolchains
steps:
- name: Install Clang
working-directory: example-application
run: |
sudo apt install clang-format-14
west format -c
- name: Checkout
uses: actions/checkout@v3
with:
Expand Down
10 changes: 2 additions & 8 deletions scripts/format_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,6 @@ def do_run(self, args, unknown_args):
log.inf('running clang-format')

# check version
res = subprocess.run(['clang-format', '--version'], capture_output=True, check=True)
version = res.stdout.decode().split(' ')[3].split('-')[0]
version_req = "14.0.0"
if not version == version_req:
raise SystemExit(f'incorrect version {version:s} of clang-formatter, install {version_req:s}')

regex = re.compile('(.*\.c$)|(.*\.cpp$)|(.*\.h$)|(.*\.hpp$)')
format_ok = True

Expand All @@ -64,9 +58,9 @@ def do_run(self, args, unknown_args):
if regex.match(file):
file_path = os.path.join(root, file)
if args.check:
cmd_str = ['clang-format', '--dry-run', '--Werror', '-style', 'WebKit', f'{file_path}']
cmd_str = ['clang-format-14', '--dry-run', '--Werror', '-style', 'WebKit', f'{file_path}']
else:
cmd_str = ['clang-format', '-i', '-style', 'WebKit', f'{file_path}']
cmd_str = ['clang-format-14', '-i', '-style', 'WebKit', f'{file_path}']
try:
res = subprocess.run(cmd_str, capture_output=False, check=True)
except Exception as e:
Expand Down

0 comments on commit adbed9f

Please sign in to comment.