I’d like to run pylint locally with the same configuration as the python-analyzer does. It seems it uses some non-default options, like --check-quote-consistency
is turned on (off by default). This causes a problem because code that is “clean” locally generates warnings upon submission.
Can you provide a configuration file for pylint?
Originally created as an issue here that was closed: pylint configuration · Issue #64 · exercism/python-analyzer · GitHub
1 Like
@MatthijsBlom Note that this file generates warnings like the one given below:
pylint: Command line or configuration file:1: UserWarning: Specifying exception names in the overgeneral-exceptions option without module name is deprecated and support for it will be removed in pylint 3.0. Use fully qualified name (maybe 'builtins.BaseException' ?) instead.
I fixed it locally by using the FQN.
1 Like
@BethanyG you might want to note this.
Duly noted. I’ll do a sweep of the repo config and the analyzer config this weekend. Thanks for letting me know!
@BethanyG @MatthijsBlom Also, single-variable names are declared bad in the config, with a reference to a StackOverflow thread. However, there’s no consensus in that thread, and most people actually said they didn’t want such a setting. Also, Python now supports typing hints, so, variable names aren’t the only things that help understand code.
Consider the following:
return [c for c in candidates if (x := c.upper()) != w and Counter(x) == freq]
There’s really no reason to use anything other than c
and x
in the code above. In adds nothing to code legibility, other than forced verbosity. Please reevaluate the setting for single-variable names.
FWIW, I’ve disabled the following for my GitHub runs: C0103,C0104,C0114,C0116.
@bruce-wayne - we follow PEP-8, and have the additional restriction of no single letter variable names anywhere. Whether or not it is considered debatable or controversial. It’s not open for discussion ATM. If the SO post ref in the config makes that confusing, I will remove it.
Additionally, type hints are optional, and since we do not use MyPy for Exercism, they are not required/used or checked.
You can, of course use whatever you like in your PyLint config (and also write code whichever way you like), but if you get feedback on single letter variable names, don’t be surprised.