forked from gbdev/rgbds
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add contrib/checkformat.bash to check for clang-formatting (gbdev#1646)
- Loading branch information
Showing
3 changed files
with
28 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
name: Code format checking | ||
on: pull_request | ||
|
||
jobs: | ||
checkformat: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v4 | ||
- name: Check format | ||
run: | | ||
./contrib/checkformat.bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/usr/bin/env bash | ||
|
||
# SPDX-License-Identifier: MIT | ||
|
||
clang-format --version | ||
|
||
find . -type f \( -iname '*.hpp' -o -iname '*.cpp' \) -exec clang-format -i {} + | ||
|
||
if ! git diff-index --quiet HEAD --; then | ||
echo 'Unformatted files:' | ||
git diff-index --name-only HEAD -- | ||
echo | ||
git diff HEAD -- | ||
return 1 | ||
fi |