We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 434f1f3 commit 7f6a7e7Copy full SHA for 7f6a7e7
.ci/check-newline.sh
@@ -0,0 +1,17 @@
1
+#!/usr/bin/env bash
2
+
3
+ret=0
4
+show=0
5
+# Reference: https://medium.com/@alexey.inkin/how-to-force-newline-at-end-of-files-and-why-you-should-do-it-fdf76d1d090e
6
+while IFS= read -rd '' f; do
7
+ if file --mime-encoding "$f" | grep -qv binary; then
8
+ tail -c1 < "$f" | read -r _ || show=1
9
+ if [ $show -eq 1 ]; then
10
+ echo "Warning: No newline at end of file $f"
11
+ ret=1
12
+ show=0
13
+ fi
14
15
+done < <(git ls-files -z src tools tests)
16
17
+exit $ret
.github/workflows/main.yml
@@ -30,5 +30,6 @@ jobs:
30
- name: coding convention
31
run: |
32
sudo apt-get install -q -y clang-format-12
33
- sh .ci/check-format.sh
+ .ci/check-newline.sh
34
+ .ci/check-format.sh
35
shell: bash
0 commit comments