Skip to content

Commit

Permalink
Silence annoying ltex error on no error (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
tdeo authored Dec 10, 2024
1 parent f5141fb commit a535c10
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
6 changes: 6 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 8 additions & 6 deletions ltex/ltex.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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=()
Expand All @@ -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

Expand Down

0 comments on commit a535c10

Please sign in to comment.