From 611ce70662702f67a619fe9b5b7f965ab9267fb2 Mon Sep 17 00:00:00 2001 From: Hugo Brito Date: Sat, 29 Jun 2024 16:43:47 -0300 Subject: [PATCH] Remove run_black.py script Remove the run_black.py script since all modules applied the black format. Now the check directly executed by the black command in tox config. Additionally, update git-blame-ignore-revs with dcmanager's format commits. Test Plan: PASS - Success tox command PASS - Success zuul jobs Story: 2011149 Task: 50485 Change-Id: I464b58c331a8f0a42112479f07123bf01370e59c Signed-off-by: Hugo Brito --- .git-blame-ignore-revs | 7 ++++++ distributedcloud/run_black.py | 41 ----------------------------------- distributedcloud/tox.ini | 6 +---- 3 files changed, 8 insertions(+), 46 deletions(-) delete mode 100644 distributedcloud/run_black.py diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs index defd5b0ce..312f583a6 100644 --- a/.git-blame-ignore-revs +++ b/.git-blame-ignore-revs @@ -33,3 +33,10 @@ fb82532bbf0c91fbd6ba385b0cbab880ec1159d6 51bee5a605ebb016b7905b243ac9d3da86551df6 51b6e19a2cf572399dc394ff3336c3c384de010a 70fd84b263fef57d9589683ce22496b4cb55d65c +9aa90f102eab078a7b9623b9231909cd32490760 +7a8694fab160e0eb95acd66c8f519bfebc04900f +591956c86a9a6458fb9b4ab7224d8f29824fd819 +9c91fffa072794c45347b678c5daebbb6cf49bd3 +30df79b36a07d5d11f9fb84c6635ccccd00755b0 +2967ee254c9e3548a96874e62c27abae8557ceba +8c27f069dd06af9aad3327b6a90f2ea29452cd6e diff --git a/distributedcloud/run_black.py b/distributedcloud/run_black.py deleted file mode 100644 index d67d64cef..000000000 --- a/distributedcloud/run_black.py +++ /dev/null @@ -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) diff --git a/distributedcloud/tox.ini b/distributedcloud/tox.ini index 0685c167b..792470d61 100644 --- a/distributedcloud/tox.ini +++ b/distributedcloud/tox.ini @@ -97,9 +97,5 @@ commands = # To apply the format in a specific file, use the following command: black 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 .