Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linting: 'tox.ini' is out of sync with GHA CI #303

Closed
tseaver opened this issue May 26, 2024 · 5 comments · Fixed by #304
Closed

Linting: 'tox.ini' is out of sync with GHA CI #303

tseaver opened this issue May 26, 2024 · 5 comments · Fixed by #304

Comments

@tseaver
Copy link
Member

tseaver commented May 26, 2024

On the HEAD of the master branch:

$ git log -1
commit 5a38cf60aa22a36d6dd0ac8b7973690317ebd946 (HEAD -> master, origin/master, origin/HEAD)
Author: Jens Vagelpohl <jens@plyp.com>
Date:   Fri May 24 07:56:52 2024 +0200

    - vb [ ci skip]
$ tox -e lint
lint: commands[0]> isort --check-only --diff /home/tseaver/projects/Zope/Z3/zope.interface/src /home/tseaver/projects/Zope/Z3/zope.interface/setup.py
ERROR: /home/tseaver/projects/Zope/Z3/zope.interface/src/zope/interface/interface.py Imports are incorrectly sorted and/or formatted.
--- /home/tseaver/projects/Zope/Z3/zope.interface/src/zope/interface/interface.py:before	2024-05-25 18:58:07.854281
+++ /home/tseaver/projects/Zope/Z3/zope.interface/src/zope/interface/interface.py:after	2024-05-25 20:34:16.442644
@@ -1133,16 +1133,16 @@
     classImplements(InterfaceClass, IInterface)
 
 
+# This ensures that ``Interface`` winds up in the flattened()
+# list of the immutable declaration. It correctly overrides changed()
+# as a no-op, so we bypass that.
 # We import this here to deal with module dependencies.
 # pylint:disable=wrong-import-position
+from zope.interface.declarations import _empty
 from zope.interface.declarations import implementedBy
 from zope.interface.declarations import providedBy
 from zope.interface.exceptions import BrokenImplementation
 from zope.interface.exceptions import InvalidInterface
 
 
-# This ensures that ``Interface`` winds up in the flattened()
-# list of the immutable declaration. It correctly overrides changed()
-# as a no-op, so we bypass that.
-from zope.interface.declarations import _empty
 Specification.changed(_empty, _empty)
ERROR: /home/tseaver/projects/Zope/Z3/zope.interface/src/zope/interface/__init__.py Imports are incorrectly sorted and/or formatted.
--- /home/tseaver/projects/Zope/Z3/zope.interface/src/zope/interface/__init__.py:before	2024-05-25 18:58:07.854281
+++ /home/tseaver/projects/Zope/Z3/zope.interface/src/zope/interface/__init__.py:after	2024-05-25 20:34:16.456263
@@ -58,8 +58,8 @@
 _wire()
 del _wire
 
+# The following are to make spec pickles cleaner
 from zope.interface.declarations import Declaration
-# The following are to make spec pickles cleaner
 from zope.interface.declarations import Provides
 from zope.interface.declarations import alsoProvides
 from zope.interface.declarations import classImplements
lint: exit 1 (0.31 seconds) /home/tseaver/projects/Zope/Z3/zope.interface> isort --check-only --diff /home/tseaver/projects/Zope/Z3/zope.interface/src /home/tseaver/projects/Zope/Z3/zope.interface/setup.py pid=201268
  lint: FAIL code 1 (0.33=setup[0.02]+cmd[0.31] seconds)
  evaluation failed :( (0.46 seconds)

If I silence the isort bits with this patch:

diff --git a/src/zope/interface/__init__.py b/src/zope/interface/__init__.py
index 8be812d..4d9a828 100644
--- a/src/zope/interface/__init__.py
+++ b/src/zope/interface/__init__.py
@@ -58,7 +58,7 @@ from zope.interface.interface import _wire
 _wire()
 del _wire
 
-from zope.interface.declarations import Declaration
+from zope.interface.declarations import Declaration # isort: skip
 # The following are to make spec pickles cleaner
 from zope.interface.declarations import Provides
 from zope.interface.declarations import alsoProvides
diff --git a/src/zope/interface/interface.py b/src/zope/interface/interface.py
index 8e0d9ad..e55ee7f 100644
--- a/src/zope/interface/interface.py
+++ b/src/zope/interface/interface.py
@@ -1144,5 +1144,6 @@ from zope.interface.exceptions import InvalidInterface
 # This ensures that ``Interface`` winds up in the flattened()
 # list of the immutable declaration. It correctly overrides changed()
 # as a no-op, so we bypass that.
-from zope.interface.declarations import _empty
+# pylint:disable=wrong-import-position
+from zope.interface.declarations import _empty # isort: skip

then tox -e lint blows up with a huge list of pyflake errors.

Meanwhile, the GHA lint task shows green, which isn't to surprising, as its pylint call is commented out!

What is our story for linting here?

/cc @dataflake @icemac

@tseaver
Copy link
Member Author

tseaver commented May 26, 2024

Also, the pypy3 tox environment fails the doctests, because pypy has repr differences with CPython.

I'm finding it annoying that the doctests are run for every environment, actually: I'd prefer that then just run in the docs environment.

@tseaver
Copy link
Member Author

tseaver commented May 26, 2024

The PR to fix flake8 is going to be one miserable review. You might just have to trust me, especially given that we have no linting happening in GHA.

@dataflake
Copy link
Member

This is the first time I have noticed the commented out linter. And I wonder why it is using pylint, which we don't use anywhere else.

@tseaver
Copy link
Member Author

tseaver commented May 26, 2024

@dataflake this seems to be back to the earliest days of meta GHA for the c-code config.

@dataflake
Copy link
Member

I tried the simplest possible fix for the meta template here: zopefoundation/meta#246

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants