From da60e825844c7e23ebd2c3fe3a6c1bcf15166de9 Mon Sep 17 00:00:00 2001 From: bunnie Date: Thu, 11 Jan 2024 21:20:41 +0800 Subject: [PATCH] add a proposed trailing whitespace check --- .github/workflows/trailing_whitespace_check.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 .github/workflows/trailing_whitespace_check.yml diff --git a/.github/workflows/trailing_whitespace_check.yml b/.github/workflows/trailing_whitespace_check.yml new file mode 100644 index 000000000..6635dd60f --- /dev/null +++ b/.github/workflows/trailing_whitespace_check.yml @@ -0,0 +1,16 @@ +# From https://github.com/samblenny/autofmt-demo/blob/main/.github/workflows/trailing_whitespace_check.yml +name: trailing_whitespace_check +on: push +jobs: + trailing_whitespace_check: + runs-on: ubuntu-latest + steps: + - name: Check out branch source + uses: actions/checkout@v4 + + - name: Check .rs files for trailing whitespace + run: > + find . -name '*.rs' -print0 + | xargs -0 grep -c --with-filename '[ \t]$' + | grep -v ':0$' + | perl -e 'while(<>){print;$n+=1};if($n>0){exit 1;};print "PASS\n";' \ No newline at end of file