Skip to content

Commit 539004a

Browse files
add revewdog
Signed-off-by: Bernhard Kaindl <[email protected]>
1 parent 84d5e8b commit 539004a

File tree

8 files changed

+97
-214
lines changed

8 files changed

+97
-214
lines changed

.coveragerc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,5 @@ exclude_lines =
2828
precision = 1
2929
include =
3030
xcp/*
31+
omit =
32+
xcp/dmv.py

.github/workflows/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ jobs:
3636
- uses: pre-commit-ci/[email protected]
3737
if: always()
3838

39+
3940
test:
4041
needs: pre-commit
4142
strategy:
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Reviewdog PR Review comments
2+
3+
#
4+
# The reviewdog steps use reporter: github-pr-review, which submits the results
5+
# as a review comment on the pull request. It needs a GitHub token with
6+
# public_repo scope to post the comments and can only be used in the context
7+
# of a pull request.
8+
#
9+
on: pull_request
10+
11+
#
12+
# Checks can be skipped by adding "skip-checks: true" to a commit message,
13+
# or requested by adding "request-checks: true" if disabled by default for pushes:
14+
# https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/collaborating-on-repositories-with-code-quality-features/about-status-checks#skipping-and-requesting-checks-for-individual-commits
15+
#
16+
17+
concurrency: # On new workflow, cancel old workflows from the same PR, branch or tag:
18+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
19+
cancel-in-progress: true
20+
21+
jobs:
22+
reviewdog:
23+
runs-on: ubuntu-24.04
24+
env:
25+
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.REVIEWDOG_GITHUB_API_TOKEN }}
26+
steps:
27+
- uses: actions/checkout@v4
28+
- uses: actions/setup-python@v5
29+
with:
30+
python-version: 3.13
31+
32+
- name: Install uv and activate the environment
33+
uses: astral-sh/setup-uv@v6
34+
with:
35+
activate-environment: true
36+
37+
- run: uv pip install pylint types-setuptools -r pyproject.toml --extra mypy
38+
39+
- uses: tsuyoshicho/action-mypy@v4
40+
name: Run mypy with reviewdog to submit GitHub checks for warnings
41+
if: ${{ github.actor != 'nektos/act' }}
42+
with:
43+
install_types: false
44+
mypy_flags: --exclude python-libs-*/stubs/
45+
reporter: github-pr-review
46+
level: warning
47+
github_token: ${{ secrets.REVIEWDOG_GITHUB_API_TOKEN }}
48+
49+
- uses: dciborow/[email protected]
50+
name: Run pylint with reviewdog to submit GitHub checks for warnings
51+
if: ${{ github.actor != 'nektos/act' }}
52+
with:
53+
reporter: github-pr-review
54+
glob_pattern: "xcp tests"
55+
github_token: ${{ secrets.REVIEWDOG_GITHUB_API_TOKEN }}

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ repos:
101101
name: pytest unit tests and static analysis using tox
102102
types: [python]
103103
# entry: sh -c "pytest -x -rf --new-first --show-capture=all >/dev/tty"
104-
entry: sh -c "tox >/dev/tty"
104+
entry: sh -c "tox -e py311-cov-check-pytype-pyright-lint-mdreport >/dev/tty"
105105
verbose: true
106106
language: python
107107
require_serial: true

stubs/parameterized/__init__.pyi

Lines changed: 0 additions & 1 deletion
This file was deleted.

stubs/parameterized/parameterized.pyi

Lines changed: 0 additions & 76 deletions
This file was deleted.

stubs/parameterized/test.pyi

Lines changed: 0 additions & 100 deletions
This file was deleted.

xcp/dmv.py

Lines changed: 38 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,14 @@
2121
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
2222
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2323

24-
import os
25-
import subprocess
24+
import errno
25+
import glob
2626
import json
27+
import os
2728
import re
2829
import struct
29-
import glob
30-
import errno
30+
import subprocess
31+
from typing import Any, Dict
3132

3233
from .compat import open_with_codec_handling
3334

@@ -91,37 +92,36 @@ def id_matches(id1, id2):
9192
return True
9293
return id1 == id2
9394

94-
'''
95-
driver_pci_ids example:
96-
{
97-
"abc.ko": [
98-
{
99-
"vendor_id": "14e4",
100-
"device_id": "163c",
101-
"subvendor_id": "*",
102-
"subdevice_id": "*"
103-
},
104-
{
105-
"vendor_id": "14e4",
106-
"device_id": "163b",
107-
"subvendor_id": "*",
108-
"subdevice_id": "*"
109-
}],
110-
"de.ko": [
111-
{
112-
"vendor_id": "eees",
113-
"device_id": "163c",
114-
"subvendor_id": "*",
115-
"subdevice_id": "*"
116-
},
117-
{
118-
"vendor_id": "14f4",
119-
"device_id": "16db",
120-
"subvendor_id": "2123",
121-
"subdevice_id": "1123"
122-
}]
123-
}
124-
'''
95+
96+
# driver_pci_ids example:
97+
# {
98+
# "abc.ko": [
99+
# {
100+
# "vendor_id": "14e4",
101+
# "device_id": "163c",
102+
# "subvendor_id": "*",
103+
# "subdevice_id": "*"
104+
# },
105+
# {
106+
# "vendor_id": "14e4",
107+
# "device_id": "163b",
108+
# "subvendor_id": "*",
109+
# "subdevice_id": "*"
110+
# }],
111+
# "de.ko": [
112+
# {
113+
# "vendor_id": "eees",
114+
# "device_id": "163c",
115+
# "subvendor_id": "*",
116+
# "subdevice_id": "*"
117+
# },
118+
# {
119+
# "vendor_id": "14f4",
120+
# "device_id": "16db",
121+
# "subvendor_id": "2123",
122+
# "subdevice_id": "1123"
123+
# }]
124+
# }
125125
def pci_matches(present_pci_id, driver_pci_ids):
126126
"""Check if present PCI ID matches any of the driver PCI IDs."""
127127
merged_driver_pci_id_list = []
@@ -236,6 +236,8 @@ def parse_dmv_info(self, fpath):
236236
return json_data, json_formatted
237237

238238
class DriverMultiVersionManager(object):
239+
dmv_list = {} # type: Dict[str, Any]
240+
239241
def __init__(self, runtime=False):
240242
self.runtime = runtime
241243
self.dmv_list = {
@@ -296,7 +298,7 @@ def parse_dmv_list(self):
296298
for _, updates_dir, dmv_dir in get_all_kabi_dirs():
297299
if not os.path.isdir(dmv_dir):
298300
continue
299-
301+
300302
for path, _, files in os.walk(dmv_dir):
301303
if "info.json" not in files:
302304
continue

0 commit comments

Comments
 (0)