mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 18:22:07 +00:00
Add contrib/checkformat.bash to check for clang-formatting (#1646)
This commit is contained in:
2
.github/workflows/checkdiff.yml
vendored
2
.github/workflows/checkdiff.yml
vendored
@@ -11,7 +11,7 @@ jobs:
|
|||||||
cd rgbds
|
cd rgbds
|
||||||
git remote add upstream "${{ github.event.pull_request.base.repo.clone_url }}"
|
git remote add upstream "${{ github.event.pull_request.base.repo.clone_url }}"
|
||||||
git fetch upstream
|
git fetch upstream
|
||||||
- name: Checkdiff
|
- name: Check diff
|
||||||
working-directory: rgbds
|
working-directory: rgbds
|
||||||
run: |
|
run: |
|
||||||
make checkdiff "BASE_REF=${{ github.event.pull_request.base.sha }}" Q= | tee log
|
make checkdiff "BASE_REF=${{ github.event.pull_request.base.sha }}" Q= | tee log
|
||||||
|
|||||||
12
.github/workflows/checkformat.yml
vendored
Normal file
12
.github/workflows/checkformat.yml
vendored
Normal file
@@ -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
|
||||||
15
contrib/checkformat.bash
Executable file
15
contrib/checkformat.bash
Executable file
@@ -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
|
||||||
Reference in New Issue
Block a user