mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
add dockerfile for checking formatting
This commit is contained in:
parent
0d53248b4c
commit
2793551040
2 changed files with 29 additions and 0 deletions
10
.docker/Dockerfile.check-format
Normal file
10
.docker/Dockerfile.check-format
Normal file
|
@ -0,0 +1,10 @@
|
|||
FROM ubuntu:19.10
|
||||
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
RUN apt-get -y install clang-format
|
||||
|
||||
WORKDIR /build
|
||||
|
||||
CMD ["/bin/sh"]
|
||||
ENTRYPOINT ["./tools/docker/build.sh"]
|
19
tools/check-format.sh
Executable file
19
tools/check-format.sh
Executable file
|
@ -0,0 +1,19 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -eu
|
||||
|
||||
fail="0"
|
||||
|
||||
while read -r file; do
|
||||
if ! diff -u <(cat "$file") <(clang-format "$file"); then
|
||||
echo "$file differs!!!!!!!"
|
||||
fail="1"
|
||||
fi
|
||||
done < <(find src/ \( -iname "*.hpp" -o -iname "*.cpp" \))
|
||||
|
||||
if [ "$fail" = "1" ]; then
|
||||
echo "At least one file is poorly formatted - check the output above"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Everything seems to be formatted properly! Good job"
|
Loading…
Reference in a new issue