-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Pylint Crash on invalid TOML config #4580
Comments
Hi, |
Hello, thank you for willing to contribute to this issue ! I assigned you to it, do not hesitate to ask questions here or in a merge request. |
Thanks, I will start going through this and ask questions whenever I need to :) |
@Pierre-Sassoulas I was able to reproduce this, however I did this on |
|
@Pierre-Sassoulas Sorry its taking me some time to understand this.
The error I get is slightly different than above, I get: I also tried with non-empty list and got the same error (AttributeError: 'list' object has no attribute 'items')
Its mentioned above that this should not be crashing, but what should the expected behavior be for this case? I was thinking about something like (its not tested yet)this(https://github.com/PyCQA/pylint/blob/99589b08de8c5a2c6cc61e13a37420a868c80599/pylint/config/option_manager_mixin.py#L281)
|
I think what the code expect in |
@Pierre-Sassoulas section_values reads {"load-plugins": ["a", "b"]} but then we break it down further into option, value where it breaks. I went ahead with a check as commented above. (I have raised a draft PR for now) |
Steps to reproduce
It was not immediately clear to me that the main table should be
[tool.pylint.master]
and not[tool.pylint]
(I searched in the docs but did not find an example).Given any python file and a config file called
repro.toml
(I initially encountered this on mypyproject.toml
, but for the sake of a simple example):Current behavior
Expected behavior
It should not crash.
pylint --version output
I just upgraded to prerelease versions as suggested in this template.
Additional crashes for invalid data
Additional crashes are possible for "mapping" configs where I thought a TOML table might be used rather than a list of strings with a built in separator as is used in
.pylintrc
(again, I could not find examples).Given config:
Or config:
Results in (same traceback for both configs):
Related issues: #4518 #4204
The text was updated successfully, but these errors were encountered: