diff options
author | toofar <toofar@spalge.com> | 2023-10-15 16:45:22 +1300 |
---|---|---|
committer | toofar <toofar@spalge.com> | 2023-10-15 16:45:22 +1300 |
commit | a927a93d2833de61cdf85defb88b94ef8e17d51b (patch) | |
tree | 4dad2f826a04b71a9c6170bd0345f8e7ffce76a2 | |
parent | 207de5828decfa54217b06905e00f9d298f27e57 (diff) | |
download | qutebrowser-a927a93d2833de61cdf85defb88b94ef8e17d51b.tar.gz qutebrowser-a927a93d2833de61cdf85defb88b94ef8e17d51b.zip |
lint: allow comparing variables to 0
With pylint 3 there is a new option: https://pylint.readthedocs.io/en/latest/user_guide/messages/convention/use-implicit-booleaness-not-comparison-to-zero.html
It's disabled by default but we enable all warnings and disabled them as
desired.
This one is of the opinion that:
if x == 0:
is bad and
if x:
is good.
I feel that the first one (x == 0) is more clear. We aren't checking for
truthiness here, we are checking for a literal value, its very
intentional.
One might argue that being precious about making the type here is
redundant in current year with type checking tooling and all that. But
there are like a hundred of these checks in the code base so it seems a
well established pattern anyhow.
In summary, the new warning doesn't have a very strong use case and we
would prefer to stick with out established pattern.
-rw-r--r-- | .pylintrc | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -59,6 +59,7 @@ disable=locally-disabled, useless-param-doc, wrong-import-order, # doesn't work with qutebrowser.qt, even with known-third-party set ungrouped-imports, # ditto + use-implicit-booleaness-not-comparison-to-zero, [BASIC] function-rgx=[a-z_][a-z0-9_]{2,50}$ |