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

Proper warning when the pyproject.toml options do not match existing options #5259

Closed
Pierre-Sassoulas opened this issue Nov 4, 2021 · 1 comment · Fixed by #6330
Closed
Assignees
Labels
Enhancement ✨ Improvement to a component
Milestone

Comments

@Pierre-Sassoulas
Copy link
Member

Current problem

We're not going to crash following the merging of #4720 but we need to define better what is expected in the pyproject.toml for pylint. When using:

[tool.pylint]
load-plugins = []
disable = "logging-not-lazy,logging-format-interpolation"

load-plugins or disable are not valid options in the main namespace.

The expected configuration would be:

[tool.pylint]
    [tool.pylint."messages control"]
        disable = "logging-not-lazy,logging-format-interpolation"
    [tool.pylint."master"]
        load-plugins = []

But we're not warning the user about it.

Desired solution

We need to have proper error message when something is misplaced, because right now it's not very convenient. We're not going to crash following the merging of #4720 but we also should have an error message like:

disable is not a valid section for pylint, did you mean '[tool.pylint."messages control"] disable = ...' ?

Additional context

#4720 (comment)

@Pierre-Sassoulas Pierre-Sassoulas added the Enhancement ✨ Improvement to a component label Nov 4, 2021
@Pierre-Sassoulas
Copy link
Member Author

Alternatively removing the sub-namespace could be more convenient when defining the configuration and also practical in pylint because each checker would have access to all options. and parsing would be a lot simpler. Maybe we could wait for the option/argparse refactor to do this.

Pierre-Sassoulas added a commit to tanvimoharir/pylint that referenced this issue Nov 4, 2021
…tion

We do not catch all the problem in toml because we don't know what
is expected so we can't recommend. See pylint-dev#5259
Pierre-Sassoulas added a commit to tanvimoharir/pylint that referenced this issue Nov 8, 2021
…tion

We do not catch all the problem in toml because we don't know what
is expected so we can't recommend. See pylint-dev#5259
Pierre-Sassoulas added a commit to tanvimoharir/pylint that referenced this issue Nov 8, 2021
Add test for current pyproject.toml issues

Add a 'bad-configuration-option-value' message for bad toml configuration

We do not catch all the problem in toml because we don't know what
is expected so we can't recommend. See pylint-dev#5259

We can detect bad top level option when reading the toml
Pierre-Sassoulas added a commit to tanvimoharir/pylint that referenced this issue Nov 8, 2021
Add test for current pyproject.toml issues

Add a 'bad-configuration-option-value' message for bad toml configuration

We do not catch all the problem in toml because we don't know what
is expected so we can't recommend. See pylint-dev#5259

We can detect bad top level option when reading the toml
Pierre-Sassoulas added a commit to tanvimoharir/pylint that referenced this issue Nov 8, 2021
Add test for current pyproject.toml issues

Add a 'bad-configuration-option-value' message for bad toml configuration

We do not catch all the problem in toml because we don't know what
is expected so we can't recommend. See pylint-dev#5259

We can detect bad top level option when reading the toml
Pierre-Sassoulas added a commit to tanvimoharir/pylint that referenced this issue Nov 10, 2021
Add test for current pyproject.toml issues

Add a 'bad-configuration-option-value' message for bad toml configuration

We do not catch all the problem in toml because we don't know what
is expected so we can't recommend. See pylint-dev#5259

We can detect bad top level option when reading the toml
Pierre-Sassoulas added a commit to tanvimoharir/pylint that referenced this issue Nov 12, 2021
Add test for current pyproject.toml issues

Add a 'bad-configuration-option-value' message for bad toml configuration

We do not catch all the problem in toml because we don't know what
is expected so we can't recommend. See pylint-dev#5259

We can detect bad top level option when reading the toml
Pierre-Sassoulas pushed a commit that referenced this issue Nov 13, 2021
* Fix crashes during toml configuration parsing

Add test for current 'pyproject.toml' issues. Add a 'bad-configuration-section'
message for bad toml configuration

We can detect bad top level option when reading the toml but we do not catch
all the problem in toml because we don't know what is expected so we can't
recommend. See #5259

Co-authored-by: Daniël van Noord <[email protected]>
@DanielNoord DanielNoord self-assigned this Apr 15, 2022
@Pierre-Sassoulas Pierre-Sassoulas added this to the 2.14.0 milestone Apr 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement ✨ Improvement to a component
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants