tensorflow / similarity

TensorFlow Similarity is a python package focused on making similarity learning quick and easy.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

black formatting

yonigottesman opened this issue · comments

Hi I noticed the style in the code varies a bit. What do you think of adding a github action that checks the black style + a pre-commit hook to do the formatting on changed file?
If you approve ill open a pr with the changes

Hi Yoni,

We had started with yapf, but I've been slowly moving to Black for formatting and isort for the import order. This is what kerascv is using and it would be great to be consistent with them.

Looking at their approach, it seems like they provide formatting and linting scripts. It also looks like they run the linting script as a githook pre-commit check and also as part of the github actions.

I think this approach might be cleaner than formatting in the github actions as it still allows users to check the formatting locally when they make the commit. wdyt?

Its a bad idea to format the code for a user without him having the option to review it first. what I meant was the github action will just validate the formatting rules, and the pre-commit hook will format the changed files of the commit and send them back from the staging area, so the user must do git add again on them.

Perfect, that sounds great. I'll assign the issue to you, but let me know if you need anything on my side.

Merged in #277. Thanks again for this.