MarcoGorelli / cython-lint

Lint Cython files
MIT License
68 stars 11 forks source link

ENH Add --ignore flag #66

Closed jeremiedbb closed 1 year ago

jeremiedbb commented 1 year ago

towards #64

Added a --ignore flag that accepts a comma separated list of pycodestyle error codes to ignore.

I wasn't sure how to deal with the precomputed set PYCODESTYLE_CODES. I assume these ones are necessary to not have false positive due to specific cython syntax. So for now I just make a union of the 2 sets.

MarcoGorelli commented 1 year ago

thanks @jeremiedbb

just for my understanding, in your application, are you only looking at ignoring some pycodestyle ones, or also some of cython-lint's own ones?

jeremiedbb commented 1 year ago

When lint the scikit-learn cython files, all specific cython-lint errors needed to be fixed. There was some pycodestyle errors that we do ignore in our config file for flake8 and it felt weird to not ignore them for cython files as well.

So for my specific use case it's indeed only pycodestyle errors.

Since cython-lint specific errors don't have an error code it would be hard to use the same ignoring mechanism. I guess we'd have to introduce error codes. But it maybe something to consider as a future step ?

MarcoGorelli commented 1 year ago

Since cython-lint specific errors don't have an error code it would be hard to use the same ignoring mechanism. I guess we'd have to introduce error codes. But it maybe something to consider as a future step ?

yup, definitely :)

Just for peace of mind, any chance we could please add another test like this one

https://github.com/MarcoGorelli/cython-lint/blob/b29cd19101e374fbc98fa667f644563da19e8ccf/tests/main_test.py#L460-L473

but which uses ignore?

Instead of

fd.write('[pycodestyle]\nstatistics=True\n')

we could write something which would normally generate multiple pycodestyle errors, but if you use ignore, then some of them would not get displayed

MarcoGorelli commented 1 year ago

legend, thanks!

MarcoGorelli commented 1 year ago

should be good, I'll merge and release tomorrow morning, just heading out now

MarcoGorelli commented 1 year ago

released in version 0.14.0