Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add summary to result file #99

Merged
merged 1 commit into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions qc_opendrive/checks/basic/version_is_defined.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ def check_rule(checker_data: models.CheckerData) -> bool:
status=StatusType.SKIPPED,
)

checker_data.result.add_checker_summary(
constants.BUNDLE_NAME,
CHECKER_ID,
f"The xml file does not contains the 'header' tag.",
)

return True

# Check if 'header' has the attributes 'revMajor' and 'revMinor'
Expand Down
6 changes: 6 additions & 0 deletions qc_opendrive/checks/schema/valid_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,12 @@ def check_rule(checker_data: models.CheckerData) -> None:
status=StatusType.SKIPPED,
)

checker_data.result.add_checker_summary(
constants.BUNDLE_NAME,
CHECKER_ID,
f"Cannot find the schema file for ASAM OpenDrive version {schema_version}.",
)

return

xsd_file_path = str(
Expand Down
21 changes: 19 additions & 2 deletions qc_opendrive/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@ def execute_checker(
status=StatusType.SKIPPED,
)

checker_data.result.add_checker_summary(
constants.BUNDLE_NAME,
checker.CHECKER_ID,
"Preconditions are not satisfied. Skip the check.",
)

return

# Checker definition setting. If not satisfied then set status as SKIPPED and return
Expand All @@ -82,6 +88,12 @@ def execute_checker(
status=StatusType.SKIPPED,
)

checker_data.result.add_checker_summary(
constants.BUNDLE_NAME,
checker.CHECKER_ID,
f"Version {schema_version} is lower than definition setting {definition_setting}. Skip the check.",
)

return

# Execute checker
Expand All @@ -98,14 +110,18 @@ def execute_checker(
checker_id=checker.CHECKER_ID,
status=StatusType.COMPLETED,
)
except Exception:
except Exception as e:
# If any exception occurs during the check, set the status as ERROR
checker_data.result.set_checker_status(
checker_bundle_name=constants.BUNDLE_NAME,
checker_id=checker.CHECKER_ID,
status=StatusType.ERROR,
)

checker_data.result.add_checker_summary(
constants.BUNDLE_NAME, checker.CHECKER_ID, f"Error: {str(e)}."
)


def run_checks(config: Configuration, result: Result) -> None:
checker_data = models.CheckerData(
Expand Down Expand Up @@ -213,7 +229,8 @@ def main():
result.write_to_file(
config.get_checker_bundle_param(
checker_bundle_name=constants.BUNDLE_NAME, param_name="resultFile"
)
),
generate_summary=True,
)

if args.generate_markdown:
Expand Down