mirror of
https://github.com/Ralim/IronOS.git
synced 2025-02-26 07:53:55 +00:00
Add make command to validate formatting
This commit is contained in:
25
.github/workflows/push.yml
vendored
25
.github/workflows/push.yml
vendored
@@ -168,3 +168,28 @@ jobs:
|
|||||||
source/Hexfile/LICENSE
|
source/Hexfile/LICENSE
|
||||||
source/Hexfile/LICENSE_RELEASE.md
|
source/Hexfile/LICENSE_RELEASE.md
|
||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
|
check_formatting:
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: chmod
|
||||||
|
run: chmod +x setup.sh && chmod +x source/build.sh && sudo mkdir -p /build/cache && sudo chmod -R 777 /build
|
||||||
|
|
||||||
|
- name: Cached compiler source files
|
||||||
|
uses: actions/cache@v2.1.4
|
||||||
|
env:
|
||||||
|
cache-name: cache-compilers
|
||||||
|
with:
|
||||||
|
# we deliberately persist a cache folder forwards
|
||||||
|
path: /build/cache
|
||||||
|
key: ${{ runner.os }}-build-${{ env.cache-name }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-
|
||||||
|
|
||||||
|
- name: setup
|
||||||
|
run: ./setup.sh
|
||||||
|
|
||||||
|
- name: Check formatting with clang-format
|
||||||
|
run: cd source && make clean && make check-style
|
||||||
|
|||||||
@@ -227,7 +227,7 @@ CXXFLAGS=$(DEV_CXXFLAGS) \
|
|||||||
-D${COMPILER} \
|
-D${COMPILER} \
|
||||||
-MMD \
|
-MMD \
|
||||||
$(CHECKOPTIONS) \
|
$(CHECKOPTIONS) \
|
||||||
-std=c++11 \
|
-std=c++14 \
|
||||||
$(OPTIM) \
|
$(OPTIM) \
|
||||||
-fno-common \
|
-fno-common \
|
||||||
-ffreestanding \
|
-ffreestanding \
|
||||||
@@ -336,6 +336,29 @@ style:
|
|||||||
done
|
done
|
||||||
@echo "Done"
|
@echo "Done"
|
||||||
|
|
||||||
|
check-style:
|
||||||
|
@for src in $(ALL_SOURCE) $(ALL_INCLUDES) ; do \
|
||||||
|
var=`clang-format "$$src" | diff "$$src" - | wc -l` ; \
|
||||||
|
if [ $$var -ne 0 ] ; then \
|
||||||
|
echo "$$src does not respect the coding style (diff: $$var lines)" ; \
|
||||||
|
exit 1 ; \
|
||||||
|
fi ; \
|
||||||
|
done
|
||||||
|
@echo "Style check passed"
|
||||||
|
|
||||||
|
tidy:
|
||||||
|
@for src in $(ALL_SOURCE) $(ALL_INCLUDES) ; do \
|
||||||
|
echo "Running tidy on $$src..." ; \
|
||||||
|
clang-tidy -checks="-*,modernize-use-auto,modernize-use-nullptr,\
|
||||||
|
readability-else-after-return,readability-simplify-boolean-expr,\
|
||||||
|
readability-redundant-member-init,modernize-use-default-member-init,\
|
||||||
|
modernize-use-equals-default,modernize-use-equals-delete,\
|
||||||
|
modernize-use-using,modernize-loop-convert,\
|
||||||
|
cppcoreguidelines-no-malloc,misc-redundant-expression" \
|
||||||
|
-header-filter=".*" \
|
||||||
|
"$$src" ; \
|
||||||
|
done
|
||||||
|
@echo "Done"
|
||||||
.PHONY: style all clean default
|
.PHONY: style all clean default
|
||||||
.SECONDARY:
|
.SECONDARY:
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user