INNER CODE UNIT · Python
format_result
nf-core/tools · nf_core/components/lint/__init__.py:265
def format_result(test_results: list[LintResult], table: Table) -> Table:
"""
Given a LintResult object, return a nicely formatted
string for the terminal with appropriate ASCII colours.
"""
# TODO: Row styles don't work current as table-level style overrides.
# Leaving it here in case there is a future fix
last_modname = ""
even_row = False
for lint_result in test_results:
if last_modname and lint_result.component_name != last_modname:
even_row = not even_row
last_modname = lint_result.component_name
# If this is an nf-core module, link to the nf-core webpage
if lint_result.component.repo_url == "https://github.com/nf-core/modules.git":
module_url = "https://nf-co.re/modules/" + lint_result.component_name.replace("/", "_")
module_name = f"[link={module_url}]{lint_result.component_name}[/link]"