You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The configuration for flake8 in .pre-commit-config.yaml--specifically that version 6.0.0 is used--is incompatible with Python 3.12, producing an incorrect "E231 missing whitespace after ':'" error:
(.venv) ek@Glub:~/repos-wsl/GitPython (scripts)$ pre-commit run --all-files
flake8...................................................................Failed
- hook id: flake8
- exit code: 1
git/cmd.py:479:34: E231 missing whitespace after ':'
f"The `{protocol}::` protocol looks suspicious, use `allow_unsafe_protocols=True` to allow it."
^
git/cmd.py:479:35: E231 missing whitespace after ':'
f"The `{protocol}::` protocol looks suspicious, use `allow_unsafe_protocols=True` to allow it."
^
git/refs/log.py:247:67: E226 missing whitespace around arithmetic operator
raise IndexError(f"Index file ended at line {i+1}, before given index was reached")
^
1 E226 missing whitespace around arithmetic operator
2 E231 missing whitespace after ':'
3
check for merge conflicts................................................Passed
check toml...............................................................Passed
check yaml...............................................................Passed
It also reports E226, which also happens only on Python 3.12, but appears intentional. But that's easy to fix (the simplest way being to add the spaces it wants, which also more resembles the overall style for the + operator in this project).
The wrong : error (false positive E231) happens because flake8 6.0.0 depends on pycodestyle 2.10.*, which implements that check (E231) and has a parsing bug specific to Python 3.12. This was fixed in PyCQA/pycodestyle#1148.
Upgrading to flake8 6.1.0 gets the fix, since that version of flake8, currently the latest, depends onpycodestyle 2.11.*, which has it:
(.venv) ek@Glub:~/repos-wsl/GitPython (scripts)$ pre-commit autoupdate
[/~https://github.com/PyCQA/flake8] updating 6.0.0 -> 6.1.0
[/~https://github.com/pre-commit/pre-commit-hooks] already up to date!
(.venv) ek@Glub:~/repos-wsl/GitPython (scripts *)$ pre-commit run --all-files
[INFO] Installing environment for /~https://github.com/PyCQA/flake8.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
flake8...................................................................Failed
- hook id: flake8
- exit code: 1
git/objects/submodule/base.py:1406:16: E721 do not compare types, for exact checks use `is` / `is not`, for instance checks use `isinstance()`
if type(sm) != git.objects.submodule.base.Submodule:
^
git/refs/log.py:247:67: E226 missing whitespace around arithmetic operator
raise IndexError(f"Index file ended at line {i+1}, before given index was reached")
^
git/util.py:1139:16: E721 do not compare types, for exact checks use `is` / `is not`, for instance checks use `isinstance()`
if type(base) == IterableClassWatcher:
^
1 E226 missing whitespace around arithmetic operator
2 E721 do not compare types, for exact checks use `is` / `is not`, for instance checks use `isinstance()`
3
check for merge conflicts................................................Passed
check toml...............................................................Passed
check yaml...............................................................Passed
However, that reports E721 about the use of == to compare to a type object. So I think it makes sense for a fix for this to be part of a larger change that also fixes the new problems found by flake8, also bumps versions on the listed flake8 plugins (other than the default ones like pycodestyle) and fixes new warnings from that, and possibly addresses other style issues and/or expands the scope of flake8 checks to cover the test suite. (The benefit of the latter is that it could reveal areas where the checks ought to be configured differently.) I plan to open such a PR shortly.
The text was updated successfully, but these errors were encountered:
The configuration for
flake8
in.pre-commit-config.yaml
--specifically that version 6.0.0 is used--is incompatible with Python 3.12, producing an incorrect "E231 missing whitespace after ':'" error:It also reports E226, which also happens only on Python 3.12, but appears intentional. But that's easy to fix (the simplest way being to add the spaces it wants, which also more resembles the overall style for the
+
operator in this project).The wrong
:
error (false positive E231) happens becauseflake8
6.0.0 depends onpycodestyle
2.10.*, which implements that check (E231) and has a parsing bug specific to Python 3.12. This was fixed in PyCQA/pycodestyle#1148.Upgrading to
flake8
6.1.0 gets the fix, since that version offlake8
, currently the latest, depends onpycodestyle
2.11.*, which has it:However, that reports E721 about the use of
==
to compare to atype
object. So I think it makes sense for a fix for this to be part of a larger change that also fixes the new problems found byflake8
, also bumps versions on the listedflake8
plugins (other than the default ones likepycodestyle
) and fixes new warnings from that, and possibly addresses other style issues and/or expands the scope offlake8
checks to cover the test suite. (The benefit of the latter is that it could reveal areas where the checks ought to be configured differently.) I plan to open such a PR shortly.The text was updated successfully, but these errors were encountered: