desy-ml/cheetah

Automatic `black`

jank324 opened this issue · 3 comments

Should we set up black to automatically format the code on commits or pushes? Right now it only checks and complains when the code is not formatted correctly.

@cr-xu didn't you look into this before?

On a second thought, maybe requiring the contributors to install pre-commit is a better solution
So... pros and cons of using GH Actions to reformat and commit:
Pro:

  • Contributor don't need to care about the formatting

Con:

  • Contributor would need to pull everytime the new code after the Github Action is done, otherwise might risk running into merge conflicts
  • Commit history would be heavily populated/doubled
  • I think the commit wouldn't work in a PR created from a public fork (like the Space charge case) due to how Github handles secret

The cons seem to clearly outweigh the pros here. I think we should leave it as is, and maybe (a) make the contribution guidelines more comprehensive and (b) add a checkmark to PRs "I have read the contribution guidelines".