Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clang-format implementation #1740

Merged
merged 45 commits into from
Jul 16, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
94c2f43
Testing clang-format style check using github CI
ia Jul 11, 2023
b24d945
github/push: implement check-style for clang-format as a separate bui…
ia Jul 11, 2023
1103b50
github/push: add missing packages for check-style/clang-format build …
ia Jul 11, 2023
9bd3501
source/Makefile: check-style - reduce files of interest; update .clan…
ia Jul 12, 2023
6306e9b
source/Makefile: empty lines, spaces & tabs refactoring to unify styl…
ia Jul 12, 2023
5bb5afe
source/Makefile: fix formatting for multi-line variables
ia Jul 12, 2023
5a0f346
source/Makefile: update formatting for multi-line variables
ia Jul 12, 2023
38bea98
source/Makefile: remove spaces on vars assignments to unify style
ia Jul 12, 2023
703498d
source/Makefile: remove unused target style
ia Jul 12, 2023
20e2da7
source/Makefile: implement exclude vars for clang-format related files
ia Jul 12, 2023
af0200a
source/Makefile: exclude configuration.h from clang-format check
ia Jul 12, 2023
96e7c99
Dockerfile: add diffutils in a container to make check-style target u…
ia Jul 12, 2023
a1ef959
source/Makefile: implement parser for clang-format inside check-style…
ia Jul 12, 2023
60cd7a6
source/Makefile: probably final touches on unifying style
ia Jul 12, 2023
a60ca8b
source/Makefile: implement check-style-list target to only list affec…
ia Jul 12, 2023
680c781
source/Makefile: fix missed spaces
ia Jul 12, 2023
791fec8
deploy.sh: add helper routine to deal with clang-format error output …
ia Jul 12, 2023
baa709a
gitignore: add clang-format log explicitly
ia Jul 12, 2023
ad50dc2
Refactoring for clang-format compiance
ia Jul 12, 2023
ec60601
Dockerfile: add sed
ia Jul 12, 2023
4c03e06
Dockerfile: false alarm - remove sed since busybox-sed seems fine
ia Jul 12, 2023
3560e8c
source/Makefile: reduce calls of clang-format & make error log more c…
ia Jul 12, 2023
7df60b0
deploy.sh:check_style() - add removal of DOS EOLs for generated log
ia Jul 12, 2023
18ce274
source/Makefile:check-style: add more empty lines between blocks with…
ia Jul 13, 2023
396f082
source/Makefile: add STOP var to check-style for exit on first failed…
ia Jul 13, 2023
a39dab4
source/Makefile: check-style: make log looks more like traditional di…
ia Jul 13, 2023
d0f87e3
source/Core/BSP/Pinecilv2/MemMang/heap_5.c: clang-format refactoring …
ia Jul 13, 2023
3058f6e
Return headers include order
ia Jul 13, 2023
5365168
clang-format config: disable warnings about non-alphabetic include order
ia Jul 13, 2023
15970a9
clang-format refactoring
ia Jul 13, 2023
ab1a7b3
clang-format refactoring, part 2
ia Jul 13, 2023
2c3c447
clang-format refactoring, part 3
ia Jul 13, 2023
8c387a8
settingsGUI.cpp: refactoring, part 1
ia Jul 13, 2023
1e00a5b
settingsGUI.cpp: refactoring, part 2
ia Jul 13, 2023
5204478
settingsGUI.cpp: refactoring, part 3
ia Jul 13, 2023
b30722d
settingsGUI.cpp: refactoring, part 4
ia Jul 13, 2023
da5534d
clang-format should be happy now
ia Jul 13, 2023
7daf912
workflows/push: put readme check into separate build step & update style
ia Jul 13, 2023
ff8df64
clang-format: giving SortIncludes option second chance by tweaking a …
ia Jul 13, 2023
7f8e70e
source/Makefile: check-style: add homebrew parser to check for { } in…
ia Jul 14, 2023
f53b7db
homebrew-format: add { } for if/else, while, and for & unify some com…
ia Jul 14, 2023
970f3c0
source/Makefile: homebrew-format: fix false negative trigger for mult…
ia Jul 14, 2023
a492c3c
Sleep.cpp: unify style & comments
ia Jul 14, 2023
382ae15
source/Makefile: remove unused debug target
ia Jul 14, 2023
a63d5d0
Merge dev branch to clang-format branch
ia Jul 15, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 25 additions & 7 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ jobs:
name: metadata
path: source/Hexfile/${{ matrix.model }}.json


build_multi-lang:
runs-on: ubuntu-20.04
container:
Expand Down Expand Up @@ -106,6 +107,7 @@ jobs:
name: metadata
path: source/Hexfile/${{ matrix.model }}_multi-lang.json


tests:
runs-on: ubuntu-20.04
container:
Expand Down Expand Up @@ -133,14 +135,15 @@ jobs:
chmod +x brieflz_test.py
./brieflz_test.py

check_formatting:

check_python:
runs-on: ubuntu-20.04
container:
image: alpine:3.16

steps:
- name: deps
run: apk add --no-cache python3 py3-pip make git black sed diffutils
run: apk add --no-cache python3 py3-pip make git black sed diffutils findutils clang-extra-tools

- uses: actions/checkout@v3
with:
Expand All @@ -149,9 +152,6 @@ jobs:
- name: install black
run: python3 -m pip install bdflib flake8

- name: Check formatting with clang-format
run: cd source && make clean && make check-style

- name: Check python formatting with black
run: black --check Translations

Expand All @@ -161,8 +161,26 @@ jobs:
- name: Check autogenerated Documentation/README.md
run: /bin/sh ./scripts/deploy.sh docs_readme

shellcheck:
name: runner / shellcheck

check_c-cpp:
runs-on: ubuntu-20.04
container:
image: alpine:3.16

steps:
- name: deps
run: apk add --no-cache make git diffutils findutils clang-extra-tools

- uses: actions/checkout@v3
with:
submodules: true

- name: Check formatting with clang-format
run: cd source && make clean && make check-style


check_shell:
name: check_shell
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand Down
14 changes: 9 additions & 5 deletions source/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -794,16 +794,20 @@ style:
@echo "Done"

check-style:
@for src in $(ALL_SOURCE) $(ALL_INCLUDES) ; do \
@ret=0; 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)" ; \
clang-format "$$src" | diff "$$src" -; \
exit 1 ; \
ret=1 ; \
fi ; \
done
@echo "Style check passed"

done ; \
if [ $$ret -eq 0 ] ; then \
echo "Style check passed" && exit 0 ; \
else \
echo "Style check failed at least once! Please, check the log above for the details." && exit 1 ; \
fi ;

.PHONY: style all clean default clean-all
.SECONDARY:

Expand Down