Commit Graph

131 Commits

Author SHA1 Message Date
toofar cc3c1e2050 Enable pylint Too many positional arguments warning
This re-enables the pylint too-many-positional-arguments for the main
application code. It's still disabled for tests because that's how you pull in
pytlint fixtures, and I don't think we want to push people into being creative
with fixtures just to get around that.

When functions are called with many positional arguments the reader has to do
a bit of heavy lifting to figure out in what position a value is being passed,
and it's easier to make mistakes. So I would like to encourage using keyword
arguments for long argument lists.

I've set the `max-positional-arguments` to a completely arbitrary 7, from a
completely arbitrary 5, because there were many more violations under 7. If
like 99% of our functions fit under 7 it's probably fine.

Regarding the exceptions:
* objreg.register: I grepped it and it looks like everything is only passing
  the first two args as positional already, lucky!
*  `_get_color_percentage`: only one usage of it, but I was in "add directive
  comment" mode
* update_3rdparty.py: only one usage, already using kwargs
* pyqtProperty: idk
* commands.py: "its complicated". Many methods in this file map to commands
  used in qutebrowser's command mode. In that case it's usual for them to be
  called as flags, rather than positional. But it could be complicated to wade
  into that, and having one file excluded isn't so bad.
2024-10-15 11:55:04 +02:00
Florian Bruhin f175f611f8 pylint: Disable too-many-positional-arguments
Added in 3.3.0:
https://pylint.pycqa.org/en/latest/whatsnew/3/3.3/index.html

Some of those arguments could probably indeed be keyword-only,
but for some of the functions shown by pylint, those are qutebrowser command
handlers where a positional argument has different semantics.
2024-10-15 11:55:04 +02:00
Florian Bruhin 5337882657 Adjust linters for dropping Python 3.8 2024-10-13 18:24:44 +02:00
toofar a927a93d28 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.
2023-10-15 16:45:22 +13:00
toofar 750e2b0a72 pylint 3.0 deprectations
Changelog: https://pylint.pycqa.org/en/latest/whatsnew/3/3.0/index.html#summary-release-highlights

remove `__implements__`:
That attribute is apparently from a rejected PEP. They say to inherit
from BaseChecker, which we are already doing.
https://github.com/pylint-dev/pylint/pull/8404

check_messages -> only_required_for_messages:
Seems straightforward instructions. I haven't actually tested it.
https://github.com/pylint-dev/pylint/pull/8409

remove emptystring extension:
Looks like this has been replaced by https://pylint.readthedocs.io/en/stable/user_guide/messages/convention/use-implicit-booleaness-not-comparison-to-string.html
Which is disabled by default but we have `enable=ALL`, so I guess that means
we indeed have it enabled.

And update changelog URLs.
2023-10-11 19:16:01 +13:00
Florian Bruhin 09fd975af7 reuse: Add linting for old license comments 2023-07-23 13:53:31 +02:00
Florian Bruhin 7a2cee44b1 qt6: Keep pylint import order checks disabled 2023-06-30 19:29:28 +02:00
Florian Bruhin ffc06e58d6 qt6: Switch most tooling/linting to Qt 6
Only mypy missing now...
2023-06-30 19:29:28 +02:00
Philipp Albrecht d9e8b638bf Remove vim modelines
We're deprecating vim modelines in favor of `.editorconfig`.

Removing vim modelines could be done using two one-liners. Most of the vim modelines
were followed by an empty line, so this one-liner took care of these ones:

```sh
rg '^# vim: .+\n\n' -l | xargs sed -i '/^# vim: /,+1d'
```

Then some of the vim modelines were followed by a pylint configuration line, so running
this one-liner afterwards took care of that:

```sh
rg '^# vim:' -l | xargs sed -i '/^# vim: /d'
```
2023-06-30 11:03:06 +02:00
Philipp Albrecht 08ea751fe1 Remove modeline pylint checker
We're deprecating vim modelines in favor of `.editorconfig`.
2023-06-30 10:59:06 +02:00
Florian Bruhin 93c7fdd60c Initial Python 3.7 drop 2023-06-26 14:39:54 +02:00
Florian Bruhin 48ea86fcb5 Rename some qt6 FIXMEs
Not relevant for v3 and qt6
2023-06-25 23:32:59 +02:00
Florian Bruhin 4793070db3 Merge branch 'qt6-v2' into master-qt6 2023-03-17 20:30:13 +01:00
Florian Bruhin 2c4f662513 pylint: Enable new extensions
See https://pylint.pycqa.org/en/latest/whatsnew/2/2.16/index.html#extensions
2023-02-06 11:44:13 +01:00
Florian Bruhin 769ef6859f Adjust some fixme comments 2022-08-23 18:31:42 +02:00
Florian Bruhin f9eb4fb04d lint: Ignore pylint import order for now 2022-08-23 18:31:41 +02:00
Florian Bruhin 805e43cf97 WIP: Avoid line-too-long
TODO: Revert once we use black
2022-08-23 18:31:41 +02:00
Florian Bruhin 6347d71d5c pylint: Remove outdated disables
Looks like 2.14 added bad-option-value:
https://pylint.pycqa.org/en/latest/whatsnew/2/2.14/full.html

locally-enabled is long gone:
https://github.com/PyCQA/pylint/issues/2442

and so is bad-continuation:
https://github.com/PyCQA/pylint/pull/3571

