Path 1: 3 calls (1.0)

Section (3)

LinterStats (3)

None (3)

1def report_raw_stats(
2    sect: Section,
3    stats: LinterStats,
4    old_stats: LinterStats | None,
5) -> None:
6    """Calculate percentage of code / doc / comment / empty."""
7    total_lines = stats.code_type_count["total"]
8    sect.insert(0, Paragraph([Text(f"{total_lines} lines have been analyzed\n")]))
9    lines = ["type", "number", "%", "previous", "difference"]
10    for node_type in ("code", "docstring", "comment", "empty"):
11        node_type = cast(Literal["code", "docstring", "comment", "empty"], node_type)
12        total = stats.code_type_count[node_type]
13        percent = float(total * 100) / total_lines if total_lines else None
14        old = old_stats.code_type_count[node_type] if old_stats else None
15        diff_str = diff_string(old, total) if old else None
16        lines += [
17            node_type,
18            str(total),
19            f"{percent:.2f}" if percent is not None else "NC",
20            str(old) if old else "NC",
21            diff_str if diff_str else "NC",
22        ]
23    sect.append(Table(children=lines, cols=5, rheaders=1))