Hugo Brito 8c27f069dd Apply black formatter to dcmanager
This commit applies the Black format to the `dcmanager`
files to ensure that it adheres to the Black code style guidelines.

Test Plan:
PASS: Success in stx-distcloud-tox-black

Story: 2011149
Task: 50444

Change-Id: I4a8af46e24d4b5da2757f0a4e20a50a69523c44a
Signed-off-by: Hugo Brito <hugo.brito@windriver.com>
2024-07-30 16:29:39 -03:00

42 lines
919 B
Python

# 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)