no-self-use was moved to an extension in this release:
https://github.com/PyCQA/pylint/pull/6448
2022-06-08 12:02:12 +02:00
Jimmy 060e4fbf80 Drop python3.6 support.
Commits for dropping 3.5 support to copy from:

c245b7d855ccd "Initial drop of Python 3.5"
ccdfb44b85 "Drop support for Python 3.6.0"

Anything needed to update regarding OS version support in
doc/install.asciidoc?
TODO: remove 3.6/7 annotations in requirements files and
  rebuild

workflows: not sure I updated it right (run 5.12 with 3.7, same 18.04 OS) but
18.04 seems to have 3.7 on it too so it should work. It'll all change when we
drop <5.15 anyway. Not sure what the minimum ubuntu version will be going
forward.

Regarding mimetype overrides (ebb3046822) the doctring says they can all go
in 3.7 but .h5 is still missing on py39, not sure if we should care.

There are a bunch of old(?) warning messages still ignored in tests/end2end/fixtures/quteprocess.py.
2022-04-04 12:08:19 +12:00
Florian Bruhin 151b0209e8 pylint: Enable private_import extension 2022-03-30 10:22:00 +02:00
Florian Bruhin 26d308d95d pylint: Enable docparams checker 2021-12-03 13:36:20 +01:00
Florian Bruhin 4435ef9287 pylint: Enable else-if-used 2021-12-03 12:04:59 +01:00
Florian Bruhin b84d68e8ee pylint: Enable for_any_all extension 2021-12-03 12:04:59 +01:00
Florian Bruhin 083148ea38 pylint: Enable more extensions with no new messages 2021-12-03 12:04:59 +01:00
Florian Bruhin b806dc714b pylint: Enable code_style extension
All messages disabled right now, but sounds useful for future updates
2021-12-03 12:04:59 +01:00
Florian Bruhin 410a234b2a pylint: Set py-version 2021-12-03 12:04:59 +01:00
Florian Bruhin f30df9c959 pylint: Remove open encoding checker
Now built into pylint
2021-12-03 12:04:59 +01:00
Florian Bruhin 59cc72b052 pylint: Remove broad-try-clause entirely for now
See #6857
2021-12-03 12:04:59 +01:00
Florian Bruhin 42d41096bc pylint: Disable too-many-try-statements
See #6857
2021-12-02 17:41:28 +01:00
Florian Bruhin b9d58034d1 pylint: Disable raise-missing-from 2021-12-02 16:36:56 +01:00
Florian Bruhin 636c4cac4d pylint: Set class-const-naming-style
See #6857
2021-12-02 16:29:58 +01:00
Florian Bruhin b9530b313f pylint: Disable logging-fstring-interpolation for now
See #6197
2021-12-02 16:18:43 +01:00
Florian Bruhin cb9eecc87e pylint: Disable consider-using-f-string
Too big code churn right now, will do this for qutebrowser v3.0.0:
See #3020
2021-12-02 16:16:34 +01:00
Florian Bruhin 83aeed38f1 Fix lint 2021-02-11 15:25:53 +01:00
Florian Bruhin 67c4a40137 pylint: Allow A-Z for attributes
To use ClassVar with dataclass
2021-02-10 16:13:22 +01:00
Árni Dagur 317af23593 Merge branch 'master' into more-sophisticated-adblock 2020-12-19 20:30:03 +00:00
Árni Dagur ffc73980f6 Fix more lint issues related to content blocking 2020-12-19 20:29:09 +00:00
Florian Bruhin ab2b01d2c0 scripts: Fix lint 2020-11-25 14:23:48 +01:00
Florian Bruhin 3f28983dcb pylint: Bump up maximum line length to 88
For compatibility with black if people want to start using it for new code.

See #4770, #1455
2020-08-03 16:37:19 +02:00
Florian Bruhin 47470e9727 Fix lint 2020-04-15 21:07:28 +02:00
Florian Bruhin ff6f3a0905 Delete qute_pylint.settrace
This is handled by flake8-debugger
2020-01-13 08:09:35 +01:00
Florian Bruhin 45b8219f05 pylint: Remove known-* workaround 2019-10-01 12:42:30 +02:00
Florian Bruhin 692f8241ca pylint: Add trailing commas to config 2019-10-01 12:38:53 +02:00
Florian Bruhin 24eaecdd09 pylint: Enable overlapping_exceptions
It was moved to a pylint extension because it makes no sense for polyglot
Python 2/3 code, but we're not doing that.
2019-10-01 12:38:30 +02:00
Florian Bruhin c9386b753a pylint: Enable broad_try_clause 2019-10-01 12:37:58 +02:00
Florian Bruhin 8cd65dcc1b pylint: Enable emptystring extension 2019-10-01 12:35:55 +02:00
Florian Bruhin 5dd784fcfc pylint: Skip bad-builtin extension 2019-10-01 12:26:06 +02:00
Florian Bruhin 2fa32246c7 pylint: Ignore DummyBox errors
pylint complains because msgbox.msgbox() can return DummyBox, but we know
that's not the case in tests/unit/misc/test_msgbox.py.
2019-10-01 12:20:17 +02:00
Florian Bruhin 4ff40fb746 pylint: Disable no-else-continue 2019-10-01 12:14:34 +02:00
Florian Bruhin 59f5d00ce7 pylint: Ignore import-outside-toplevel
There are good reasons to do those.
2019-10-01 12:07:22 +02:00