gerlero / foamlib

A modern Python interface for interacting with OpenFOAM
https://foamlib.readthedocs.io
GNU General Public License v3.0
13 stars 2 forks source link

Add linting tool: flake8 both to pyproject.toml and CI pipeline #21

Closed abzrg closed 7 months ago

abzrg commented 7 months ago

Hi,

With some investigations, I added an step in the lint job of github actions for flake8. Hope it's correct.

For now, I added all the errors and warnings emitted by flake8 to the ignore entry to keep these commits simple. One of these warnings was about the length of the line. This can be configured in pyproject.toml for both black (line-length) and flake8 (max-line-length). Some of the lines were above 200 chars of length, so I simply ignored that warning.

Further, among these errors, I think the E712[^1] warning can be simply fixed by replacing == with is True and != with is not True.

[^1]: E712: comparison to True should be 'if cond is True:' or 'if cond:'

Let me know if you think I can help with any of these.

abzrg commented 7 months ago

It seems that It has worked. At the end of CI log, it shows the count of errors, which is 0 for now.

codecov-commenter commented 7 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 89.83%. Comparing base (3a3fa39) to head (48d79cd).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #21 +/- ## ======================================= Coverage 89.83% 89.83% ======================================= Files 4 4 Lines 610 610 ======================================= Hits 548 548 Misses 62 62 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

gerlero commented 7 months ago

LGTM. I've managed to remove the E712 exception but left the others (although those could be fixed too; I just couldn't do it now). Thanks again @abzrg!

abzrg commented 7 months ago

Happy to help (: