Skip to content

Add --per-file-selects option #344

@asottile

Description

@asottile

In GitLab by @rossmacarthur on Feb 15, 2020, 02:58

Since --per-file-ignores exists I think it makes sense that --per-file-selects exists.

Example: docstrings

For example I have a project that has a package, scripts, as well as tests, and wanted to use flake8-docstrings on just the package part. Being able to specify the following in the config would be useful:

[flake8]
ignore = D
per-file-selects =
    <package-name>/*: D

Example: specific lints from plugins

Additionally, I am unable to select specific lints for the package part, without having to repeat them in the ignores for the rest of the project. Say for example I wanted just 1 lint from three different plugins X001, Y002, Z003 on the package data. It would be nice to use

[flake8]
ignore = X,Y,Z
per-file-selects =
    <package-name>/*: X001,Y002,Z003

But instead I have to do something like

[flake8]
ignore = X,Y,Z
select = X001,Y002,Z003
per-file-ignores =
    ci/*: X001,Y002,Z003
    examples/*: X001,Y002,Z003
    scripts/*: X001,Y002,Z003
    tests/*: X001,Y002,Z003

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions