From 13360a21f050d386734ad8824a348e84cf113932 Mon Sep 17 00:00:00 2001 From: Gabriele Musco Date: Tue, 16 Apr 2024 07:26:02 +0200 Subject: [PATCH] feat: check for trailing spaces in CI --- .gitlab-ci.yml | 4 ++++ test_trailing_spaces.sh | 9 +++++++++ 2 files changed, 13 insertions(+) create mode 100755 test_trailing_spaces.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index fe610f5..2aeec04 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -6,6 +6,10 @@ test-links: script: - python3 ./test_links.py +test-trailing-spaces: + script: + - ./test_trailing_spaces.sh + test-build: image: registry.gitlab.com/pages/hugo/hugo_extended script: diff --git a/test_trailing_spaces.sh b/test_trailing_spaces.sh new file mode 100755 index 0000000..f29644c --- /dev/null +++ b/test_trailing_spaces.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +TRAILING_SPACES=$(find content -name '*.md' -exec grep -EHn ' +$' {} \;) + +if [[ -n "$TRAILING_SPACES" ]]; then + echo "Error: these files have trailing spaces!" + echo "$TRAILING_SPACES" + exit 1 +fi