Commit Graph

37 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 09fd975af7 reuse: Add linting for old license comments 2023-07-23 13:53:31 +02:00
Florian Bruhin 0718b25796 reuse: Initial copyright text update for myself
git ls-files | \
    xargs sed -Ei 's/Copyright [0-9]{4}(-[0-9]{4}) Florian Bruhin \(The Compiler\) <mail@qutebrowser\.org>/SPDX-FileCopyrightText: Florian Bruhin (The Compiler) <mail@qutebrowser.org>/'
2023-07-23 12:49:05 +02:00
Florian Bruhin 77ca342cff reuse: Remove some more old license headers
git ls-files | \
xargs grep -l "This file is part of qutebrowser" | \
xargs grep -l SPDX-License-Identifier | \
xargs sed -i '/# This file is part of qutebrowser\./,/along with qutebrowser\.  If not, see <https:\/\/www\.gnu.org\/licenses\/>./d'
2023-07-23 12:15:03 +02:00
Florian Bruhin b2aaba6043 reuse: Adjust most license headers
git ls-files | xargs grep -l "is free software"  | xargs reuse annotate --license="GPL-3.0-or-later" --skip-unrecognised
2023-07-23 12:11:07 +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
Florian Bruhin 6c4e281028 pylint: Fix new unnecessary-lambda-assignment 2022-06-08 12:25:12 +02:00
Florian Bruhin 0d3af197d9 Revert "pylint: Disable unnecessary-ellipsis for tests"
This reverts commit 2b76b61640.
2022-04-04 11:27:16 +02:00
Florian Bruhin 2b76b61640 pylint: Disable unnecessary-ellipsis for tests
See https://github.com/PyCQA/pylint/issues/6036 and https://github.com/PyCQA/pylint/issues/6037
2022-03-29 17:57:03 +02:00
Florian Bruhin e4a667e06e pylint: Disable use-implicit-booleaness-not-comparison in tests 2021-12-03 12:04:59 +01:00
Florian Bruhin 2f69664c2a pylint: Disable wrong-import-order for tests 2021-12-02 17:38:29 +01:00
Florian Bruhin c07b93b7c4 pylint: Disable pointless-statement in tests 2021-03-18 10:59:51 +01:00
Florian Bruhin 1a4fff1a42 doc: Switch URLs to https 2021-01-26 15:19:01 +01:00
Florian Bruhin 222f1f19a1 Bump copyright years
Closes #6015
2021-01-20 20:06:19 +01:00
Florian Bruhin 9ed3646430 Upgrade to pytest 6.0.1 2020-07-30 19:03:24 +02:00
Florian Bruhin 6263f7aa9a pylint: Ignore not-callable for tests
Workaround for https://github.com/pytest-dev/pytest/issues/7558
2020-07-29 10:23:03 +02:00
Florian Bruhin 9e4276db9b Adjust copyrights for 2020 2020-01-04 18:21:17 +01:00
Florian Bruhin 8cd65dcc1b pylint: Enable emptystring extension 2019-10-01 12:35:55 +02:00
Florian Bruhin 21e9b9b41f Specify 'check' with subprocess.run 2019-10-01 11:54:18 +02:00
Jay Kamat 3e816f5f8b
Update copyright for 2019 2019-02-22 21:45:08 -08:00
Florian Bruhin d74daf9294 Fix lint 2018-09-14 22:52:40 +02:00
Florian Bruhin 9c67239847 Fix lint 2018-09-08 14:52:47 +02:00
Florian Bruhin 6f028e9ad0 Update copyright years 2018-02-05 12:19:50 +01:00
Florian Bruhin b8a5c04b69 Clean up run_pylint_on_tests 2017-12-15 23:22:26 +01:00
Florian Bruhin 430126dcc8 pylint: Re-enable ungrouped-imports 2017-12-15 23:08:53 +01:00
Gyorgy Orban bb54a954fe use subprocess run
The usage of subprocess.run is recommended since python 3.5.
Popen, check_call, call and check_output calls were replaced with run.
2017-11-01 09:59:32 +01:00
Florian Bruhin 12520bf4ba Install PyQt from PyPI for pylint
This means we can be sure to have QtWebEngine available and won't have QtWebKit.
2017-05-17 19:08:59 +02:00
Florian Bruhin 822623f2ed Finally update copyrights... 2017-05-09 21:37:03 +02:00
Florian Bruhin 1d0f187fab Adjustments for new pylint version 2017-04-13 18:22:16 +02:00
Florian Bruhin 0b362e76ea Move pylint plugins to an installed package.
This means we can now run things like running pylint --version without having
to set PYTHONPATH correctly now.

When using skip_install=true, the plugins wouldn't work as they need to import
qutebrowser.

We have to keep setting PYTHONPATH in run_pylint_on_tests.py, otherwise we get
this error I don't quite understand:

    F:  1, 0: error while code parsing: Unable to load file
    '/home/florian/proj/qutebrowser/git/__init__.py' ([Errno 2] No such
    file or directory: '...') (parse-error)
2016-02-19 07:15:09 +01:00
Florian Bruhin a5f2ac5f03 Adjust copyright years. 2016-01-04 07:12:39 +01:00
Florian Bruhin 109984c96e pylint: Check attr-defined-outside-init for tests. 2015-12-01 22:41:16 +01:00
Florian Bruhin 788a096150 pylint: Ignore import-error globally for tests. 2015-12-01 22:03:59 +01:00
Florian Bruhin 81f522336f Do PYTHONPATH shenanigans in run_pylint_on_tests.
If we do it in tox.ini, there are two drawbacks:

- We have more stuff in PYTHONPATH even if we don't when actually using
  qutebrowser.
- The separator is platform specific, so we can't easily do this in a portable
  way in tox.ini.
2015-12-01 08:07:42 +01:00
Florian Bruhin da9cb88c81 pylint: Disable protected-access for tests. 2015-08-12 06:44:33 +02:00
Florian Bruhin 7d284fa575 pylint: Disable missing-docstring for tests. 2015-08-02 20:38:13 +02:00
Florian Bruhin be3f61af62 Move developer scripts to dev/ subfolder.
Closes #783.
2015-06-28 22:31:30 +02:00
Renamed from scripts/run_pylint_on_tests.py (Browse further)