Skip to content

Commit 04988b1

Browse files
committed
fix(core): 🐛 ensure skip_checks is defined before use
1 parent efcad8b commit 04988b1

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

rocrate_validator/models.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1671,10 +1671,20 @@ def __initialise__(cls, validation_settings: ValidationSettings):
16711671
if severity < severity_validation:
16721672
continue
16731673
# count the checks
1674-
requirement_checks = [_ for _ in requirement.get_checks_by_level(LevelCollection.get(severity.name))
1675-
if _.identifier not in validation_settings.skip_checks and
1676-
(not _.overridden or
1677-
_.requirement.profile.identifier == target_profile_identifier)]
1674+
requirement_checks = [
1675+
_
1676+
for _ in requirement.get_checks_by_level(
1677+
LevelCollection.get(severity.name)
1678+
)
1679+
if (
1680+
not validation_settings.skip_checks
1681+
or _.identifier not in validation_settings.skip_checks
1682+
)
1683+
and (
1684+
not _.overridden
1685+
or _.requirement.profile.identifier == target_profile_identifier
1686+
)
1687+
]
16781688
num_checks = len(requirement_checks)
16791689
requirement_checks_count += num_checks
16801690
if num_checks > 0:

rocrate_validator/requirements/shacl/checks.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,11 +200,12 @@ def __do_execute_check__(self, shacl_context: SHACLValidationContext):
200200
assert shape is not None, "Unable to map the violation to a shape"
201201
requirementCheck = SHACLCheck.get_instance(shape)
202202
assert requirementCheck is not None, "The requirement check cannot be None"
203-
if requirementCheck.identifier not in shacl_context.settings.skip_checks:
203+
if (not shacl_context.settings.skip_checks or
204+
requirementCheck.identifier not in shacl_context.settings.skip_checks):
204205
failed_requirements_checks.add(requirementCheck)
205206
violations = failed_requirements_checks_violations.get(requirementCheck.identifier, None)
206207
if violations is None:
207-
failed_requirements_checks_violations[requirementCheck.identifier] = violations = []
208+
failed_requirements_checks_violations[requirementCheck.identifier] = (violations := [])
208209
violations.append(violation)
209210
# sort the failed checks by identifier and severity
210211
# to ensure a consistent order of the issues

0 commit comments

Comments
 (0)