Aiven-Open / pghoard

PostgreSQL® backup and restore service
http://aiven-open.github.io/pghoard/
Apache License 2.0
1.32k stars 97 forks source link

Include a basic pre-commit configuration #536

Closed nicois closed 1 year ago

nicois commented 2 years ago

This adds a very simple pre-commit configuration. It will make it easier for contributers to verify their code is correctly formatted before pushing.

This initial version simply executed yapf, mypy and pylint.

codecov[bot] commented 2 years ago

Codecov Report

Merging #536 (d1c43e8) into main (65f57f6) will decrease coverage by 0.00%. The diff coverage is 84.79%.

@@            Coverage Diff             @@
##             main     #536      +/-   ##
==========================================
- Coverage   89.42%   89.41%   -0.01%     
==========================================
  Files          29       29              
  Lines        4490     4487       -3     
==========================================
- Hits         4015     4012       -3     
  Misses        475      475              
Impacted Files Coverage Δ
version.py 100.00% <ø> (ø)
pghoard/logutil.py 64.00% <50.00%> (-1.39%) :arrow_down:
pghoard/gnutaremu.py 82.38% <69.23%> (ø)
pghoard/basebackup_delta.py 78.32% <72.22%> (ø)
pghoard/basebackup.py 84.95% <74.57%> (ø)
pghoard/webserver.py 89.83% <80.39%> (+0.70%) :arrow_up:
pghoard/compressor.py 92.64% <81.25%> (ø)
pghoard/config.py 92.07% <84.61%> (ø)
pghoard/archive_cleanup.py 92.30% <85.71%> (ø)
pghoard/pghoard.py 82.63% <86.11%> (-0.17%) :arrow_down:
... and 18 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 65f57f6...d1c43e8. Read the comment docs.

nicois commented 2 years ago

isort and yapf are mutually incompatible, as the changes made by one conflict with the other. Given many files needed to be reformatted either way, I have taken the liberty of using a different import sorter, which I find provides for cleaner diffs (and cherry-picks).

kmichel-aiven commented 2 years ago

isort and yapf are mutually incompatible, as the changes made by one conflict with the other. Given many files needed to be reformatted either way, I have taken the liberty of using a different import sorter, which I find provides for cleaner diffs (and cherry-picks).

I'd rather not introduce difference with other repositories we have, where we settled on isort/black (which are compatible): https://github.com/aiven/rohmu/pull/51/commits/ec0feb3ad35b08ce543332de4eaf0b7e40324d23 https://github.com/aiven/myhoard/pull/84/commits/489cf959c12633cd8c1d765c5223625272b35ddf + https://github.com/aiven/myhoard/pull/84/commits/d99b99880e64e1e60ab115d2d2e6badd9d9a7346

nicois commented 2 years ago

ok, updated to use black. I can rebase this when other major PRs are merged, to reduce the need to reformat works in progress.

Ormod commented 1 year ago

Would be a good improvement but the PR conflicts badly so closing this one, please reopen if you want to come back to this.