Skip to content

Commit

Permalink
Improve write_markdown_doc
Browse files Browse the repository at this point in the history
Signed-off-by: hoangtungdinh <11166240+hoangtungdinh@users.noreply.github.com>
  • Loading branch information
hoangtungdinh committed Aug 19, 2024
1 parent fba6e49 commit 521b976
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions qc_baselib/result.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,43 +106,49 @@ def write_markdown_doc(self, markdown_file_path: str) -> None:
"Report documentation dump with empty report, the report needs to be loaded first"
)

bundles_text = "# Checker bundles\n\n"
bundles_text = """
**_This is the automatically generated documentation.
The lists of checkers and addressed rules were exported from the
information registered in the Result object for a particular run.
Therefore, some checkers and addressed rules might be missing if
they are not registered in that particular run. Double check with
the implementation before using this generated documentation._**\n\n
"""

bundles_text += f"# Checker bundle: {bundle.name}\n\n"
for bundle in self._report_results.checker_bundles:
bundle_text = ""
bundle_text += f"## Checker bundle: **{bundle.name}**\n"
bundle_text += f"- Build date: {bundle.build_date}\n"
bundle_text += f"- Build version: {bundle.version}\n"
bundle_text += f"- Description: {bundle.description}\n"
bundle_text += f"- Summary: {bundle.summary}\n"

bundle_text += "\n"
bundle_text += f"### Parameters:\n"
bundle_text += f"## Parameters:\n\n"
param_text = ""
for param in bundle.params:
param_text += f"1. {param.name} = {param.value}\n"
param_text += f"* {param.name}: \n"

if len(param_text) == 0:
param_text += f"* None\n"

bundle_text += param_text

bundle_text += "\n"
bundle_text += f"### Checkers:\n"
bundle_text += f"## Checkers:\n"
checker_text = ""
for checker in bundle.checkers:
checker_text += "\n"
checker_text += f"#### Checker: {checker.checker_id}\n"
checker_text += f"* Description: {checker.description}\n"
checker_text += f"* Status: {checker.status.value if checker.status is not None else ''}\n"
checker_text += f"* Summary: {checker.summary}\n"

checker_text += f"+ Addressed rules:\n"
checker_text += f"* Addressed rules:\n"
rule_text = ""
for rule in checker.addressed_rule:
rule_text += f" 1. {rule.rule_uid}\n"
rule_text += f" * {rule.rule_uid}\n"

if len(rule_text) == 0:
rule_text += f" * None"
rule_text += f" * None"

checker_text += rule_text

Expand Down

0 comments on commit 521b976

Please sign in to comment.