Files
hla_framework_bd/scripts/ci/check_ui_files.py

26 lines
745 B
Python

import re
from agebd.utils import get_git_root
REPO_ROOT = get_git_root(__file__)
QT_DIR = REPO_ROOT / "qt"
def check_ui_files():
"""
All 'AGEBD-' PVs need to contain the '$(AGEBD_ENV_SUFFIX)' macro,
which is:
'' in PROD
'-DEV' in DEV
"""
for filename in QT_DIR.glob("*"):
with open(filename, "r") as f:
for linenum, line in enumerate(f):
matches = re.findall("AGEBD-[0-9A-Z$()_]*:", line)
if matches:
for match in matches:
assert "$(AGEBD_ENV_SUFFIX)" in match, (
f"Missing $(AGEBD_ENV_SUFFIX) in {filename} in line number {linenum + 1}: {line} "
)