HaarigerHarald / geant4_pybind

Alternative Python bindings for Geant4
The Unlicense
35 stars 7 forks source link

feat: add pre-commit automatic code formatting tool #19

Open lobis opened 11 months ago

lobis commented 11 months ago

Add .pre-commit-config.yaml configuration file for pre-commit tool.

This will run some code formatting automatically: clang-format, black, formatting cmake files, etc.

The pre-commit bot can be configured to automatically enforce this style in PRs.

I have not formatted the whole repo using this configuration file as it would be a very big diff. If you agree on using pre-commit, we could let the CI bot do it.

HaarigerHarald commented 11 months ago

Thanks, I'm not sure about using all those formatters but clang-format as pre-commit hook is definitely a nice addition.

lobis commented 11 months ago

Thanks, I'm not sure about using all those formatters but clang-format as pre-commit hook is definitely a nice addition.

I can simplify the list for now.

Most come from https://github.com/scientific-python/cookie/blob/main/.pre-commit-config.yaml which I would say is the standard for modern scientific Python repositories.

I'll finish this PR and tag you when it's done.