Skip to content

Commit 1d3943a

Browse files
committed
1 parent b5709f8 commit 1d3943a

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

.ci/check-newline.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/usr/bin/env bash
2+
3+
set -e -u -o pipefail
4+
5+
ret=0
6+
show=0
7+
# Reference: https://medium.com/@alexey.inkin/how-to-force-newline-at-end-of-files-and-why-you-should-do-it-fdf76d1d090e
8+
while IFS= read -rd '' f; do
9+
if file --mime-encoding "$f" | grep -qv binary; then
10+
tail -c1 < "$f" | read -r _ || show=1
11+
if [ $show -eq 1 ]; then
12+
echo "Warning: No newline at end of file $f"
13+
ret=1
14+
show=0
15+
fi
16+
fi
17+
done < <(git ls-files -z examples)
18+
19+
exit $ret

.github/workflows/status-check.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ jobs:
2626
sudo apt-get install -q -y clang-format-12
2727
sudo apt-get install -q -y cppcheck
2828
sudo apt-get install -q -y gcc-11
29+
.ci/check-newline.sh
2930
.ci/check-format.sh
3031
.ci/static-analysis.sh
3132
.ci/build-n-run.sh

examples/.clang-format

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,4 +95,4 @@ SpacesInParentheses: false
9595
SpacesInSquareBrackets: false
9696
Standard: Cpp03
9797
TabWidth: 4
98-
UseTab: Never
98+
UseTab: Never

0 commit comments

Comments
 (0)