Enable some Ruff FURB rules (#13310)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
This commit is contained in:
Avasam
2025-01-02 05:10:58 -05:00
committed by GitHub
parent 4ce9f24f39
commit 67568b5e19
2 changed files with 11 additions and 1 deletions

View File

@@ -49,6 +49,16 @@ select = [
"E", # pycodestyle Error
"F", # Pyflakes
"W", # pycodestyle Warning
# Most refurb rules are in preview and can be opinionated,
# consider them individually as they come out of preview (last check: 0.8.4)
"FURB105", # Unnecessary empty string passed to `print`
"FURB129", # Instead of calling `readlines()`, iterate over file object directly
"FURB136", # Replace `if` expression with `{min_max}` call
"FURB167", # Use of regular expression alias `re.{}`
"FURB168", # Prefer `is` operator over `isinstance` to check if an object is `None`
"FURB169", # Compare the identities of `{object}` and None instead of their respective types
"FURB177", # Prefer `Path.cwd()` over `Path().resolve()` for current-directory lookups
"FURB187", # Use of assignment of `reversed` on list `{name}`
# PYI: only enable rules that have autofixes and that we always want to fix (even manually),
# avoids duplicate # noqa with flake8-pyi and flake8-noqa flagging `PYI` codes
# See https://github.com/plinss/flake8-noqa/issues/22

View File

@@ -218,7 +218,7 @@ def main() -> None:
info = get_installed_package_info(project)
if info is None:
print(f'Error: "{project}" is not installed', file=sys.stderr)
print("", file=sys.stderr)
print(file=sys.stderr)
print(f'Suggestion: Run "python3 -m pip install {project}" and try again', file=sys.stderr)
sys.exit(1)
project, version = info