-
Notifications
You must be signed in to change notification settings - Fork 448
Adiabatically turn on pre-commit
#678
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@vloncar what do you think about this approach? |
I think this is great. I still didn't get around to check how does the formatted C++ look like. I guess we should also note in the documentation about contributing that users are advised to run |
@vloncar to see the diff if we do Note there are still some manual things that we would need to fix (mostly flake8 violations), but they're all pretty trivial. |
This looks great! Is there any way to keep some of the current conventions? I understand black's preference, but the codebase uses single quotes everywhere in python, so majority of the changes are related to that. So maybe we add In HLS code, can we use 4 spaces instead of two ( |
@vloncar updated as you requested and new diff is here: jmduarte/hls4ml@pre-commit...jmduarte:hls4ml:pre-commit-run-all |
Thanks, I'm liking this one a lot. Is there a way to exclude some C++ files? I'm thinking the contents of ap_fixed and ac_fixed. These are (mostly) copied from the vendors, perhaps we should keep them intact, as it would be easier to track any future changes to them. |
yes, let me add that. i was thinking the same. |
Anyone else with their style preferences? This is the perfect bikeshedding PR 😄 If not, I propose we merge it. |
@vloncar no complaints, so I say we merge 😄 |
And now, the avalanche of changes begins 🏔️ |
* pre-commit * update p-clang-format * update p-clang-format * update manifest * update manifest * add citation * update format * add null clang formats * file-level * style file * global exclude * try without file-level clang-format * add pre-commit to PR template
Adiabatically turn on
pre-commit
. The idea is thatpre-commit
is only run on files touched in a PR. Simultaneously we can open PRs to runpre-commit
on files not often updated (or that just aren't touched by any open PRs). Eventually, we can run it on the whole repo.Changes
pre-commit
configclang-format
config (@vloncar which style do you prefer? This is basically LLVM style stolen from scikit-hep/boost-historgram)p-clang-format
to keep pragmas indented at the right levelpre-commit
GitHub action that should only operate on files touched in the PRNote the con that this may make it harder to review PRs (as a lot of changes will just be style). To be discussed if that's an issue.
To see what it would look like if we ran this on the whole repo in one go, you can check out this branch and do (on Linux):
I say on Linux, because there seems to be some
sed
issue with OSX.