On Wed, Jan 12, 2022 at 9:33 AM Xavier Morel via code-quality < firstname.lastname@example.org> wrote:
Sorry for the bother but I had a question about balancing personal and project uses of flake8: on a project we're trying to progressively introduce flake8 (so enabling a subset of all checks on a subset of all files).
We tried adding a config doing via "select" and "ignore" in the existing setup.cfg, however this turned out to break a lot of people's linting, as their editor simply ran flake8 in the default configuration and they used that for their contributions (even though it was not checked project-wide).
Looking further into this, it looks like recent versions of flake8 have "extend-ignore" and "extend-select" to avoid breaking things locally, however there are a few issues I don't know how to fix, or whose semantics is not clear:
- according to the documentation, CLI values have the highest priority, but how does that work with select versus extend-select? Is `--select` used as the baseline then `extend-select` from the configuration files gets added to that?
No this means that what you specify on the CLI will override whatever is in the configuration file. You can specify `--extend-select` on the CLI as well. Think of it like this:
There's a default list of ignores and select so you have some code that looks vaguely like:
select = ["E", "F", "W", "C"] ignore = [...]
Then when you specify extend-select we do
Whereas if you use select in your config file we're doing
select = user_specified_select # cli or config
So if you have extend-select in your config, and then specify --select on the CLI, we'll still follow that algorithm.
- is `--select ''` the proper way to deselect everything?
As in you only want to report the things you've selected? Yes.
- is there a way to make exclusions error-specific, or is an other workaround necessary to add large sections of the project to exclusions for the CI, but not prevent linting for people?
I don't know what you mean. I'm going to take a guess though,
You want to ignore errors from specific files? There's per-file-ignores you can specify in your config (or on the CLI) to do just that. That will affect everyone though if you put it in the config, so changing how you run flake8 for CI would mean needing to specify that.
Also, it's worth thinking about the fact that you can tell Flake8 which config file to read, so you _could_ tell it to read a different file for CI
Xavier _______________________________________________ code-quality mailing list -- email@example.com To unsubscribe send an email to firstname.lastname@example.org https://mail.python.org/mailman3/lists/code-quality.python.org/ Member address: email@example.com