diff --git a/analyzer/codechecker_analyzer/analysis_manager.py b/analyzer/codechecker_analyzer/analysis_manager.py index a8f7f57cc6..7708d78ef5 100644 --- a/analyzer/codechecker_analyzer/analysis_manager.py +++ b/analyzer/codechecker_analyzer/analysis_manager.py @@ -724,6 +724,7 @@ def start_workers(actions_map, actions, analyzer_config_map, Start the workers in the process pool. For every build action there is worker which makes the analysis. """ + # pylint: disable=no-member multiprocess module members. # Handle SIGINT to stop this script running. def signal_handler(signum, frame): diff --git a/analyzer/codechecker_analyzer/analyzer.py b/analyzer/codechecker_analyzer/analyzer.py index cf4f008b12..81591280e2 100644 --- a/analyzer/codechecker_analyzer/analyzer.py +++ b/analyzer/codechecker_analyzer/analyzer.py @@ -136,6 +136,7 @@ def perform_analysis(args, skip_handlers, actions, metadata_tool, in the given analysis context for the supplied build actions. Additionally, insert statistical information into the metadata dict. """ + # pylint: disable=no-member multiprocess module members. context = analyzer_context.get_context() diff --git a/analyzer/codechecker_analyzer/cmd/analyze.py b/analyzer/codechecker_analyzer/cmd/analyze.py index a33e0d3ace..2d3873d6cd 100644 --- a/analyzer/codechecker_analyzer/cmd/analyze.py +++ b/analyzer/codechecker_analyzer/cmd/analyze.py @@ -169,6 +169,7 @@ def add_arguments_to_parser(parser): type=int, dest="jobs", required=False, + # pylint: disable=no-member default=multiprocess.cpu_count(), help="Number of threads to use in analysis. More " "threads mean faster analysis at the cost of " diff --git a/analyzer/codechecker_analyzer/cmd/check.py b/analyzer/codechecker_analyzer/cmd/check.py index 8318b33066..a10b111afe 100644 --- a/analyzer/codechecker_analyzer/cmd/check.py +++ b/analyzer/codechecker_analyzer/cmd/check.py @@ -183,6 +183,7 @@ def add_arguments_to_parser(parser): type=int, dest="jobs", required=False, + # pylint: disable=no-member default=multiprocess.cpu_count(), help="Number of threads to use in analysis. " "More threads mean faster analysis at " diff --git a/analyzer/codechecker_analyzer/pre_analysis_manager.py b/analyzer/codechecker_analyzer/pre_analysis_manager.py index b39d5bab94..41086cffe9 100644 --- a/analyzer/codechecker_analyzer/pre_analysis_manager.py +++ b/analyzer/codechecker_analyzer/pre_analysis_manager.py @@ -150,6 +150,7 @@ def run_pre_analysis(actions, clangsa_config, """ Run multiple pre analysis jobs before the actual analysis. """ + # pylint: disable=no-member multiprocess module members. LOG.info('Pre-analysis started.') if ctu_data: LOG.info("Collecting data for ctu analysis.") diff --git a/analyzer/requirements.txt b/analyzer/requirements.txt index 62fabe990a..7b5479f7d5 100644 --- a/analyzer/requirements.txt +++ b/analyzer/requirements.txt @@ -2,6 +2,6 @@ lxml==4.9.2 portalocker==2.2.1 psutil==5.8.0 PyYAML==6.0.1 +types-PyYAML==6.0.12.12 sarif-tools==1.0.0 -mypy_extensions==0.4.3 multiprocess==0.70.15 diff --git a/analyzer/requirements_py/dev/requirements.txt b/analyzer/requirements_py/dev/requirements.txt index 2093b9bd19..894b4c6fc7 100644 --- a/analyzer/requirements_py/dev/requirements.txt +++ b/analyzer/requirements_py/dev/requirements.txt @@ -1,11 +1,7 @@ -lxml==4.9.2 pytest==7.3.1 pycodestyle==2.7.0 -psutil==5.8.0 -portalocker==2.2.1 pylint==2.8.2 mkdocs==1.5.3 -PyYAML==6.0.1 -mypy_extensions==0.4.3 coverage==5.5.0 -sarif-tools==1.0.0 + +-r ../../requirements.txt diff --git a/analyzer/requirements_py/osx/requirements.txt b/analyzer/requirements_py/osx/requirements.txt index a9c756db0d..2189184c4d 100644 --- a/analyzer/requirements_py/osx/requirements.txt +++ b/analyzer/requirements_py/osx/requirements.txt @@ -1,6 +1,3 @@ -lxml==4.9.2 -portalocker==2.2.1 -psutil==5.8.0 scan-build==2.0.19 -PyYAML==6.0.1 -mypy_extensions==0.4.3 + +-r ../../requirements.txt diff --git a/codechecker_common/requirements_py/dev/requirements.txt b/codechecker_common/requirements_py/dev/requirements.txt index 8da0fc4a50..956e5466d2 100644 --- a/codechecker_common/requirements_py/dev/requirements.txt +++ b/codechecker_common/requirements_py/dev/requirements.txt @@ -1,5 +1,5 @@ portalocker==2.2.1 coverage==5.5.0 -mypy==0.812 -mypy_extensions==0.4.3 +mypy==1.7.1 PyYAML==6.0.1 +types-PyYAML==6.0.12.12 \ No newline at end of file diff --git a/codechecker_common/skiplist_handler.py b/codechecker_common/skiplist_handler.py index a4917b284c..86f3fe43ed 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): @@ -117,11 +111,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/bazel/requirements_py/dev/requirements.txt b/tools/bazel/requirements_py/dev/requirements.txt index 4b673440f5..a9f7c470cd 100644 --- a/tools/bazel/requirements_py/dev/requirements.txt +++ b/tools/bazel/requirements_py/dev/requirements.txt @@ -1,5 +1,4 @@ pytest==7.3.1 pycodestyle==2.7.0 pylint==2.8.2 -mypy==0.812 -mypy_extensions==0.4.3 +mypy==1.7.1 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. """ diff --git a/tools/report-converter/codechecker_report_converter/report/checker_labels.py b/tools/report-converter/codechecker_report_converter/report/checker_labels.py index ba27b46d80..f0b1fcf368 100644 --- a/tools/report-converter/codechecker_report_converter/report/checker_labels.py +++ b/tools/report-converter/codechecker_report_converter/report/checker_labels.py @@ -6,10 +6,10 @@ # # ------------------------------------------------------------------------- -from typing import Any, Callable, List, Optional, Union +from typing import Callable, List, Optional, Union class CheckerLabels: - severity: Callable[[Any, str], str] + severity: Callable[[str], str] label_of_checker: Callable[ - [Any, str, str, Optional[str]], Union[str, List[str]]] + [str, str, Optional[str]], Union[str, List[str]]] diff --git a/tools/report-converter/codechecker_report_converter/report/reports.py b/tools/report-converter/codechecker_report_converter/report/reports.py index 7ace456d9e..0eeff2f9e3 100644 --- a/tools/report-converter/codechecker_report_converter/report/reports.py +++ b/tools/report-converter/codechecker_report_converter/report/reports.py @@ -8,7 +8,7 @@ import logging -from typing import Any, Callable, Iterable, List, Optional, Set +from typing import Callable, Iterable, List, Optional, Set from codechecker_report_converter.report import Report, SkipListHandlers from codechecker_report_converter.report.hash import get_report_path_hash @@ -17,8 +17,8 @@ class GenericSuppressHandler: - get_suppressed: Callable[[Any, Report], bool] - store_suppress_bug_id: Callable[[Any, str, str, str, str], bool] + get_suppressed: Callable[[Report], bool] + store_suppress_bug_id: Callable[[str, str, str, str], bool] def get_mentioned_original_files(reports: List[Report]) -> Set[str]: diff --git a/tools/report-converter/requirements_py/dev/requirements.txt b/tools/report-converter/requirements_py/dev/requirements.txt index 50981f0c0f..15920d1699 100644 --- a/tools/report-converter/requirements_py/dev/requirements.txt +++ b/tools/report-converter/requirements_py/dev/requirements.txt @@ -3,5 +3,4 @@ sarif-tools==1.0.0 pycodestyle==2.7.0 pylint==2.8.2 portalocker==2.2.1 -mypy==0.812 -mypy_extensions==0.4.3 +mypy==1.7.1 diff --git a/tools/tu_collector/requirements_py/dev/requirements.txt b/tools/tu_collector/requirements_py/dev/requirements.txt index 4b673440f5..a9f7c470cd 100644 --- a/tools/tu_collector/requirements_py/dev/requirements.txt +++ b/tools/tu_collector/requirements_py/dev/requirements.txt @@ -1,5 +1,4 @@ pytest==7.3.1 pycodestyle==2.7.0 pylint==2.8.2 -mypy==0.812 -mypy_extensions==0.4.3 +mypy==1.7.1 diff --git a/web/requirements.txt b/web/requirements.txt index ed02ff4864..8a0c3c7f1f 100644 --- a/web/requirements.txt +++ b/web/requirements.txt @@ -3,11 +3,11 @@ sqlalchemy==1.3.23 alembic==1.5.5 portalocker==2.2.1 psutil==5.8.0 -mypy_extensions==0.4.3 multiprocess==0.70.15 thrift==0.13.0 gitpython==3.1.37 PyYAML==6.0.1 +types-PyYAML==6.0.12.12 sarif-tools==1.0.0 ./api/py/codechecker_api/dist/codechecker_api.tar.gz diff --git a/web/requirements_py/dev/requirements.txt b/web/requirements_py/dev/requirements.txt index 9c1029d4fd..f177a0589c 100644 --- a/web/requirements_py/dev/requirements.txt +++ b/web/requirements_py/dev/requirements.txt @@ -1,22 +1,12 @@ -lxml==4.9.2 -sqlalchemy==1.3.23 pycodestyle==2.7.0 -alembic==1.5.5 psycopg2-binary==2.8.6 pg8000==1.15.2 -psutil==5.8.0 -portalocker==2.2.1 pylint==2.8.2 pytest==7.3.1 mkdocs==1.5.3 -mypy_extensions==0.4.3 coverage==5.5.0 -thrift==0.13.0 -gitpython==3.1.37 -sarif-tools==1.0.0 -./api/py/codechecker_api/dist/codechecker_api.tar.gz -./api/py/codechecker_api_shared/dist/codechecker_api_shared.tar.gz +-r ../../requirements.txt # publish packages to pypi twine diff --git a/web/requirements_py/osx/requirements.txt b/web/requirements_py/osx/requirements.txt index 24f05869c5..522360ea46 100644 --- a/web/requirements_py/osx/requirements.txt +++ b/web/requirements_py/osx/requirements.txt @@ -1,10 +1 @@ -lxml==4.9.2 -alembic==1.5.5 -portalocker==2.2.1 -psutil==5.8.0 -sqlalchemy==1.3.23 -mypy_extensions==0.4.3 -thrift==0.13.0 - -./api/py/codechecker_api/dist/codechecker_api.tar.gz -./api/py/codechecker_api_shared/dist/codechecker_api_shared.tar.gz +-r ../../requirements.txt diff --git a/web/server/codechecker_server/server.py b/web/server/codechecker_server/server.py index 0600b422da..7dd218c683 100644 --- a/web/server/codechecker_server/server.py +++ b/web/server/codechecker_server/server.py @@ -27,7 +27,7 @@ from http.server import HTTPServer, BaseHTTPRequestHandler, \ SimpleHTTPRequestHandler -from multiprocess import Process +import multiprocess from sqlalchemy.orm import sessionmaker from sqlalchemy.sql.expression import func @@ -1116,7 +1116,8 @@ def unregister_handler(pid): atexit.register(unregister_handler, os.getpid()) for _ in range(manager.worker_processes - 1): - p = Process(target=http_server.serve_forever) + # pylint: disable=no-member multiprocess module members. + p = multiprocess.Process(target=http_server.serve_forever) processes.append(p) p.start() diff --git a/web/tests/functional/authentication/__init__.py b/web/tests/functional/authentication/__init__.py index 13647e772c..abc73ca6bb 100644 --- a/web/tests/functional/authentication/__init__.py +++ b/web/tests/functional/authentication/__init__.py @@ -17,6 +17,7 @@ from libtest import env import multiprocess +# pylint: disable=no-member multiprocess module members. # Stopping event for CodeChecker server. __STOP_SERVER = multiprocess.Event() diff --git a/web/tests/functional/cli_config/test_server_config.py b/web/tests/functional/cli_config/test_server_config.py index 4698c3ac58..e69568cf3e 100644 --- a/web/tests/functional/cli_config/test_server_config.py +++ b/web/tests/functional/cli_config/test_server_config.py @@ -24,6 +24,7 @@ class TestServerConfig(unittest.TestCase): + # pylint: disable=no-member multiprocess module members. _ccClient = None def setup_class(self): diff --git a/web/tests/functional/db_cleanup/test_db_cleanup.py b/web/tests/functional/db_cleanup/test_db_cleanup.py index 2a1db89a8e..a8adb6477f 100644 --- a/web/tests/functional/db_cleanup/test_db_cleanup.py +++ b/web/tests/functional/db_cleanup/test_db_cleanup.py @@ -187,6 +187,7 @@ def __check_serverity_of_reports(self, run_name): severity_id) def test_garbage_file_collection(self): + # pylint: disable=no-member multiprocess module members. event = multiprocess.Event() event.clear() diff --git a/web/tests/functional/instance_manager/test_instances.py b/web/tests/functional/instance_manager/test_instances.py index fe93ed6b80..f57df2ec5f 100644 --- a/web/tests/functional/instance_manager/test_instances.py +++ b/web/tests/functional/instance_manager/test_instances.py @@ -23,6 +23,7 @@ from libtest.codechecker import start_server import multiprocess +# pylint: disable=no-member multiprocess module members. # Stopping events for CodeChecker servers. EVENT_1 = multiprocess.Event() EVENT_2 = multiprocess.Event() diff --git a/web/tests/functional/products/test_config_db_share.py b/web/tests/functional/products/test_config_db_share.py index 79914e13b6..4468b59385 100644 --- a/web/tests/functional/products/test_config_db_share.py +++ b/web/tests/functional/products/test_config_db_share.py @@ -31,6 +31,7 @@ from libtest import env import multiprocess +# pylint: disable=no-member multiprocess module members. # Stopping events for CodeChecker server. EVENT = multiprocess.Event() diff --git a/web/tests/functional/ssl/test_ssl.py b/web/tests/functional/ssl/test_ssl.py index 88f2cfe5bf..22c6c96d6e 100644 --- a/web/tests/functional/ssl/test_ssl.py +++ b/web/tests/functional/ssl/test_ssl.py @@ -32,6 +32,7 @@ def setup_class(self): # Stopping event for CodeChecker server. global __STOP_SERVER + # pylint: disable=no-member multiprocess module members. __STOP_SERVER = multiprocess.Event() global TEST_WORKSPACE diff --git a/web/tests/functional/storage_of_analysis_statistics/test_storage_of_analysis_statistics.py b/web/tests/functional/storage_of_analysis_statistics/test_storage_of_analysis_statistics.py index 913ba6ec8a..e87d6ce9bc 100644 --- a/web/tests/functional/storage_of_analysis_statistics/test_storage_of_analysis_statistics.py +++ b/web/tests/functional/storage_of_analysis_statistics/test_storage_of_analysis_statistics.py @@ -48,6 +48,7 @@ def setup_class(self): # Stopping event for CodeChecker server. global EVENT_1 + # pylint: disable=no-member multiprocess module members. EVENT_1 = multiprocess.Event() global TEST_WORKSPACE diff --git a/web/tests/libtest/codechecker.py b/web/tests/libtest/codechecker.py index 9d3c2dc4b8..3cf31375ab 100644 --- a/web/tests/libtest/codechecker.py +++ b/web/tests/libtest/codechecker.py @@ -700,6 +700,7 @@ def start_server_proc(event, server_cmd, checking_env): pg_config, server_args or []) + # pylint: disable=no-member multiprocess module members. server_proc = multiprocess.Process( name='server', target=start_server_proc,