Skip to content

Commit

Permalink
Add xpath list to unique node rule (#10)
Browse files Browse the repository at this point in the history
Signed-off-by: romanodanilo <[email protected]>

Signed-off-by: romanodanilo <[email protected]>
  • Loading branch information
romanodanilo authored Jul 8, 2024
1 parent 81838c4 commit 1102f21
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
9 changes: 2 additions & 7 deletions qc_otx/checks/core_checker/unique_node_names.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,6 @@ def check_rule(checker_data: models.CheckerData) -> None:
if len(xpaths) <= 1:
continue

error_string = f"Duplicated name {name}"
for xpath in xpaths:
error_string += f" defined at {xpath}"

current_xpath = xpaths[0]
issue_id = checker_data.result.register_issue(
checker_bundle_name=constants.BUNDLE_NAME,
checker_id=core_constants.CHECKER_ID,
Expand All @@ -91,6 +86,6 @@ def check_rule(checker_data: models.CheckerData) -> None:
checker_bundle_name=constants.BUNDLE_NAME,
checker_id=core_constants.CHECKER_ID,
issue_id=issue_id,
xpath=current_xpath,
description=f"Procedure {procedure_name} at {current_xpath} contains duplicated name. {error_string}",
xpath=xpaths,
description=f"Procedure {procedure_name} contains duplicated name.",
)
6 changes: 3 additions & 3 deletions tests/test_core_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -603,9 +603,9 @@ def test_chk010_negative(
)
assert len(core_issues) == 3

assert "Duplicated name x" in core_issues[0].locations[0].description
assert "Duplicated name a" in core_issues[1].locations[0].description
assert "Duplicated name b" in core_issues[2].locations[0].description
assert "Procedure main" in core_issues[0].locations[0].description
assert "Procedure main" in core_issues[1].locations[0].description
assert "Procedure computeDelta" in core_issues[2].locations[0].description

assert core_issues[0].level == IssueSeverity.WARNING
assert core_issues[1].level == IssueSeverity.WARNING
Expand Down

0 comments on commit 1102f21

Please sign in to comment.