Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 17 additions & 19 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,23 @@ jobs:
- name: Run pycodestyle & pylint
run: make -k pycodestyle pylint

type-checker:
name: Type checker (mypy)

runs-on: ubuntu-24.04

steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v4
with:
python-version: '3.12'
- name: Create venv-dev
run: |
make venv_dev
- name: Run mypy
run: |
make mypy

tools:
name: Tools (report-converter, etc.)
runs-on: ubuntu-24.04
Expand Down Expand Up @@ -109,25 +126,6 @@ jobs:
working-directory: analyzer
run: make test_unit_cov

common:
name: Common libraries
runs-on: ubuntu-24.04

steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v4
with:
python-version: '3.9'

- name: Install requirements
working-directory: codechecker_common
run: |
pip install -r requirements_py/dev/requirements.txt

- name: Run mypy tests
working-directory: codechecker_common/tests
run: make mypy

web:
name: Web
runs-on: ubuntu-24.04
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,9 @@ pycodestyle:
pycodestyle_in_env:
$(ACTIVATE_DEV_VENV) && $(PYCODE_CMD)

mypy:
$(ACTIVATE_DEV_VENV) && mypy --config-file pyproject.toml

test: test_analyzer test_web

test_in_env: test_analyzer_in_env test_web_in_env
Expand Down
22 changes: 12 additions & 10 deletions codechecker_common/compatibility/multiprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,20 @@
# pylint: disable=no-name-in-module
# pylint: disable=unused-import
if sys.platform in ["darwin", "win32"]:
from multiprocess import \
Pipe, Pool, Process, \
Queue, \
Value, \
from multiprocess import ( # type: ignore
Pipe, Pool, Process,
Queue,
Value,
cpu_count
from multiprocess.managers import SyncManager
)
from multiprocess.managers import SyncManager # type: ignore
else:
from concurrent.futures import ProcessPoolExecutor as Pool
from multiprocessing import \
Pipe, \
Process, \
Queue, \
Value, \
from multiprocessing import (
Pipe,
Process,
Queue,
Value,
cpu_count
)
from multiprocessing.managers import SyncManager
2 changes: 1 addition & 1 deletion codechecker_common/requirements_py/dev/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
portalocker~=3.0
coverage<=5.5.0
mypy<=1.7.1
mypy~=1.19.0
PyYAML~=6.0
types-PyYAML~=6.0
setuptools~=80.0
8 changes: 4 additions & 4 deletions codechecker_common/review_status_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ def __report_matches_rule(self, report: Report, rule: dict):
report.checker_name != rule['filters']['checker_name']:
return False

if 'report_hash' in rule['filters'] and not \
if 'report_hash' in rule['filters'] and report.report_hash and not \
report.report_hash.startswith(rule['filters']['report_hash']):
return False

Expand All @@ -211,7 +211,7 @@ def get_review_status(self, report: Report) -> SourceReviewStatus:
return review_status

# 3. Return "unreviewed" otherwise.
return SourceReviewStatus(bug_hash=report.report_hash)
return SourceReviewStatus(bug_hash=report.report_hash or "")

def set_review_status_config(self, config_file):
"""
Expand Down Expand Up @@ -289,7 +289,7 @@ def get_review_status_from_config(
message=rule['actions']['reason']
.encode(encoding='utf-8', errors='ignore')
if 'reason' in rule['actions'] else b'',
bug_hash=report.report_hash,
bug_hash=report.report_hash or "",
in_source=True)

return None
Expand Down Expand Up @@ -343,7 +343,7 @@ def get_review_status_from_source(
return SourceReviewStatus(
status=status,
message=message.encode('utf-8'),
bug_hash=report.report_hash,
bug_hash=report.report_hash or "",
in_source=True)

if len(src_comment_data) > 1:
Expand Down
13 changes: 0 additions & 13 deletions codechecker_common/tests/Makefile

This file was deleted.

13 changes: 13 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[tool.mypy]
verbosity = 1
show_error_codes = true

files = [
"codechecker_common/"
]

mypy_path = [
"analyzer/",
"web/",
"tools/report-converter/"
]
1 change: 1 addition & 0 deletions web/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ sqlalchemy~=2.0
alembic~=1.5
portalocker~=3.0
psutil~=7.0
types-psutil~=7.0
multiprocess~=0.70
thrift~=0.22
gitpython~=3.0
Expand Down