Merge pull request #50164 from ClickHouse/optimize-style-check

Speed-up the shellcheck with parallel xargs
This commit is contained in:
Mikhail f. Shiryaev 2023-05-25 14:02:40 +02:00 committed by GitHub
commit 5c59d9a0ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,9 +1,14 @@
#!/usr/bin/env bash
ROOT_PATH=$(git rev-parse --show-toplevel)
EXCLUDE_DIRS='build/|integration/|widechar_width/|glibc-compatibility/|memcpy/|consistent-hashing/|Parsers/New'
NPROC=$(($(nproc) + 3))
# Check sh tests with Shellcheck
(cd $ROOT_PATH/tests/queries/0_stateless/ && shellcheck --check-sourced --external-sources --severity info --exclude SC1071,SC2086,SC2016 *.sh ../1_stateful/*.sh)
( cd "$ROOT_PATH/tests/queries/0_stateless/" && \
find "$ROOT_PATH/tests/queries/"{0_stateless,1_stateful} -name '*.sh' -print0 | \
xargs -0 -P "$NPROC" -n 20 shellcheck --check-sourced --external-sources --severity info --exclude SC1071,SC2086,SC2016
)
# Check docker scripts with shellcheck
find "$ROOT_PATH/docker" -executable -type f -exec file -F' ' --mime-type {} \; | awk -F' ' '$2==" text/x-shellscript" {print $1}' | grep -v "entrypoint.alpine.sh" | grep -v "compare.sh"| xargs shellcheck
find "$ROOT_PATH/docker" -executable -type f -exec file -F' ' --mime-type {} \; | \
awk -F' ' '$2==" text/x-shellscript" {print $1}' | \
grep -v "compare.sh" | \
xargs -P "$NPROC" -n 20 shellcheck