diff options
author | Daniƫl van Noord <13665637+DanielNoord@users.noreply.github.com> | 2022-05-25 22:02:43 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-25 22:02:43 +0200 |
commit | 7761d78fb210fd80e3dbae481a4f1c6d653dde8e (patch) | |
tree | e5c4b23f4d4cc1e87419a3f0f104787290adeb3c /pylint/checkers/raw_metrics.py | |
parent | a283bc4b326ae26d25023db77efbf94c1aff834e (diff) | |
download | pylint-git-7761d78fb210fd80e3dbae481a4f1c6d653dde8e.tar.gz |
Add typing to various checkers (#6695)
Diffstat (limited to 'pylint/checkers/raw_metrics.py')
-rw-r--r-- | pylint/checkers/raw_metrics.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/pylint/checkers/raw_metrics.py b/pylint/checkers/raw_metrics.py index 08d50c48e..3469dc15e 100644 --- a/pylint/checkers/raw_metrics.py +++ b/pylint/checkers/raw_metrics.py @@ -9,7 +9,7 @@ import tokenize from typing import TYPE_CHECKING, Any, cast from pylint.checkers import BaseTokenChecker -from pylint.reporters.ureports.nodes import Table +from pylint.reporters.ureports.nodes import Paragraph, Section, Table, Text from pylint.utils import LinterStats, diff_string if sys.version_info >= (3, 8): @@ -22,13 +22,13 @@ if TYPE_CHECKING: def report_raw_stats( - sect, + sect: Section, stats: LinterStats, old_stats: LinterStats | None, ) -> None: """Calculate percentage of code / doc / comment / empty.""" total_lines = stats.code_type_count["total"] - sect.description = f"{total_lines} lines have been analyzed" + sect.insert(0, Paragraph([Text(f"{total_lines} lines have been analyzed\n")])) lines = ["type", "number", "%", "previous", "difference"] for node_type in ("code", "docstring", "comment", "empty"): node_type = cast(Literal["code", "docstring", "comment", "empty"], node_type) @@ -66,7 +66,7 @@ class RawMetricsChecker(BaseTokenChecker): # reports reports = (("RP0701", "Raw metrics", report_raw_stats),) - def open(self): + def open(self) -> None: """Init statistics.""" self.linter.stats.reset_code_count() |