Merge pull request #61159 from ClickHouse/back-black

Enable black back
This commit is contained in:
Mikhail f. Shiryaev 2024-03-11 13:37:03 +01:00 committed by GitHub
commit b2f795601b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 16 additions and 16 deletions

View File

@ -1,12 +1,12 @@
#!/usr/bin/env python3
import argparse
from concurrent.futures import ProcessPoolExecutor
import csv
import logging
import os
import shutil
import subprocess
import sys
from concurrent.futures import ProcessPoolExecutor
from pathlib import Path
from typing import List, Tuple
@ -121,7 +121,7 @@ def checkout_last_ref(pr_info: PRInfo) -> None:
def main():
logging.basicConfig(level=logging.INFO)
logging.getLogger("git_helper").setLevel(logging.DEBUG)
# args = parse_args()
args = parse_args()
stopwatch = Stopwatch()
@ -141,12 +141,14 @@ def main():
f"--entrypoint= -w/ClickHouse/utils/check-style "
f"{image} ./check_cpp.sh"
)
cmd_py = (
f"docker run -u $(id -u ${{USER}}):$(id -g ${{USER}}) --cap-add=SYS_PTRACE "
f"--volume={repo_path}:/ClickHouse --volume={temp_path}:/test_output "
f"--entrypoint= -w/ClickHouse/utils/check-style "
f"{image} ./check_py.sh"
)
cmd_docs = (
f"docker run -u $(id -u ${{USER}}):$(id -g ${{USER}}) --cap-add=SYS_PTRACE "
f"--volume={repo_path}:/ClickHouse --volume={temp_path}:/test_output "
@ -175,12 +177,14 @@ def main():
_ = future1.result()
if run_pycheck:
if args.push:
checkout_head(pr_info)
logging.info("Run py files check: %s", cmd_py)
future2 = executor.submit(subprocess.run, cmd_py, shell=True)
_ = future2.result()
# if args.push:
# checkout_head(pr_info)
if args.push:
commit_push_staged(pr_info)
checkout_last_ref(pr_info)
subprocess.check_call(
f"python3 ../../utils/check-style/process_style_check_result.py --in-results-dir {temp_path} "
@ -189,10 +193,6 @@ def main():
shell=True,
)
# if args.push:
# commit_push_staged(pr_info)
# checkout_last_ref(pr_info)
state, description, test_results, additional_files = process_result(temp_path)
JobReport(

View File

@ -5,8 +5,8 @@ cd /ClickHouse/utils/check-style || echo -e "failure\tRepo not found" > /test_ou
start_total=`date +%s`
# FIXME: 1 min to wait + head checkout
# echo "Check python formatting with black" | ts
# ./check-black -n |& tee /test_output/black_output.txt
echo "Check python formatting with black" | ts
./check-black -n |& tee /test_output/black_output.txt
start=`date +%s`
./check-pylint -n |& tee /test_output/pylint_output.txt

View File

@ -1,9 +1,9 @@
#!/usr/bin/env python3
import os
import logging
import argparse
import csv
import logging
import os
# TODO: add typing and log files to the fourth column, think about launching
@ -17,7 +17,7 @@ def process_result(result_folder):
# "shellcheck",
"style",
"pylint",
# "black",
"black",
"mypy",
"typos",
"whitespaces",
@ -32,10 +32,10 @@ def process_result(result_folder):
if not os.path.exists(full_path):
test_results.append((f"Check {name}", "SKIPPED"))
elif os.stat(full_path).st_size != 0:
with open(full_path, 'r') as file:
with open(full_path, "r") as file:
lines = file.readlines()
if len(lines) > 100:
lines = lines[:100] + ['====TRIMMED====']
lines = lines[:100] + ["====TRIMMED===="]
content = "\n".join(lines)
description += f"Check {name} failed. "
test_results.append((f"Check {name}", "FAIL", None, content))