Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply more ruff rules #12980

Open
wants to merge 30 commits into
base: main
Choose a base branch
from
Open

Commits on Sep 28, 2024

  1. Disable ruff/pyupgrade rule UP027

    There's no evidence that generators are meaningfully faster
    than list comprehensions when combined with unpacking.
    DimitriPapadopoulos committed Sep 28, 2024
    Configuration menu
    Copy the full SHA
    e2b2cb9 View commit details
    Browse the repository at this point in the history

Commits on Oct 3, 2024

  1. Apply ruff/pyupgrade preview rule UP031

    UP031 Use format specifiers instead of percent format
    DimitriPapadopoulos committed Oct 3, 2024
    Configuration menu
    Copy the full SHA
    c3ec9fe View commit details
    Browse the repository at this point in the history
  2. Disable ruff/pyupgrade rule UP038

    Using `X | Y` in `isinstance` is slower and more verbose.
    DimitriPapadopoulos committed Oct 3, 2024
    Configuration menu
    Copy the full SHA
    03a459c View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    5d09fe9 View commit details
    Browse the repository at this point in the history
  4. Apply ruff rule RUF010

    RUF010 Use explicit conversion flag
    DimitriPapadopoulos committed Oct 3, 2024
    Configuration menu
    Copy the full SHA
    23aa730 View commit details
    Browse the repository at this point in the history
  5. Apply ruff rule RUF012

    RUF012 Mutable class attributes should be annotated with `typing.ClassVar`
    DimitriPapadopoulos committed Oct 3, 2024
    Configuration menu
    Copy the full SHA
    1a2e4a1 View commit details
    Browse the repository at this point in the history
  6. Apply ruff rule RUF019

    RUF019 Unnecessary key check before dictionary access
    DimitriPapadopoulos committed Oct 3, 2024
    Configuration menu
    Copy the full SHA
    ab5e818 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    445f23b View commit details
    Browse the repository at this point in the history
  8. Apply ruff/flake8-executable rule EXE002

    EXE002 The file is executable but no shebang is present
    DimitriPapadopoulos committed Oct 3, 2024
    Configuration menu
    Copy the full SHA
    119c012 View commit details
    Browse the repository at this point in the history
  9. Apply ruff/flake8-pie rule PIE810

    PIE810 Call `startswith` or `endswith` once with a `tuple`
    DimitriPapadopoulos committed Oct 3, 2024
    Configuration menu
    Copy the full SHA
    464b013 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    a99ce4f View commit details
    Browse the repository at this point in the history
  11. Apply ruff/flake8-pyi rule PYI032

    PYI032 Prefer `object` to `Any` for the second parameter to `__eq__`
    DimitriPapadopoulos committed Oct 3, 2024
    Configuration menu
    Copy the full SHA
    8c49d19 View commit details
    Browse the repository at this point in the history
  12. Apply ruff/flake8-pyi rule PYI036

    PYI036 The first argument in `__exit__` should be annotated with `object` or `type[BaseException] | None`
    PYI036 The second argument in `__exit__` should be annotated with `object` or `BaseException | None`
    PYI036 The third argument in `__exit__` should be annotated with `object` or `types.TracebackType | None`
    DimitriPapadopoulos committed Oct 3, 2024
    Configuration menu
    Copy the full SHA
    19c2957 View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    31eb8f3 View commit details
    Browse the repository at this point in the history
  14. Apply ruff/flake8-raise rule RSE102

    RSE102 Unnecessary parentheses on raised exception
    DimitriPapadopoulos committed Oct 3, 2024
    Configuration menu
    Copy the full SHA
    415c47c View commit details
    Browse the repository at this point in the history
  15. Apply ruff/flake8-return rule RET501

    RET501 Do not explicitly `return None` in function if it is the only possible return value
    DimitriPapadopoulos committed Oct 3, 2024
    Configuration menu
    Copy the full SHA
    787ff00 View commit details
    Browse the repository at this point in the history
  16. Apply ruff/flake8-return rule RET503

    RET503 Missing explicit `return` at the end of function able to return non-`None` value
    DimitriPapadopoulos committed Oct 3, 2024
    Configuration menu
    Copy the full SHA
    9d2ca1a View commit details
    Browse the repository at this point in the history
  17. Apply ruff/flake8-slots rule SLOT000

    SLOT000 Subclasses of `str` should define `__slots__`
    DimitriPapadopoulos committed Oct 3, 2024
    Configuration menu
    Copy the full SHA
    952aa73 View commit details
    Browse the repository at this point in the history
  18. Configuration menu
    Copy the full SHA
    1e855a0 View commit details
    Browse the repository at this point in the history
  19. Apply ruff/flake8-simplify rule SIM103

    SIM103 Return the (negated) condition directly
    DimitriPapadopoulos committed Oct 3, 2024
    Configuration menu
    Copy the full SHA
    6c9a8c5 View commit details
    Browse the repository at this point in the history
  20. Apply ruff/flake8-simplify rule SIM110

    SIM110 Use `return any(getattr(req, option, None) for req in reqs)` instead of `for` loop
    DimitriPapadopoulos committed Oct 3, 2024
    Configuration menu
    Copy the full SHA
    7adbec6 View commit details
    Browse the repository at this point in the history
  21. Apply ruff/flake8-simplify rule SIM118

    SIM118 Use `key in dict` instead of `key in dict.keys()`
    DimitriPapadopoulos committed Oct 3, 2024
    Configuration menu
    Copy the full SHA
    c60e20b View commit details
    Browse the repository at this point in the history
  22. Apply ruff/flake8-type-checking rule TCH001

    TCH001 Move application import `.base.Requirement` into a type-checking block
    DimitriPapadopoulos committed Oct 3, 2024
    Configuration menu
    Copy the full SHA
    5c354a6 View commit details
    Browse the repository at this point in the history
  23. Apply ruff/flake8-type-checking rule TCH002

    TCH002 Move third-party import `pip._vendor.resolvelib.structs.DirectedGraph` into a type-checking block
    DimitriPapadopoulos committed Oct 3, 2024
    Configuration menu
    Copy the full SHA
    d66831d View commit details
    Browse the repository at this point in the history
  24. Apply ruff/flake8-type-checking rule TCH003

    TCH003 Move standard library import `distutils.cmd.Command` into a type-checking block
    DimitriPapadopoulos committed Oct 3, 2024
    Configuration menu
    Copy the full SHA
    033dde8 View commit details
    Browse the repository at this point in the history
  25. Apply ruff/pygrep-hooks rule PGH003

    PGH003 Use specific rule codes when ignoring type issues
    DimitriPapadopoulos committed Oct 3, 2024
    Configuration menu
    Copy the full SHA
    b19669f View commit details
    Browse the repository at this point in the history
  26. Apply ruff/pygrep-hooks rule PGH004

    PGH004 Use specific rule codes when using `noqa`
    DimitriPapadopoulos committed Oct 3, 2024
    Configuration menu
    Copy the full SHA
    65833a9 View commit details
    Browse the repository at this point in the history
  27. Configuration menu
    Copy the full SHA
    27670e9 View commit details
    Browse the repository at this point in the history
  28. Apply ruff/flake8-comprehensions preview rule C419

    C419 Unnecessary list comprehension
    DimitriPapadopoulos committed Oct 3, 2024
    Configuration menu
    Copy the full SHA
    ae41609 View commit details
    Browse the repository at this point in the history
  29. Configuration menu
    Copy the full SHA
    0b45393 View commit details
    Browse the repository at this point in the history