Skip to content

Commit

Permalink
add basic lint checks
Browse files Browse the repository at this point in the history
for all git-tracked text files, assert that:
- No trainling whitespaces at EOLs
- No tab characters
- a newline at EOF
  • Loading branch information
etpinard committed Jun 27, 2023
1 parent 878a27e commit 3cdb08c
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,21 @@ jobs:
node-version: '18'
- run: npm install -g markdownlint-cli
- run: markdownlint '**/*.md' --ignore-path=.gitignore
- name: "No trailing whitespaces at EOLs"
run: |
EXIT_CODE=0
git --no-pager grep --full-name -I -n -e ' $' . && EXIT_CODE=1
exit $EXIT_CODE
- name: "No tab characters"
run: |
EXIT_CODE=0
git --no-pager grep --full-name -I -n -P '\t' . && EXIT_CODE=1
exit $EXIT_CODE
- name: "Newline at EOF"
run: |
EXIT_CODE=0
for f in $(git --no-pager grep --full-name -I -l ''); do
tail -c1 "$f" | read -r _ || echo "$f"
tail -c1 "$f" | read -r _ || EXIT_CODE=1
done
exit $EXIT_CODE

0 comments on commit 3cdb08c

Please sign in to comment.