From 0687d5caf7a57ebf9c82126e92a3c223d724f5b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20Noord?= <13665637+DanielNoord@users.noreply.github.com> Date: Tue, 14 Sep 2021 23:03:02 +0200 Subject: [PATCH] Change lines to lists (#5009) --- pylint/checkers/base.py | 6 +++--- pylint/checkers/raw_metrics.py | 4 ++-- pylint/lint/report_functions.py | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pylint/checkers/base.py b/pylint/checkers/base.py index 2ca79453a79..d839d921e19 100644 --- a/pylint/checkers/base.py +++ b/pylint/checkers/base.py @@ -412,7 +412,7 @@ def report_by_type_stats(sect, stats, old_stats): nice_stats[node_type]["percent_badname"] = f"{percent:.2f}" except KeyError: nice_stats[node_type]["percent_badname"] = "NC" - lines = ("type", "number", "old number", "difference", "%documented", "%badname") + lines = ["type", "number", "old number", "difference", "%documented", "%badname"] for node_type in ("module", "class", "method", "function"): new = stats[node_type] old = old_stats.get(node_type, None) @@ -420,14 +420,14 @@ def report_by_type_stats(sect, stats, old_stats): diff_str = lint_utils.diff_string(old, new) else: old, diff_str = "NC", "NC" - lines += ( + lines += [ node_type, str(new), str(old), diff_str, nice_stats[node_type].get("percent_documented", "0"), nice_stats[node_type].get("percent_badname", "0"), - ) + ] sect.append(reporter_nodes.Table(children=lines, cols=6, rheaders=1)) diff --git a/pylint/checkers/raw_metrics.py b/pylint/checkers/raw_metrics.py index eb3f717ff16..028c68e7aba 100644 --- a/pylint/checkers/raw_metrics.py +++ b/pylint/checkers/raw_metrics.py @@ -30,7 +30,7 @@ def report_raw_stats(sect, stats, old_stats): if not total_lines: raise EmptyReportError() sect.description = f"{total_lines} lines have been analyzed" - lines = ("type", "number", "%", "previous", "difference") + lines = ["type", "number", "%", "previous", "difference"] for node_type in ("code", "docstring", "comment", "empty"): key = node_type + "_lines" total = stats[key] @@ -40,7 +40,7 @@ def report_raw_stats(sect, stats, old_stats): diff_str = diff_string(old, total) else: old, diff_str = "NC", "NC" - lines += (node_type, str(total), f"{percent:.2f}", str(old), diff_str) + lines += [node_type, str(total), f"{percent:.2f}", str(old), diff_str] sect.append(Table(children=lines, cols=5, rheaders=1)) diff --git a/pylint/lint/report_functions.py b/pylint/lint/report_functions.py index fd316c611f7..21cb3b8245d 100644 --- a/pylint/lint/report_functions.py +++ b/pylint/lint/report_functions.py @@ -27,9 +27,9 @@ def report_messages_stats(sect, stats, _): if not msg_id.startswith("I") ) in_order.reverse() - lines = ("message id", "occurrences") + lines = ["message id", "occurrences"] for value, msg_id in in_order: - lines += (msg_id, str(value)) + lines += [msg_id, str(value)] sect.append(report_nodes.Table(children=lines, cols=2, rheaders=1))