-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Documentation page for configuration file #3181
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
Comments
Thanks for the feedback. Our documentation definitely needs some attention. |
Just to finish resolving @pawamoy's problem (which I also just ran into), a correct format would be:
Added
|
and configure the line length there; See also pylint-dev/pylint#3181
* add a pylint section to pyproject.toml and configure the line length there; See also pylint-dev/pylint#3181 * add an example line that is >100 chars and not manually ignored
Testing with pylint 2.6
Example config:
|
To tell what options belong to which section, you can generate an rc file (
[tool.pylint.format]
max-module-lines = 1000 |
I have [tool.pylint.MASTER]
load-plugins = "pylint_websockets" With Pylint failing with
|
@ThatXliner this look like a crash, please open another issue as this was relates to documentation. |
Ok, I was just making sure that I have the configuration set up correct and that it wasn't my fault. |
Nevermind, I just realized it was my mistake. I placed the configuration in the middle of another field 😬 |
This is not "your fault" as pylint outright crash and is not helpful at all in the error it gives :) We're trying to make this kind error more understandable for toml in #4580 / #4720 , feel free to come make suggestions if you like (and in particular giving the offending code that was crashing in your case was very helpful) ! |
There will be a new message |
Just in case anybody else wonders about the [tool.pylint.MASTER]
load-plugins = 'pylint.extensions.mccabe,pylint.extensions.redefined_variable_type,pylint.extensions.broad_try_clause' [tool.pylint.MASTER]
load-plugins = [
'pylint.extensions.mccabe',
'pylint.extensions.redefined_variable_type',
'pylint.extensions.broad_try_clause'
] ... but of course the 2nd one looks so much better :) Similar flexibility seems to be allowed by other fields that expect comma-separated lists, and interestingly in pydocstyle as well... Although I'm not sure if that's intended/guaranteed in any way. But if it is, it may be useful to add this to docs, as it offers a more convenient migration path from old config formats than having to reformat everything. E.g. both of these work: [tool.pydocstyle]
ignore = 'D102,D103' [tool.pydocstyle]
ignore = ['D102', 'D103'] |
Thank to @DanielNoord's amazing work, all the possible options were documented in #6346, the result is here , there's also a better error handling yet again with the migration from optparse to argparse being complete. You can also generate a sample configuration file with |
Each time I want to try pylint again, I face the same issue: I go to the official documentation to search for information about the configuration file, but can't seem to find anything easily.
Obviously, I go to "User Guide -> Configuration" (https://pylint.readthedocs.io/en/latest/user_guide/options.html) but this is not at all what I expect. There's nothing about the the pylintrc file, or the available configuration options like
max-line-length
. To know if pylint supported pyproject.toml, I had to read the "Running Pylint" section 😕Then I tell myself, "the options names must be the same on the CLI and in the
[tool.pylint]
section", so I write this:...but it doesn't seem to be taken into account. Should I replace
-
with_
? Should options be in a sub-table? Where do I find this information?Answers are: I don't know. The search feature on the documentation doesn't help. I eventually went to the FAQ: https://pylint.readthedocs.io/en/latest/faq.html#how-do-i-find-the-option-name-for-pylintrc-corresponding-to-a-specific-command-line-option. So now I know I can get the option name for
--max-line-length
by generating the pylintrc file, and copy-pasting it into pyproject.toml. I see thatdisable
actually takes the verbose name and not the code (I have to scroll my buffer back to get the name).But it still does not work 😕
How one should write the
[tool.pylint]
section?Am I the only one having a hard time with pylint's documentation structure?
EDIT: found the answers in the changelog: http://pylint.pycqa.org/en/latest/whatsnew/2.5.html. Section must be named
[tool.pylint.'MESSAGES CONTROL']
or similar. This feature has not been released yet.The text was updated successfully, but these errors were encountered: