Skip to content

Enable flake8-comprehension checks for better / faster code #2424

@Skylion007

Description

@Skylion007

Is your feature request related to a problem? Please describe.
Enable flake8-comprehensions which is particularly trivial since the ruff linter was recently installed. It removes useless or inefficient Python comprehensions which should marginally improve performance and improve readability.

Describe the solution you'd like
Enable ruff flake-comprehensions

Describe alternatives you've considered
Keep them disabled by default.

Additional context
I've recently enabled these checks fully in PyTorch, Sympy, and submitted a request to diffusers. After some bugfixes merged to ruff upstream, I haven't had any issues with the automatically reformatted code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    staleIssues that haven't received updates

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions