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

flake8 and coverage.py syntax errors #39

Open
sarnold opened this issue Dec 16, 2022 · 3 comments
Open

flake8 and coverage.py syntax errors #39

sarnold opened this issue Dec 16, 2022 · 3 comments

Comments

@sarnold
Copy link

sarnold commented Dec 16, 2022

eg:

src/re2.pyx:106:9: E999 SyntaxError: invalid syntax

This didn't happen with older flake8 versions; the coverage thing is new. There are some issue/so discussions about cython and coverage.py and projects using the src/ layout. That last bit is usually src/<name> and isn't (by itself) a problem, except the cython coverage plugin apparently gets confused with includes and src/ without any __init__.py etc. :/

I'll keep looking but for now coverage is not working and flake8 config has E999 added to ignore list.

@sarnold
Copy link
Author

sarnold commented Dec 19, 2022

Update 1:

Turns out flake8 was an upstream red-herring since version 4 stops doing anything if the AST check fails, thus the (new) E999 warning and no additional output. Falling back to flake8<4 produces the expected indenting and other misc warnings. Sadly there is no official support for linting cython source that I know of, at least from the flake8 authors.

Update 2:

Although the latest cython (pre) releases do claim coverage support for src/ package layout, coverage.py and/or the cython.coverage plugin are still broken on the includes in this project. I still need to file an upstream bug and test an idea or two (pending feedback on the bug).

@andreasvc
Copy link
Owner

re update 2: if it makes life easier, let's rename src to re2 ? these tools expect the directory to have the same name as the module, right? Or is a package required as well?

@MarcoGorelli
Copy link

Sadly there is no official support for linting cython source that I know of, at least from the flake8 authors.

Sorry for the self-promo, but may I suggest trying out cython-lint? It parses the Cython AST directly, and implements many of the same checks

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

No branches or pull requests

3 participants