diff --git a/codechecker_common/skiplist_handler.py b/codechecker_common/skiplist_handler.py index 89ff34b884..2b120e270b 100644 --- a/codechecker_common/skiplist_handler.py +++ b/codechecker_common/skiplist_handler.py @@ -103,12 +103,6 @@ def should_skip(self, source): return sign == '-' return False - def __call__(self, source_file_path: str) -> bool: - """ - Check if the given source should be skipped. - """ - return self.should_skip(source_file_path) - class SkipListHandlers(list): def should_skip(self, file_path: str): """ @@ -116,11 +110,3 @@ def should_skip(self, file_path: str): handler. """ return any(handler.should_skip(file_path) for handler in self) - - # FIXME: eliminate this function and use should_skip instead of this. - # Do the same in the SkipListHandler class above. - def __call__(self, file_path: str) -> bool: - """ - Check if the given source should be skipped. - """ - return self.should_skip(file_path) diff --git a/tools/report-converter/codechecker_report_converter/report/__init__.py b/tools/report-converter/codechecker_report_converter/report/__init__.py index fc3512577b..cadea68fbc 100644 --- a/tools/report-converter/codechecker_report_converter/report/__init__.py +++ b/tools/report-converter/codechecker_report_converter/report/__init__.py @@ -14,7 +14,7 @@ import logging import os -from typing import Callable, Dict, List, Optional, Set +from typing import Callable, Dict, List, Optional, Protocol, Set from .. import util @@ -22,7 +22,8 @@ LOG = logging.getLogger('report-converter') -SkipListHandlers = Callable[[str], bool] +class SkipListHandlers(Protocol): + should_skip: Callable[[str], bool] InvalidFileContentMsg: str = \ @@ -473,7 +474,7 @@ def skip(self, skip_handlers: Optional[SkipListHandlers]) -> bool: if not skip_handlers: return False - return skip_handlers(self.file.original_path) + return skip_handlers.should_skip(self.file.original_path) def to_json(self) -> Dict: """ Creates a JSON dictionary. """