Pre-commit hooks for Formatting #1948
Pre-commit hooks for Formatting #1948pcarruscag merged 10 commits intosu2code:developfrom kursatyurt:pre-commit-hooks
Conversation
|
The order of includes may cause some issues |
Adding Now it works well on my PC, sorry I missed checking. |
|
Thanks. Is it possible to target only some paths for formatting? I'm concerned about making life too difficult for developers, and we cannot break lines in some files because we parse them to generate some python code. |
@pcarruscag As far as I understand yes it is possible with the I look at the regression test the values seem okay but the test fails is this due to wrappers? If you tell me which directories should be omitted, I would adjust it quickly. In general, we can also disable column limit/wrapping from |
pcarruscag
left a comment
There was a problem hiding this comment.
Ill figure out the list of exclusions this weekend and let you know
|
Alright, let's do the following, for now please exclude: Please wait for #1903 and #1951 to be merged. |
|
@pcarruscag , excellent, thank you. |
|
Alright, please go ahead when you can. |
|
Maybe start this fresh and force-push so that we don't get the history of the other formatting iterations. |
|
Ready to merge. Please don't forget to add I will add the usage of |
|
It seems you committed the old version of the submodules that were updated recently |
Sorry for the mess, it is the first time for me with submodules. Cleaned. |
Proposed Changes
Even though the website has a style guide and the repo has a
.clang-formatfile it has not strictly applied to pull requests. There is no style-checking workflow. As different users use different environment sometimes pull request contains unrelated style changes which makes the PR unreadable. This PR proposes to use pre-commit-hooks which are easy to use and enforce the style and adds a workflow check for formatting.There is no formatted/style proposed for python files. This PR additionally proposes a black based python formatting that ensures the python files are consistent maximum line length is set to 120 to increase readability.
Moreover, pre-commit has additional hooks for the style of files.
The following ones are proposed:
trailing-whitespace - trims trailing whitespace.-> Especially useful for config files.mixed-line-ending - replaces or checks mixed line ending.end-of-file-fixer - ensures that a file is either empty or ends with one newline.the pre-commit hooks can be easily installed via pip
pip install pre-commitPR Checklist
Put an X by all that apply. You can fill this out after submitting the PR. If you have any questions, don't hesitate to ask! We want to help. These are a guide for you to know what the reviewers will be looking for in your contribution.