diff --git a/pylint/lint/pylinter.py b/pylint/lint/pylinter.py index 66455bfb109..2c9318713a9 100644 --- a/pylint/lint/pylinter.py +++ b/pylint/lint/pylinter.py @@ -14,7 +14,7 @@ import traceback import warnings from collections import defaultdict -from collections.abc import Callable, Iterator, Sequence +from collections.abc import Callable, Iterator, MutableSet, Sequence from io import TextIOWrapper from pathlib import Path from re import Pattern @@ -878,8 +878,12 @@ def _iterate_file_descrs( The returned generator yield one item for each Python module that should be linted. """ + seen_filepaths: MutableSet[str] = set() # For deduplication of paths. for descr in self._expand_files(files_or_modules): name, filepath, is_arg = descr["name"], descr["path"], descr["isarg"] + if filepath in seen_filepaths: + continue + seen_filepaths.add(filepath) if self.should_analyze_file(name, filepath, is_argument=is_arg): yield FileItem(name, filepath, descr["basename"])