Skip to content

Commit cf3ff20

Browse files
committed
chore: enable pyright checks
Changed the CI to install py-gitguardian in a virtualenv, because that is what our pyright pre-commit config expects.
1 parent a33136a commit cf3ff20

File tree

4 files changed

+15
-28
lines changed

4 files changed

+15
-28
lines changed

.github/workflows/test-lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
run: |
2626
python -m pip install --upgrade pip
2727
python -m pip install --upgrade pipenv==2022.10.4 pre-commit
28-
pipenv install --system --skip-lock
28+
pipenv install --dev --skip-lock
2929
3030
- uses: actions/cache@v3
3131
with:

.pre-commit-config.yaml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,17 @@ repos:
1212
hooks:
1313
- id: flake8
1414

15-
- repo: https://github.com/pre-commit/mirrors-mypy
16-
rev: v0.961
17-
hooks:
18-
- id: mypy
19-
additional_dependencies: [types-requests]
15+
# use a "local" repo and not the pyright hook to ensure pyright runs in the same virtualenv
16+
# as the rest of the code
17+
- repo: local
18+
hooks:
19+
- id: pyright
20+
name: pyright
21+
entry: 'pipenv run pyright'
22+
language: system
23+
types: [python]
24+
# do not pass filenames, otherwise Pyright might scan files we don't want it to scan
25+
pass_filenames: false
2026

2127
- repo: https://github.com/pre-commit/pre-commit-hooks
2228
rev: v4.3.0

Pipfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ pre-commit = "*"
1616
pytest = "*"
1717
vcrpy = ">=4.3.0,!=4.3.1,<4.4.0" # v4.3.1 broke decode_compressed_response
1818
urllib3 = "<2" # pin until https://github.com/kevin1024/vcrpy/issues/688 is fixed
19-
mypy = "==0.961"
20-
types-requests = "*"
2119
scriv = { version = "*", extras = ["toml"] }
2220
responses = ">=0.23.1,<0.24.0"
21+
pyright = "==1.1.313"

pyproject.toml

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,8 @@ line-length = 88
66
profile = "black"
77
lines_after_imports = 2
88

9-
[tool.mypy]
10-
python_version = "3.9"
11-
warn_return_any = true
12-
check_untyped_defs = true
13-
disallow_incomplete_defs = true
14-
disallow_untyped_defs = true
15-
follow_imports = "silent"
16-
ignore_missing_imports = true
17-
no_implicit_optional = true
18-
strict_equality = true
19-
strict_optional = true
20-
warn_incomplete_stub = true
21-
warn_redundant_casts = true
22-
warn_unreachable = true
23-
warn_unused_configs = true
24-
warn_unused_ignores = true
25-
26-
[[tool.mypy.overrides]]
27-
module = ["tests.*", "examples.*"]
28-
ignore_errors = true
9+
[tool.pyright]
10+
include = ["pygitguardian"]
2911

3012
[tool.scriv]
3113
version = "literal: pygitguardian/__init__.py: __version__"

0 commit comments

Comments
 (0)