Go to file
Timmy Welch 1ce8864a60 Initial commit 2024-02-02 18:32:19 -08:00
.github/workflows Initial commit 2024-02-02 18:32:19 -08:00
tests Initial commit 2024-02-02 18:32:19 -08:00
.gitignore Initial commit 2024-02-02 18:32:19 -08:00
.pre-commit-config.yaml Initial commit 2024-02-02 18:32:19 -08:00
LICENSE Initial commit 2024-02-02 18:32:19 -08:00
README.md Initial commit 2024-02-02 18:32:19 -08:00
flake8_no_nested_comprehensions.py Initial commit 2024-02-02 18:32:19 -08:00
pyproject.toml Initial commit 2024-02-02 18:32:19 -08:00
requirements-dev.txt Initial commit 2024-02-02 18:32:19 -08:00

README.md

build status pre-commit.ci status

flake8-no-nested-comprehensions

flake8 plugin which forbids nested comprehensions

installation

pip install flake8-no-nested-comprehensions

flake8 codes

Code Description
CMP100 do not use nested comprehensions

rationale

I don't like them. If you need them for performance you can put a # noqa: CMP100 and preferrably put a comment in explaining it.

as a pre-commit hook

See pre-commit for instructions

Sample .pre-commit-config.yaml:

-   repo: https://github.com/pycqa/flake8
    rev: 3.8.1
    hooks:
    -   id: flake8
        additional_dependencies: [flake8-no-nested-comprehensions==1.0.0]