File tree Expand file tree Collapse file tree 2 files changed +13
-7
lines changed Expand file tree Collapse file tree 2 files changed +13
-7
lines changed Original file line number Diff line number Diff line change 5
5
from __future__ import annotations
6
6
7
7
import logging
8
+ import sys
8
9
from pathlib import Path
9
10
10
11
from git .cmd import Git
11
12
from git .repo import Repo
12
13
14
+ if sys .version_info >= (3 , 8 ):
15
+ from typing import Literal
16
+ else :
17
+ from typing_extensions import Literal
18
+
13
19
PRIMER_DIRECTORY_PATH = Path ("tests" ) / ".pylint_primer_tests"
14
20
15
21
@@ -56,9 +62,10 @@ def __init__(
56
62
self .minimum_python = minimum_python
57
63
58
64
@property
59
- def pylintrc (self ) -> Path | None :
65
+ def pylintrc (self ) -> Path | Literal [ "" ] :
60
66
if self .pylintrc_relpath is None :
61
- return None
67
+ # Fall back to "" to ensure pylint's own pylintrc is not discovered
68
+ return ""
62
69
return self .clone_directory / self .pylintrc_relpath
63
70
64
71
@property
@@ -75,9 +82,8 @@ def paths_to_lint(self) -> list[str]:
75
82
@property
76
83
def pylint_args (self ) -> list [str ]:
77
84
options : list [str ] = []
78
- if self .pylintrc is not None :
79
- # There is an error if rcfile is given but does not exist
80
- options += [f"--rcfile={ self .pylintrc } " ]
85
+ # There is an error if rcfile is given but does not exist
86
+ options += [f"--rcfile={ self .pylintrc } " ]
81
87
return self .paths_to_lint + options + self .pylint_additional_args
82
88
83
89
def lazy_clone (self ) -> str : # pragma: no cover
Original file line number Diff line number Diff line change @@ -42,8 +42,8 @@ def test_package_to_lint_default_value() -> None:
42
42
branch = "main" ,
43
43
directories = ["src/flask" ], # Must work on Windows (src\\flask)
44
44
)
45
- assert package_to_lint .pylintrc is None
45
+ assert package_to_lint .pylintrc == ""
46
46
expected_path_to_lint = (
47
47
PRIMER_DIRECTORY_PATH / "pallets" / "flask" / "src" / "flask"
48
48
)
49
- assert package_to_lint .pylint_args == [str (expected_path_to_lint )]
49
+ assert package_to_lint .pylint_args == [str (expected_path_to_lint ), "--rcfile=" ]
You can’t perform that action at this time.
0 commit comments