Merge "Remove run_black.py script"

This commit is contained in:
Zuul 2024-07-30 22:36:03 +00:00 committed by Gerrit Code Review
commit 945af3ff49
3 changed files with 8 additions and 46 deletions

View File

@ -33,3 +33,10 @@ fb82532bbf0c91fbd6ba385b0cbab880ec1159d6
51bee5a605ebb016b7905b243ac9d3da86551df6
51b6e19a2cf572399dc394ff3336c3c384de010a
70fd84b263fef57d9589683ce22496b4cb55d65c
9aa90f102eab078a7b9623b9231909cd32490760
7a8694fab160e0eb95acd66c8f519bfebc04900f
591956c86a9a6458fb9b4ab7224d8f29824fd819
9c91fffa072794c45347b678c5daebbb6cf49bd3
30df79b36a07d5d11f9fb84c6635ccccd00755b0
2967ee254c9e3548a96874e62c27abae8557ceba
8c27f069dd06af9aad3327b6a90f2ea29452cd6e

View File

@ -1,41 +0,0 @@
# noqa: H102
import subprocess
import sys
# List of module directories to check
modules = [
"dccommon",
"dcdbsync",
"dcagent",
"dcorch",
"dcmanager",
]
# List of modules that are already formatted with black
formatted_modules = [
"dccommon",
"dcdbsync",
"dcagent",
"dcorch",
"dcmanager",
]
# Function to run black check
def run_black_check(module):
try:
subprocess.run(
["black", "--check", "--diff", "--quiet", f"./{module}"], check=True
)
print(f"Black check passed for {module}")
except subprocess.CalledProcessError as e:
print(f"Black check failed for {module}")
# If the module is in formatted_modules, stx-distcloud-tox-black will fail
if module in formatted_modules:
sys.exit(e.returncode)
# Iterate over modules and run black check
for module in modules:
run_black_check(module)

View File

@ -97,9 +97,5 @@ commands =
# To apply the format in a specific file, use the following command: black <file_path>
deps =
black>=23.11.0 # MIT
# Note: After all files being formatted by Black, the following command should be used
# as default for the black environment and run_black.py script should be deleted.
; commands =
; black --check --diff .
commands =
python run_black.py
black --check --diff .