-
-
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
Search pylint configuration in setup.cfg and pyproject.toml #617
Comments
Original comment by Claudiu Popa (BitBucket: PCManticore, GitHub: @PCManticore): Why? This would complicate the configuration parsing and requires a lot of work to accommodate the internal implementation for little benefit. It will be yet another way to look for the configuration options, which increases the maintenance burden. And it will not be obvious where pylint will look first, in the setup.cfg or in pylintrc. |
Original comment by Fabio C. Barrionuevo da Luz (BitBucket: luzfcb, GitHub: @luzfcb?): if the "pylintrc" file exist, stop search and get settings . if the "pylintrc" file does not exist, verify that "setup.cfg" file exists. If "setup.cfg" exist, get the settings. if "pylintrc" file and "setup.cfg" exist, ignore "setup.cfg" to make obvious what order the pylint use, just enter in the documentation something like:
|
Original comment by Peter Bittner (BitBucket: bittner, GitHub: @bittner?): JFYI, I had prepared pull request #276 to implement those changes. It was rejected, though. |
https://github.com/python/mypy added support for |
|
@PCManticore It might be good to take a look at this again if you haven't recently. |
If |
@PCManticore it is possible via something like this: [pytest]
general_options = ...
[pytest.messages]
messages = ... But supporting |
If that's the case then, I don't mind supporting |
@PCManticore Could you update the issue title to reflect the current plan moving forward? |
Test tools Pylint, Flake8 and Bandit configurations were simplified. The Pylint configuration was a long default configuration that contained all the options with most of the options in default values. There was also a separate files for the tests and snippy source code. Now only the needed options are configured and the files are merged to one default file 'pylintrc'. The Flake8 configuration was moved to setup.cfg to remove own configuration file. The result files for Pylint and Bandit were removed. This was not a good idea in the past. The configuration should be read from pyproject.toml. But the tools do not yet support this feature. [1] pylint-dev/pylint#617 [2] https://gitlab.com/pycqa/flake8/issues/428 [3] pytest-dev/pytest#1556 Signed-off-by: Heikki Laaksonen <[email protected]>
@PCManticore should we file a new issue for pyproject.toml or will you update the title for this one? |
@flying-sheep Done! Thanks again for the reminder. |
Huge thanks for supporting this. Just one little thought. Since TOML is more advanced than INI, you could actually support a list of disables for message control like so: [tool.pylint."messages control"]
disable = [
"too-many-ancestors",
"too-many-arguments",
"too-many-boolean-expressions",
"too-many-branches", I believe this would be more elegant than a comma separated list in TOML personally. What do you think? It may also be worth replacing underscores with spaces in section headings so we could do this: [tool.pylint.messages_control]
disable = [
"too-many-ancestors",
"too-many-arguments",
"too-many-boolean-expressions",
"too-many-branches", Huge love |
After some trials and errors, I found this works
This also works
|
Does anyone have a decent working example of pylint configuration in Also, why was support for this implemented without an option for |
@impredicative https://github.com/laike9m/Cyberbrain/blob/master/pyproject.toml#L41-L45 |
This is a good suggestion! Feel free to make a separate issue for it. |
It seems that pylint correctly parses the |
@laike9m please make sure that if you are using this structure for your entries in
you add a comma after the first three double quotes, otherwise the first message won't be disabled. Similarly, add a comma after the last message for the same reason |
For anyone looking for examples with |
|
for others looking for how to include an
|
I'm not sure when this happened, but pylint now seems to support lists in message_control. Here's an excerpt of my pyproject.toml if it helps anyone. [tool.pylint.basic]
# Allow shorter and longer variable names than the default.
argument-rgx = "[a-z_][a-z0-9_]*$"
attr-rgx = "[a-z_][a-z0-9_]*$"
variable-rgx = "[a-z_][a-z0-9_]*$"
# Ensure that orjson is analysed as a C extension by pylint.
extension-pkg-whitelist = "orjson"
[tool.pylint.messages_control]
disable = [
# Disable too many and too few checks.
"too-many-ancestors",
"too-many-arguments",
"too-many-boolean-expressions",
"too-many-branches",
"too-many-function-args",
"too-many-instance-attributes",
"too-many-lines",
"too-many-locals",
"too-many-nested-blocks",
"too-many-public-methods",
"too-many-return-statements",
"too-many-statements",
"too-few-public-methods",
# Similar lines in files (often the case in tests).
"duplicate-code",
# Many functions (e.g. callbacks) will naturally have unused arguments.
"unused-argument",
# Disable checking that method could be a function in classes (often used for organisation).
"no-self-use",
# Disable failure for TODO items in the codebase (code will always have TODOs).
"fixme",
# Disable docstrings checks as we don't require excessive documentation.
"missing-docstring"
]
[tool.pylint.format]
# Maximum number of characters on a single line.
max-line-length = 99 And yup, I find the defaults in pylint too noisy 😄 |
Originally reported by: Fabio C. Barrionuevo da Luz (BitBucket: luzfcb, GitHub: @luzfcb?)
It would be great if pylint also seek the settings in a special section in setup.cfg file.
the same reasons as described by @bittner in
https://bitbucket.org/logilab/pylint/issues/121/search-pylintrc-in-config-directory#comment-13136390
The text was updated successfully, but these errors were encountered: