nils-braun / b2luigi

Task scheduling and batch running for basf2 jobs made simple
GNU General Public License v3.0
17 stars 11 forks source link

Feature/add pre commit linters #86

Closed meliache closed 3 years ago

meliache commented 3 years ago

Add pre-commit linters and flake8-checks for PEP8.

Didn't to much configuration for flake8 except except a very loose max line length of 132, which basf2 uses. Personally I usually try to stay somewhere below 120, so feel free to suggest something smaller. Also we could add custom ignores for certain errors or classes of errors but usually, e.g. pycodestyle warnings (W), but I think the defaults should be fine for a start and we can add exceptions later if we need them.

I just included the pre-commit checks in the test-action for the moment, but I could also create a custom github action with a custom yaml-file for that, but I fear that would result in some duplicated yaml-code, not sure what's best there. It fits very loosely the definition of a test. The pre-commit configuration is adapted from here. I'm not sure if it requires pre-commit to be installed as a depencency, I haven't tested the action yet.

Also I updated the developer documentation on how to installl pre-commit and while I was at it I also changed the publishing part to mention that it's now done automatically via github actions.

Fixes #85

meliache commented 3 years ago

Seems the pre-commit action already runs for this PR and it was checking all files and not only the changed ones, so I now commited all pre-commit suggestions. Most are trailing-whitespace, end-of-file newlines, etc. So if viewing the diff, I recommend disabling whitespace diffs, which can be done in github in the diff settings (gear icon) or in the CLI with

git diff --ignore-all-space --ignore-blank-lines main...feature/add-pre-commit-linters 
codecov-io commented 3 years ago

Codecov Report

Merging #86 (8f4733a) into main (bbf4f22) will decrease coverage by 0.20%. The diff coverage is 90.90%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #86      +/-   ##
==========================================
- Coverage   51.71%   51.50%   -0.21%     
==========================================
  Files          23       23              
  Lines        1402     1396       -6     
==========================================
- Hits          725      719       -6     
  Misses        677      677              
Impacted Files Coverage Δ
b2luigi/basf2_helper/data.py 0.00% <ø> (ø)
b2luigi/basf2_helper/targets.py 33.33% <ø> (ø)
b2luigi/basf2_helper/tasks.py 37.50% <ø> (ø)
b2luigi/batch/cache.py 50.00% <ø> (ø)
b2luigi/batch/workers.py 88.23% <ø> (ø)
b2luigi/core/dispatchable_task.py 94.11% <ø> (-0.89%) :arrow_down:
b2luigi/core/task.py 71.15% <ø> (ø)
b2luigi/core/temporary_wrapper.py 100.00% <ø> (ø)
b2luigi/core/utils.py 72.10% <66.66%> (ø)
b2luigi/__init__.py 100.00% <100.00%> (ø)
... and 9 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update bbf4f22...8f4733a. Read the comment docs.