Skip to content

Commit cd03486

Browse files
committed
docs(core): 💡 improve code documentation with additional comments
1 parent c8ad7b9 commit cd03486

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

rocrate_validator/models.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1016,26 +1016,32 @@ def _do_validate_(self, context: ValidationContext) -> bool:
10161016
logger.debug("Skipping check '%s' because overridden by '%r'",
10171017
check.identifier, [_.identifier for _ in check.overridden_by])
10181018
continue
1019+
# Determine whether to skip event notification for inherited profiles
10191020
skip_event_notify = False
10201021
if check.requirement.profile.identifier != context.profile_identifier and \
10211022
context.settings.disable_inherited_profiles_issue_reporting:
10221023
logger.debug("Inherited profiles reporting disabled. "
10231024
"Skipping requirement %s as it belongs to an inherited profile %s",
10241025
check.requirement.identifier, check.requirement.profile.identifier)
10251026
skip_event_notify = True
1027+
# Notify the start of the check execution if not skip_event_notify is set to True
10261028
if not skip_event_notify:
10271029
context.validator.notify(RequirementCheckValidationEvent(
10281030
EventType.REQUIREMENT_CHECK_VALIDATION_START, check))
1031+
# Execute the check
10291032
check_result = check.execute_check(context)
10301033
logger.debug("Result of check %s: %s", check.identifier, check_result)
10311034
context.result._add_executed_check(check, check_result)
1035+
# Notify the end of the check execution if not skip_event_notify is set to True
10321036
if not skip_event_notify:
10331037
context.validator.notify(RequirementCheckValidationEvent(
10341038
EventType.REQUIREMENT_CHECK_VALIDATION_END, check, validation_result=check_result))
10351039
logger.debug("Ran check '%s'. Got result %s", check.identifier, check_result)
1040+
# Ensure the check result is a boolean
10361041
if not isinstance(check_result, bool):
10371042
logger.warning("Ignoring the check %s as it returned the value %r instead of a boolean", check.name)
10381043
raise RuntimeError(f"Ignoring invalid result from check {check.name}")
1044+
# Aggregate the check result
10391045
all_passed = all_passed and check_result
10401046
if not all_passed and context.fail_fast:
10411047
break

0 commit comments

Comments
 (0)