-
Notifications
You must be signed in to change notification settings - Fork 217
chore(dev): Run cython-lint against codebase, add it to pre-commit
#1130
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. I'm a big fan of linting and pre-commits so I like this in general.
Unfortunately, many of the files that required changes here are autogenerated files, so next time we regenerate the files these violations will just come back.
I think we need to either:
- Fix these violations in
cython-genandcybind(the two generator tools that contribute these files, then regenerate and commit the result here. - Ignore all auto-generated files in this check.
I think the first is the better long-term solution, but it will require some back-and-forth across the 3 projects.
Actually, it looks like just |
|
Thanks, @MarcoGorelli! Big fan of your projects (including Unfortunately, in addition to the concern that Mike noted (that Would you mind rebasing and purging all changes to |
…`), add it to `pre-commit`
96508de to
1fd64c8
Compare
|
that's very kind, thank you! sure, I reset the commit add excluded |
|
/ok to test 1fd64c8 |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
|
|
In passing I noticed this error when adding the (There is no traceback.) Maybe a bug in |
|
hi @rwgk that means that Cython's I'd suggest reporting this to Cython itself |
|
For easy reference, this is the existing except Exception as exp: # pragma: no cover
# If Cython can't parse this file, just skip it.
print(
f"Skipping file {filename}, as it cannot be parsed. Error: {exp!r}",
)
raise CythonParseError from expUnfortunately the original error and the traceback don't appear. → I'm giving up (and I think most people will give up) right there. WDYT about (totally untested and with a huge amount of guessing): except Exception as exp: # pragma: no cover
# If Cython can't parse this file, just skip it.
sys.stderr.flush()
print(
f"Skipping file {filename}, as it cannot be parsed. Error: {exp!r}",
)
traceback.print_exc(file=sys.stdout)
sys.stdout.flush()
raise CythonParseError from expWill that surface the I'm also wondering: |
|
sure, i've reported it here: cython/cython#7235 |
Description
closes
closes #941
This PR adds
cython-linttopre-commitand fixes the flagged lint violations (mostly unused imports and variables)Checklist