MarcoGorelli / cython-lint

Lint Cython files
MIT License
69 stars 11 forks source link

parity with flake8? #45

Closed MarcoGorelli closed 1 year ago

MarcoGorelli commented 1 year ago

Taking this conversation over from https://github.com/scipy/scipy/pull/17812#issuecomment-1404113723

MarcoGorelli commented 1 year ago

@stefanv @tupui this should be available as of version 0.11.0, please do let me know if anything trips you up!

tupui commented 1 year ago

Cool thanks 🙏

stefanv commented 1 year ago

Indeed, thanks very much!

stefanv commented 1 year ago

Out of curiosity, what is the correct way to wrap a line like:

cdef double plus1b_cython(double a, double b, int *error_flag, void *user_data) nogil except *
MarcoGorelli commented 1 year ago

if it's too long, do you mean?

does

cdef double plus1b_cython(
    double a,
    double b,
    int *error_flag,
    void *user_data
) nogil except *

work?

stefanv commented 1 year ago

Thanks, that should work. I guess so it starts: not all projects will like splitting the definition over multiple lines, so can we disable certain checks for certain files?

MarcoGorelli commented 1 year ago

You can use --max-line-length

stefanv commented 1 year ago

Right, but then I have to do two runs, one for pxi files with long lines, one for regular Cython files.

MarcoGorelli commented 1 year ago

that's right - I don't really think it's worth adding complexity for this, if someone has such a need they can just run it twice (once for pxd, once for pyx)