From a535c104de6a4a3d979de407be2d1185bfb71376 Mon Sep 17 00:00:00 2001 From: Thierry <6230277+tdeo@users.noreply.github.com> Date: Tue, 10 Dec 2024 15:21:55 +0100 Subject: [PATCH] Silence annoying ltex error on no error (#5) --- .pre-commit-config.yaml | 6 ++++++ ltex/ltex.sh | 14 ++++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 442ef58..7db7898 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -4,6 +4,12 @@ repos: - id: check-hooks-apply - id: check-useless-excludes + - repo: https://github.com/shellcheck-py/shellcheck-py + rev: v0.10.0.1 + hooks: + - id: shellcheck + args: [-x] + - repo: local hooks: - id: local_hooks diff --git a/ltex/ltex.sh b/ltex/ltex.sh index 37c2515..1c5a6c4 100755 --- a/ltex/ltex.sh +++ b/ltex/ltex.sh @@ -7,12 +7,12 @@ set -euo pipefail ltex_dir=$(dirname "$0") ltex_version="" -ltex_tag=$(cd $ltex_dir; tar -cf - ./ | md5sum | cut -d' ' -f1) +ltex_tag=$(cd "$ltex_dir"; tar -cf - ./ | md5sum | cut -d' ' -f1) ltex_version="ltex:$ltex_tag" ( - cd $ltex_dir - docker inspect "$ltex_version" > /dev/null || docker build . -t "$ltex_version" -t 'ltex:latest' + cd "$ltex_dir" + docker inspect "$ltex_version" &>/dev/null || docker build . -t "$ltex_version" -t 'ltex:latest' > /dev/null ) files_to_clean=() @@ -38,13 +38,15 @@ for file in "$@"; do fi done -echo "${files_to_process[@]}" | +output=$(echo "${files_to_process[@]}" | xargs docker run --rm -i \ --user "$UID" \ --volume "$(pwd):/src:rw,Z" \ --workdir /src \ - "$ltex_version" | - sed -E 's|(app/javascript/documentation/.*?\.md):|\1x:|g' || true + "$ltex_version" 2>&1 | + sed -E 's|(app/javascript/documentation/.*?\.md):|\1x:|g' || true) + +echo "$output" | grep "SEVERE: java.io.IOException: Stream closed" >/dev/null || echo "$output" cleanup