diff options
author | Florian Bruhin <me@the-compiler.org> | 2021-03-10 22:33:59 +0100 |
---|---|---|
committer | Florian Bruhin <me@the-compiler.org> | 2021-03-10 22:33:59 +0100 |
commit | 6d26ba60ff27d3359f469e863e238e12dee3394d (patch) | |
tree | aff5ab5130b9c5e87dd562152c49b611612d5fb7 | |
parent | 3e5f13f56161caf89207c403c4683782023644a0 (diff) | |
download | qutebrowser-6d26ba60ff27d3359f469e863e238e12dee3394d.tar.gz qutebrowser-6d26ba60ff27d3359f469e863e238e12dee3394d.zip |
scripts: Add some additional checks for pathlib
-rw-r--r-- | scripts/dev/misc_checks.py | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/scripts/dev/misc_checks.py b/scripts/dev/misc_checks.py index 91baec926..3a93b05e1 100644 --- a/scripts/dev/misc_checks.py +++ b/scripts/dev/misc_checks.py @@ -247,7 +247,23 @@ def check_spelling(args: argparse.Namespace) -> Optional[bool]: ( re.compile(fr'qtbot\.(?!{qtbot_excludes})[a-z]+[A-Z].*'), "use snake-case instead", - ) + ), + ( + re.compile(r'\.joinpath\('), + "use the / operator for joining paths", + ), + ( + re.compile(r"""pathlib\.Path\(["']~["']\)\.expanduser\(\)"""), + "use pathlib.Path.home() instead", + ), + ( + re.compile(r'pathlib\.Path\(tmp_path\)'), + "tmp_path already is a pathlib.Path", + ), + ( + re.compile(r'pathlib\.Path\(tmpdir\)'), + "use tmp_path instead", + ), ] # Files which should be ignored, e.g. because they come from another |