-
Notifications
You must be signed in to change notification settings - Fork 620
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
Add pre-commit support #1294
Add pre-commit support #1294
Conversation
Neat. What happens when you break one of the rules? Does it fix your commit for you? |
It looks like it edited some |
SVGs are XML files, interestingly. |
🤯 |
If there is a breakage it can either warn you and exit (for example for incorrect yaml) or edit the files itself (adding the newline/deleting the extra spaces). |
I also just enabled all the pre-commit hooks since I think there isn't much movement in the repo right now. So now could be a good time to just force formatting on everything. |
For reference on the Clang formatting: https://zed0.co.uk/clang-format-configurator/ |
Note that the documentation error is not due to this PR (the BOOM documentation / website is down for some reason) - This should be fixed in the next few hours / I had to re-buy the domain. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like forcing formatting on source code like this. No-trailing-whitespace is fine, but restructuring code and comments like this is too heavy-handed.
cf35bb3
to
292cc75
Compare
I personally think having a linter/code-formatter is better than not having one at all, but we can push that to a later discussion. For now this PR will just focus on whitespace management + checking files. |
@jerryz123 This is now ready for rereview |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing all the trailing-whitespace/newline issues. The git hooks thing seems useful.
See firesim/firesim#1329 for original PR.
This PR adds pre-commit support (https://pre-commit.com/) to run pre-commit hooks. Look at the
.pre-commit-config.yaml
file to see how pre-commit hooks are enabled. For a list of other supported plugins see https://pre-commit.com/hooks.html. To enable the hooks you have to run pre-commit install so I added that command to theenv.sh
file (this adds a small lag - ~O(s) - to the 1st time theenv.sh
is invoked but afterwards is a noop) (seebuild-setup.sh
). Additionally, to run the hooks on all files in the repo I ranpre-commit run --all-files
. Normally only the files that are committed are checked with the pre-commit hooks.Related PRs / Issues:
Type of change:
Impact:
Contributor Checklist:
main
as the base branch?changelog:<topic>
label?changelog:
label?.conda-lock.yml
file if you updated the conda requirements file?Please Backport
?