check for duplicate full IDs now

This commit is contained in:
Robin Mueller 2022-03-07 13:19:44 +01:00
parent 52f291692c
commit 348877b5d9
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814

View File

@ -98,7 +98,6 @@ class EventParser(FileParser):
self.my_id = self.return_number_from_string(self.current_id)
except KeyError as e:
print(f"Key not found: {e}")
# Now try to look for event definitions. Moving windows allows multi line event definitions
# These two variants need to be checked
event_match = re.match(
@ -106,14 +105,15 @@ class EventParser(FileParser):
moving_window[self.moving_window_center_idx],
)
macro_api_match = False
for idx in range(3):
if "MAKE_EVENT" in moving_window[self.moving_window_center_idx + idx]:
macro_api_match = True
break
elif "makeEvent" in moving_window[self.moving_window_center_idx + idx]:
break
else:
event_match = False
if event_match is not None:
for idx in range(3):
if "MAKE_EVENT" in moving_window[self.moving_window_center_idx + idx]:
macro_api_match = True
break
elif "makeEvent" in moving_window[self.moving_window_center_idx + idx]:
break
else:
event_match = False
if event_match:
self.__handle_event_match(
event_match=event_match,
@ -155,6 +155,12 @@ class EventParser(FileParser):
severity = event_full_match.group(4)
if self.obsw_root_path is not None:
file_name = os.path.relpath(file_name, self.obsw_root_path)
if self.mib_table.get(full_id) is not None:
LOGGER.warning(f"Duplicate event ID {full_id} detected")
LOGGER.info(
f"Name: {self.mib_table.get(full_id)[0]}| "
f"Description: {self.mib_table.get(full_id)[2]}"
)
self.mib_table.update({full_id: (name, severity, description, file_name)})
self.count = self.count + 1