Check that all files use LF line endings in CI

pull/111/head
lu4p 5 years ago committed by Daniel Martí
parent 75e904f6d4
commit ea51e78283

@ -41,3 +41,10 @@ jobs:
run: |
go version
go test ./...
code-checks:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Test that only LF line endings are used
run: bash crlf_test.sh

@ -0,0 +1,19 @@
#!/bin/bash
if \
grep \
--recursive \
--files-with-matches \
--binary \
--binary-files=without-match \
--max-count=1 \
--exclude-dir="\.git" \
$'\r' \
. \
; then
# TODO exit status should be number of files with wrong endings found
echo -e "Found at least a file with CRLF endings."
exit 1
fi
echo -e "No files with CRLF endings found."
exit 0
Loading…
Cancel
Save