koodaamo / tnefparse

a TNEF decoding library written in python, without external dependencies
GNU Lesser General Public License v3.0
49 stars 37 forks source link

Flake8 #66

Closed jugmac00 closed 4 years ago

jugmac00 commented 4 years ago

Flake8 is currently only used in GitHub actions.

I'd like to introduce a tox environment for Flake8.

Currently, there would be 78 Flake8 errors when I apply very strict rules.

While the most errors are pretty straight forward to fix, before I start I both wanted to know your take on it in general and especially E221 (multiple spaces before operator).

E221 would mark following code as erroneously formatted:

https://github.com/koodaamo/tnefparse/blob/6a02c0b59497b681fecf902ab565580b9899ff10/tnefparse/mapi.py#L30-L50

So, before I start. Is applying Flake8 welcome? Is is ok to re-format above code? If not - do you prefer noqa annotations per line or ignore E221 altogether?

Is it ok to enforce Flake8 via Travis / GitHub actions?

petri commented 4 years ago

I think E221 should be enforced, but not religiously. To me, the MAPI constants definitions are clearer with the "column - based approach". I think Flake8 had a way to omit a particular check for a whole module too? As in here? https://stackoverflow.com/a/54454433/1256394 . Would that work? EDIT: hm I see there's other code there so maybe per-line noqa is better.

jugmac00 commented 4 years ago

TIL: There is an option to ignore a specific violation per file, but not in the file itself, but via configuration - looks a bit clunky to me and it does not seem to be bug-free either https://gitlab.com/pycqa/flake8/-/issues/517

I'd prefer the line specific annotation.

per-file-ignores =
    project/__init__.py:F401
    setup.py:E121
    other_project/*:W9