Skip to content

Commit

Permalink
Update logic to continue checking if one sm has issue
Browse files Browse the repository at this point in the history
Signed-off-by: hoangtungdinh <[email protected]>
  • Loading branch information
hoangtungdinh committed Sep 17, 2024
1 parent a03fc61 commit 9e978c1
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 92 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,39 +78,15 @@ def check_rule(checker_data: models.CheckerData) -> None:
state_machine = utils.get_state_machine(state_machine_procedure, nsmap)

if state_machine is None:
checker_data.result.set_checker_status(
checker_bundle_name=constants.BUNDLE_NAME,
checker_id=CHECKER_ID,
status=StatusType.SKIPPED,
)

checker_data.result.add_checker_summary(
constants.BUNDLE_NAME,
CHECKER_ID,
f"State machine not found. Skip the check.",
)

return
continue

smp_realisation = state_machine_procedure.xpath(
"./smp:realisation", namespaces=nsmap
)
logging.debug(f"smp_realisation: {smp_realisation}")

if smp_realisation is None or len(smp_realisation) != 1:
checker_data.result.set_checker_status(
checker_bundle_name=constants.BUNDLE_NAME,
checker_id=CHECKER_ID,
status=StatusType.SKIPPED,
)

checker_data.result.add_checker_summary(
constants.BUNDLE_NAME,
CHECKER_ID,
f"Invalid realisation found in state machine procedure. Skip the check.",
)

return
continue

smp_realisation = smp_realisation[0]

Expand Down
14 changes: 1 addition & 13 deletions qc_otx/checks/state_machine_checker/mandatory_target_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,19 +70,7 @@ def check_rule(checker_data: models.CheckerData) -> None:
state_machine = utils.get_state_machine(state_machine_procedure, nsmap)

if state_machine is None:
checker_data.result.set_checker_status(
checker_bundle_name=constants.BUNDLE_NAME,
checker_id=CHECKER_ID,
status=StatusType.SKIPPED,
)

checker_data.result.add_checker_summary(
constants.BUNDLE_NAME,
CHECKER_ID,
f"State machine not found. Skip the check.",
)

return
continue

for sm_state in state_machine.states:
has_issue = (
Expand Down
14 changes: 1 addition & 13 deletions qc_otx/checks/state_machine_checker/mandatory_transition.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,19 +72,7 @@ def check_rule(checker_data: models.CheckerData) -> None:
state_machine = utils.get_state_machine(state_machine_procedure, nsmap)

if state_machine is None:
checker_data.result.set_checker_status(
checker_bundle_name=constants.BUNDLE_NAME,
checker_id=CHECKER_ID,
status=StatusType.SKIPPED,
)

checker_data.result.add_checker_summary(
constants.BUNDLE_NAME,
CHECKER_ID,
f"State machine not found. Skip the check.",
)

return
continue

for sm_state in state_machine.states:
has_issue = not sm_state.is_completed and len(sm_state.transitions) == 0
Expand Down
15 changes: 1 addition & 14 deletions qc_otx/checks/state_machine_checker/mandatory_trigger.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,20 +72,7 @@ def check_rule(checker_data: models.CheckerData) -> None:
state_machine = utils.get_state_machine(state_machine_procedure, nsmap)

if state_machine is None:

checker_data.result.set_checker_status(
checker_bundle_name=constants.BUNDLE_NAME,
checker_id=CHECKER_ID,
status=StatusType.SKIPPED,
)

checker_data.result.add_checker_summary(
constants.BUNDLE_NAME,
CHECKER_ID,
f"State machine not found. Skip the check.",
)

return
continue

for sm_state in state_machine.states:
has_issue = not sm_state.is_completed and len(sm_state.triggers) == 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,19 +73,7 @@ def check_rule(checker_data: models.CheckerData) -> None:
state_machine = utils.get_state_machine(state_machine_procedure, nsmap)

if state_machine is None:
checker_data.result.set_checker_status(
checker_bundle_name=constants.BUNDLE_NAME,
checker_id=CHECKER_ID,
status=StatusType.SKIPPED,
)

checker_data.result.add_checker_summary(
constants.BUNDLE_NAME,
CHECKER_ID,
f"State machine not found. Skip the check.",
)

return
continue

completed_state = None
for sm_state in state_machine.states:
Expand All @@ -94,19 +82,7 @@ def check_rule(checker_data: models.CheckerData) -> None:
break

if completed_state is None:
checker_data.result.set_checker_status(
checker_bundle_name=constants.BUNDLE_NAME,
checker_id=CHECKER_ID,
status=StatusType.SKIPPED,
)

checker_data.result.add_checker_summary(
constants.BUNDLE_NAME,
CHECKER_ID,
f"Completed state not found. Skip the check.",
)

return
continue

has_issue = len(completed_state.target_state_ids) != 0
if has_issue:
Expand Down

0 comments on commit 9e978c1

Please sign in to comment.