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

Having multiple enable/disable in pylintrc #3623

Closed
hydrargyrum opened this issue May 14, 2020 · 4 comments
Closed

Having multiple enable/disable in pylintrc #3623

hydrargyrum opened this issue May 14, 2020 · 4 comments
Labels
Configuration Related to configuration Enhancement ✨ Improvement to a component Won't fix/not planned

Comments

@hydrargyrum
Copy link

Is your feature request related to a problem? Please describe

Using command-line, it's possible to run something like:

pylint -d "*" -e W -d invalid-name

which is interpret by pylint as:

  • disable all messages except that...
  • ... enable all "W" messages except that...
  • ... disable "invalid-name" (which is in the "W" group)

or in other words "only W that are not invalid-name"

and this is a cool feature!

However, the same behavior cannot be achieved using an rcfile:

configparser.DuplicateOptionError: While reading from 'lint' [line 4]: option 'disable' in section 'MESSAGES CONTROL' already exists

Describe the solution you'd like

Since the rcfile parsing engine does not allowing having multiple times the same key, either switching to another parsing engine or having a new option like:

[MESSAGES CONTROL]
messages = -*,
    +W,
    -invalid-name

or

[MESSAGES CONTROL]
enable = -*,
    W,
    -invalid-name

or

[MESSAGES CONTROL]
messages = -*,
    W,
    -invalid-name

Potential inspiration: rdiff-backup's "filelist" options.

@PCManticore PCManticore added the Enhancement ✨ Improvement to a component label May 14, 2020
@mattwala
Copy link

mattwala commented May 21, 2020

We have an ad-hoc solution to this problem, by defining a new YAML-based format for rcfiles that lets you repeat options. The main driver is:

https://gitlab.tiker.net/inducer/ci-support/-/blob/master/run-pylint.py

Example rcfile: https://gitlab.tiker.net/inducer/ci-support/-/blob/master/.pylintrc-default.yml

It would be nice, however, if this feature was fully supported by Pylint.

cc: @inducer

@DanielNoord DanielNoord added the Configuration Related to configuration label May 9, 2022
@Pierre-Sassoulas Pierre-Sassoulas added the Needs decision 🔒 Needs a decision before implemention or rejection label Jul 8, 2022
@Pierre-Sassoulas
Copy link
Member

We can either have #3696 or this one but not both.

@DanielNoord
Copy link
Collaborator

This is a limitation in both toml and ini files. Let's not try to write our own tomllib and just say this this is (sadly) a won't fix.

@Pierre-Sassoulas
Copy link
Member

Let's have #3696 then.

@Pierre-Sassoulas Pierre-Sassoulas closed this as not planned Won't fix, can't repro, duplicate, stale Jul 8, 2022
@Pierre-Sassoulas Pierre-Sassoulas added Won't fix/not planned and removed Needs decision 🔒 Needs a decision before implemention or rejection labels Jul 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Configuration Related to configuration Enhancement ✨ Improvement to a component Won't fix/not planned
Projects
None yet
Development

No branches or pull requests

5 participants