imagededup icon indicating copy to clipboard operation
imagededup copied to clipboard

Add pre-commit and isort for easier contributing

Open Emilv2 opened this issue 3 years ago • 2 comments

pre-commit makes automatically running checks (linting, isort, tests, ...) on commit easy. I've only added an isort hook in this PR, but many more are available.

isort automatically sorts the imports according to configurable rules. I think I've added the rules that most closely following the current guidelines. There is some configurability possible if you would like it behave differently.

IMO Black is also really worth looking into. It automates away all the formatting for you so you don't have to worry about that. Many Python projects are switching to it.

I think these could make helping new contributors to quickly and easily adhere to the contributor guidelines.

Of course, if you don't like any of this just close this PR. I just thought it could make development a bit easier by automating some of the boring work.

Emilv2 avatar Dec 20 '20 18:12 Emilv2

Codecov Report

Merging #130 (59aeb63) into dev (fd9f32f) will not change coverage. The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##              dev     #130   +/-   ##
=======================================
  Coverage   95.22%   95.22%           
=======================================
  Files          18       18           
  Lines         670      670           
=======================================
  Hits          638      638           
  Misses         32       32           
Impacted Files Coverage Δ
imagededup/evaluation/evaluation.py 100.00% <ø> (ø)
imagededup/handlers/metrics/classification.py 100.00% <ø> (ø)
...agededup/handlers/metrics/information_retrieval.py 98.11% <100.00%> (ø)
imagededup/handlers/search/retrieval.py 100.00% <100.00%> (ø)
imagededup/methods/__init__.py 100.00% <100.00%> (ø)
imagededup/methods/cnn.py 97.91% <100.00%> (ø)
imagededup/methods/hashing.py 99.18% <100.00%> (ø)
imagededup/utils/data_generator.py 100.00% <100.00%> (ø)
imagededup/utils/general_utils.py 100.00% <100.00%> (ø)
imagededup/utils/image_utils.py 96.29% <100.00%> (ø)
... and 1 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 fd9f32f...59aeb63. Read the comment docs.

codecov-io avatar Dec 20 '20 18:12 codecov-io

Thanks for pre-commit pointer, will look into it. As for black, we already use it in our daily workflow and have been doing so with the development of this package. In fact, I also recommend using an IDE like pycharm that comes pre-equipped with capabilities that quickly allows one to catch such issues.

The idea of this PR is good, have been thinking of making style guidelines clearer as noted in #126 . Will get to reviewing this PR soon-ish.

tanujjain avatar Dec 21 '20 15:12 tanujjain