Skip to content

Commit 3cdb08c

Browse files
committed
add basic lint checks
for all git-tracked text files, assert that: - No trainling whitespaces at EOLs - No tab characters - a newline at EOF
1 parent 878a27e commit 3cdb08c

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

.github/workflows/lint.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,21 @@ jobs:
1313
node-version: '18'
1414
- run: npm install -g markdownlint-cli
1515
- run: markdownlint '**/*.md' --ignore-path=.gitignore
16+
- name: "No trailing whitespaces at EOLs"
17+
run: |
18+
EXIT_CODE=0
19+
git --no-pager grep --full-name -I -n -e ' $' . && EXIT_CODE=1
20+
exit $EXIT_CODE
21+
- name: "No tab characters"
22+
run: |
23+
EXIT_CODE=0
24+
git --no-pager grep --full-name -I -n -P '\t' . && EXIT_CODE=1
25+
exit $EXIT_CODE
26+
- name: "Newline at EOF"
27+
run: |
28+
EXIT_CODE=0
29+
for f in $(git --no-pager grep --full-name -I -l ''); do
30+
tail -c1 "$f" | read -r _ || echo "$f"
31+
tail -c1 "$f" | read -r _ || EXIT_CODE=1
32+
done
33+
exit $EXIT_CODE

0 commit comments

Comments
 (0)