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

Should .pylintrc contain all settings explicitly or just overrides #6968

Closed
sisp opened this issue Jun 17, 2022 · 5 comments · Fixed by #7158
Closed

Should .pylintrc contain all settings explicitly or just overrides #6968

sisp opened this issue Jun 17, 2022 · 5 comments · Fixed by #7158
Labels
Documentation 📗 Needs PR This issue is accepted, sufficiently specified and now needs an implementation Question

Comments

@sisp
Copy link
Contributor

sisp commented Jun 17, 2022

Question

What's the best practice regarding Pylint's configuration settings?

  1. All settings are explicitly specified, even when most or all settings use default values.
  2. Only overrides are specified, i.e. default values are used implicitly unless explicitly overridden.

I've not been able to find an answer to this question anywhere. Personally, I find materializing all settings explicitly quite verbose and difficult to maintain given the large number of settings. Also, it would be hard to tell which settings just use default values and which settings use custom values. On the other hand, changes in default values with a new release of Pylint would not cause errors with explicit settings. But then again some releases introduce new settings whose values would not be set explicity either unless they are manually added to the config, so it's easy to end up with a mix of explicit and implicit (default) settings.

Would the best practice be to have a config only with settings overrides (so no explicit default values) and use a package version specifier that pins the major and minor version (i.e. the version specifier only contains bug fix releases, e.g. >=2.14,<2.15)?

Documentation for future user

I think the Pylint documentation should describe the best practices for using Pylint, including best practices for the config and version specifier.

Additional context

No response

@sisp sisp added the Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling label Jun 17, 2022
@Pierre-Sassoulas Pierre-Sassoulas added Documentation 📗 Question and removed Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling labels Jun 17, 2022
@Pierre-Sassoulas
Copy link
Member

I think the fact that we can generate the whole configuration with a command send the wrong message on this issue. We need(ed?) this command as a kind of documentation of the configuration. It's indeed better to have a minimal pylintrc and trust pylint's default value for easier maintenance imo. (Unless we have a migration/suggestion tool for the configuration but this is another high effort issue that I can't link as I'm on mobile).

I would be interested in other opinions on this.

@sisp
Copy link
Contributor Author

sisp commented Jun 17, 2022

Thanks for sharing your thoughts on this topic. 🙏

What's your recommendation regarding the version specifier for Pylint? Pinned to major and minor version?

By the way, I'd be happy to contribute the results of this discussion to the docs.

@Pierre-Sassoulas
Copy link
Member

Thank you for being willing to contribute.

There's a paragraph on updating pylint in the doc, I can't link as I'm on mobile, please search for 'patch release' or 'versionning'.

@DudeNr33
Copy link
Collaborator

I would be interested in other opinions on this.

For the final pylintrc I'm +1 on only specifying the options where something different than the default is needed.

For generating the example configuration with the --generate-rcfile option I like that all possible options are included together with their respective documentation. This gives new users a good overview what configuration options are available, what they mean, and where they must be placed in the configuration file.
Sure, you could also get this information from the docs - but I like that I can just go through the generated config, directly understand and edit each option I encounter, and finish the configuration without ever having to leave the editor.

The only thing I noticed is that some options are commented out, while others are not. Haven't looked in detail where this behaviour is coming from.
I would prefer that all options are commented out in the generated rcfile, and if I want to override the default I just uncomment them. See argument-naming-style and argument-rgx here for example.

[BASIC]

# Naming style matching correct argument names.
argument-naming-style=snake_case

# Regular expression matching correct argument names. Overrides argument-
# naming-style. If left empty, argument names will be checked with the set
# naming style.
#argument-rgx=

@sisp
Copy link
Contributor Author

sisp commented Jun 17, 2022

There's a paragraph on updating pylint in the doc, I can't link as I'm on mobile, please search for 'patch release' or 'versionning'.

https://pylint.pycqa.org/en/latest/user_guide/installation/upgrading_pylint.html

Just for completeness. 😉

@Pierre-Sassoulas Pierre-Sassoulas added the Needs PR This issue is accepted, sufficiently specified and now needs an implementation label Jun 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation 📗 Needs PR This issue is accepted, sufficiently specified and now needs an implementation Question
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants