initialcommit-com/git-sim

Suggestion: Can we use a formatter (e.g black)?

paketb0te opened this issue · 5 comments

IMO a formatter like black improves readability and consistency of the code, maybe that could be something to adopt?

Just an idea, let me know what you think @initialcommit-io

(most editors / IDEs support some sort of "format-on-save" functionality AFAIK, or it could be set up as a pre-commit hook I guess...)

@paketb0te Yes I am open to this, I use Vim so maybe I could use a pre-commit hook like you suggested. Let me look into the formatter and some other options and I'll get back to you.

@paketb0te Let's do it. I asked @marksmayo to resubmit a PR for this which I will merge. Then we can use black going forward. Thanks for the suggestion!

Any other special notes on using black that we should be aware of? This will be my first time using it.

@initialcommit-io no, it has good defaults, we can just run it as-is IMO.

Only thing to keep in mind: It will reformat all files, so whoever runs the formatting and then commits back to the repo will be the author of the last change for everything (e.g. if you do a git blame, the person who did the reformatting wil show up (until a new commit made changes of course), instead of the "original" author. Therefore I suggest that YOU run the formatting and commit it, because you wrote 99% of the code...

Good point. I will do the formatting now with black, and if there is some import cleanup or commas to be added as in the pull request, @marksmayo can clean that up.

Reformatted and pushed in as a part of v0.1.6

Closing this - all contributors please use black for formatting going forward.