Skip to content

Commit 1198113

Browse files
[ruff] Add 'flake8-pathlib' disable the messages that need fixing later (#9602)
1 parent a232517 commit 1198113

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

pylint/config/config_initialization.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ def _config_initialization(
141141
linter._parse_error_mode()
142142

143143
# Link the base Namespace object on the current directory
144-
linter._directory_namespaces[Path(".").resolve()] = (linter.config, {})
144+
linter._directory_namespaces[Path().resolve()] = (linter.config, {})
145145

146146
# parsed_args_list should now only be a list of inputs to lint.
147147
# All other options have been removed from the list.

pyproject.toml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ select = [
152152
"F", # pyflakes
153153
"I", # isort
154154
"PIE", # flake8-pie
155+
"PTH", # flake8-pathlib
155156
"PYI", # flake8-pyi
156157
"UP", # pyupgrade
157158
"RUF", # ruff
@@ -171,6 +172,21 @@ ignore = [
171172
"D205", # 1 blank line required between summary line and description
172173
"D400", # First line should end with a period
173174
"D401", # First line of docstring should be in imperative mood
175+
"PTH100", # `os.path.abspath()` should be replaced by `Path.resolve()`
176+
"PTH103", # `os.makedirs()` should be replaced by `Path.mkdir(parents=True)`
177+
"PTH107", # `os.remove()` should be replaced by `Path.unlink()`
178+
"PTH108", # `os.unlink()` should be replaced by `Path.unlink()`
179+
"PTH109", # `os.getcwd()` should be replaced by `Path.cwd()`
180+
"PTH110", # `os.path.exists()` should be replaced by `Path.exists()`
181+
"PTH111", # `os.path.expanduser()` should be replaced by `Path.expanduser()`
182+
"PTH112", # `os.path.isdir()` should be replaced by `Path.is_dir()`
183+
"PTH113", # `os.path.isfile()` should be replaced by `Path.is_file()`
184+
"PTH118", # `os.path.join()` should be replaced by `Path` with `/` operator
185+
"PTH119", # `os.path.basename()` should be replaced by `Path.name`
186+
"PTH120", # `os.path.dirname()` should be replaced by `Path.parent`
187+
"PTH122", # `os.path.splitext()` should be replaced by `Path.suffix`, `Path.stem`, and `Path.parent`
188+
"PTH123", # `open()` should be replaced by `Path.open()`
189+
"PTH207", # Replace `glob` with `Path.glob` or `Path.rglob`
174190
"RUF012", # mutable default values in class attributes
175191
]
176192

script/create_contributor_list.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
from contributors_txt import create_contributors_txt
88

9-
CWD = Path(".").absolute()
9+
CWD = Path().absolute()
1010
BASE_DIRECTORY = Path(__file__).parent.parent.absolute()
1111
ALIASES_FILE = (BASE_DIRECTORY / "script/.contributors_aliases.json").relative_to(CWD)
1212
DEFAULT_CONTRIBUTOR_PATH = (BASE_DIRECTORY / "CONTRIBUTORS.txt").relative_to(CWD)

0 commit comments

Comments
 (0)