Skip to content

Commit

Permalink
use a counter instead of tracking paths
Browse files Browse the repository at this point in the history
  • Loading branch information
purajit committed Jan 10, 2025
1 parent 027a3e2 commit f08024b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
8 changes: 3 additions & 5 deletions pylint/lint/pylinter.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,6 @@ def __init__(

# Attributes related to stats
self.stats = LinterStats()
self.skipped_paths: set[str] = set()

# Attributes related to (command-line) options and their parsing
self.options: Options = options + _make_linter_options(self)
Expand Down Expand Up @@ -852,7 +851,7 @@ def _get_file_descr_from_stdin(self, filepath: str) -> Iterator[FileItem]:
self.config.ignore_patterns,
self.config.ignore_paths,
):
self.skipped_paths.add(filepath)
self.stats.skipped += 1
return

try:
Expand All @@ -876,7 +875,7 @@ def _iterate_file_descrs(
for descr in self._expand_files(files_or_modules).values():
name, filepath, is_arg = descr["name"], descr["path"], descr["isarg"]
if descr["isignored"]:
self.skipped_paths.add(filepath)
self.stats.skipped += 1
elif self.should_analyze_file(name, filepath, is_argument=is_arg):
yield FileItem(name, filepath, descr["basename"])

Expand Down Expand Up @@ -1148,8 +1147,7 @@ def _report_evaluation(self, verbose: bool = False) -> int | None:

if verbose:
checked_files_count = self.stats.node_count["module"]
skipped_paths_count = len(self.skipped_paths)
msg += f"\nChecked {checked_files_count} files, skipped {skipped_paths_count} files/modules"
msg += f"\nChecked {checked_files_count} files, skipped {self.stats.skipped} files/modules"

if self.config.score:
sect = report_nodes.EvaluationSection(msg)
Expand Down
3 changes: 3 additions & 0 deletions pylint/utils/linterstats.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ def __init__(
self.refactor = 0
self.statement = 0
self.warning = 0
self.skipped = 0

self.global_note = 0
self.nb_duplicated_lines = 0
Expand All @@ -151,6 +152,7 @@ def __str__(self) -> str:
{self.refactor}
{self.statement}
{self.warning}
{self.skipped}
{self.global_note}
{self.nb_duplicated_lines}
{self.percent_duplicated_lines}"""
Expand Down Expand Up @@ -385,6 +387,7 @@ def merge_stats(stats: list[LinterStats]) -> LinterStats:
merged.refactor += stat.refactor
merged.statement += stat.statement
merged.warning += stat.warning
merged.skipped += stat.skipped

merged.global_note += stat.global_note
return merged

0 comments on commit f08024b

Please sign in to comment.