mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
Add python mypy check to CI
This commit is contained in:
parent
e46f615176
commit
9cb2aa1c46
@ -17,7 +17,7 @@ RUN apt-get update && env DEBIAN_FRONTEND=noninteractive apt-get install --yes \
|
||||
python3-pip \
|
||||
shellcheck \
|
||||
yamllint \
|
||||
&& pip3 install black==22.8.0 boto3 codespell==2.2.1 dohq-artifactory PyGithub unidiff pylint==2.6.2 \
|
||||
&& pip3 install black==22.8.0 boto3 codespell==2.2.1 dohq-artifactory mypy PyGithub unidiff pylint==2.6.2 \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /root/.cache/pip
|
||||
|
||||
|
@ -15,6 +15,7 @@ def process_result(result_folder):
|
||||
"shellcheck",
|
||||
"style",
|
||||
"black",
|
||||
"mypy",
|
||||
"typos",
|
||||
"whitespaces",
|
||||
"workflows",
|
||||
|
@ -9,6 +9,8 @@ echo "Check style" | ts
|
||||
./check-style -n |& tee /test_output/style_output.txt
|
||||
echo "Check python formatting with black" | ts
|
||||
./check-black -n |& tee /test_output/black_output.txt
|
||||
echo "Check python type hinting with mypy" | ts
|
||||
./check-mypy -n |& tee /test_output/mypy_output.txt
|
||||
echo "Check typos" | ts
|
||||
./check-typos |& tee /test_output/typos_output.txt
|
||||
echo "Check docs spelling" | ts
|
||||
|
23
utils/check-style/check-mypy
Executable file
23
utils/check-style/check-mypy
Executable file
@ -0,0 +1,23 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# The mypy supports pyproject.toml, but unfortunately it doesn't support it recursively
|
||||
# https://github.com/python/mypy/issues/10613
|
||||
#
|
||||
# Unless it's done, mypy only runs against tests/ci
|
||||
# Let's leave here a room for improvement and redo it when mypy will test anything else
|
||||
|
||||
GIT_ROOT=$(git rev-parse --show-cdup)
|
||||
GIT_ROOT=${GIT_ROOT:-.}
|
||||
CONFIG="$GIT_ROOT/tests/ci/.mypy.ini"
|
||||
DIRS=("$GIT_ROOT/tests/ci/" "$GIT_ROOT/tests/ci/"*/)
|
||||
tmp=$(mktemp)
|
||||
for dir in "${DIRS[@]}"; do
|
||||
if ! compgen -G "$dir"/*.py > /dev/null; then
|
||||
continue
|
||||
fi
|
||||
if ! mypy --config-file="$CONFIG" --sqlite-cache "$dir"/*.py > "$tmp" 2>&1; then
|
||||
echo "Errors while processing $dir":
|
||||
cat "$tmp"
|
||||
fi
|
||||
done
|
||||
rm -rf "$tmp"
|
Loading…
Reference in New Issue
Block a user