-
Notifications
You must be signed in to change notification settings - Fork 2
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
Precommit addition to the repo #82
base: develop
Are you sure you want to change the base?
Conversation
1282316
to
741140d
Compare
@ryandanehy, can we stage this PR? First stage would be to set up configurations. Once that is merged, we can run formatting on the code and have a separate PR to merge formatted code. Is that doable? |
Once we merge this any push to a PR that rebased on Develop will automatically format the code. I can change the CI to only run when manually triggered if that is preferred? Essentially options are manual trigger or automatically with every push to a PR. |
daf4126
to
fd3d082
Compare
@pelesh I think this is good to go with the merge. Then I will open a new pr with all the precommit suggested code changes. The precommit ci fails currently because it thinks the code is not format correctly so it is doing it jobs correctly. |
Let's review. I propose we merge it after #83 and #86 are merged. |
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.
A few changes, but as well we should verify this auto-fixes changes before merging. Your pipelines are failing, and they should be abl to fix themselves.
# - uses: EndBug/add-and-commit@v9.1.3 | ||
# # Only need to try and commit if the action failed | ||
# if: failure() | ||
# with: | ||
# fetch: false | ||
# committer_name: GitHub Actions | ||
# committer_email: actions@github.com | ||
# message: Apply pre-commmit fixes |
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 think we want pre-commit to automatically apply fixes, so lets comment this back in
workflow_dispatch: | ||
inputs: | ||
branch: | ||
description: 'The branch to build' | ||
required: true |
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.
workflow_dispatch: | |
inputs: | |
branch: | |
description: 'The branch to build' | |
required: true |
If we just run on pull_request
, doesn't that generate the desired behavior?
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 was trying to set it to manual so that people could start the workflow as needed. This is in reference to #82 (comment).
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.
Well I suggest maybe deferring the implementation of that new feature into a different PR since it doesn't seem to work here, and is unclear at the moment.
Maybe instead you could also code a GitHub bot that can run the fixes for us automatically if you really want to over-engineer this...
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 still don't get this. Why not just on pull_request
... Your code seems like it's non-functional as I have never seen manual pipelines before
.pre-commit-config.yaml
Outdated
ci: | ||
autofix_commit_msg: | | ||
[pre-commit.ci] auto fixes from pre-commit.com hooks | ||
|
||
for more information, see https://pre-commit.ci | ||
autofix_prs: true | ||
autoupdate_branch: '' | ||
autoupdate_commit_msg: '[pre-commit.ci] pre-commit autoupdate' | ||
autoupdate_schedule: weekly | ||
skip: [] | ||
submodules: false |
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'm not familiar with this configuration section. Shouldn't we just use what's in the GitHub action to autofix, and then customize the commit message there?
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 still don't think this configuration section is necessary at all. The commit message is controlled by the GitHub action, and this does nothing.
@cameronrutherford I commented out the auto fixes per slaven request for this PR. See #82 (comment) The pipelines fail because it wants to autofix but I am not letting it. |
I guess we merge this with failing pipelines then :( |
The other option is to enable auto checks and we merge this PR last thing before the release. Once we turn on style auto-correction all rebasing and merging will turn into a nightmare. |
Since you can now rebase automatically with buttons, it's not so bad. I do agree though that with PRs in motion it would be easier to merge this after those. |
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.
Is it possible to run pre-commit locally or it runs only on GitHub?
We need at least minimal documentation in the top-level README file on how to use pre-commit before this can get merged.
Also, some tweaks to the configuration options are needed. For example, I noticed pre-commit tries to sort include directives alphabetically what is not something we really want.
@pelesh I rebased, added some instructions in the main readme.md, and fixed pre-commit so that it does not sort includes. Let me your thoughts so we can get this merged. |
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.
Getting there
workflow_dispatch: | ||
inputs: | ||
branch: | ||
description: 'The branch to build' | ||
required: true |
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 still don't get this. Why not just on pull_request
... Your code seems like it's non-functional as I have never seen manual pipelines before
.pre-commit-config.yaml
Outdated
ci: | ||
autofix_commit_msg: | | ||
[pre-commit.ci] auto fixes from pre-commit.com hooks | ||
|
||
for more information, see https://pre-commit.ci | ||
autofix_prs: true | ||
autoupdate_branch: '' | ||
autoupdate_commit_msg: '[pre-commit.ci] pre-commit autoupdate' | ||
autoupdate_schedule: weekly | ||
skip: [] | ||
submodules: false |
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 still don't think this configuration section is necessary at all. The commit message is controlled by the GitHub action, and this does nothing.
README.md
Outdated
### Running Pre-commit locally | ||
To run pre-commit locally you first must install pre-commit. It can be installed via | ||
```shell | ||
pip install pre-commit | ||
``` | ||
|
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.
How do I install pip? What about Python? What if I am on a linux vs mac?
README.md
Outdated
|
||
To install the hooks and have pre-commit run automatically before every commit run | ||
```shell | ||
pre-commit install |
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.
pre-commit install | |
pre-commit install --install-hooks |
```shell | ||
pre-commit run --all-files | ||
``` | ||
To learn more about pre-commit usuage check out https://pre-commit.com/#usage. |
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.
Maybe add some more information here about:
- Rebasing against auto-fixes in PRs
- Understanding git-flow in this context
- What do I do when pre-commit fails?
- Why does all this new stuff appear when I run
git commit
?
I believe the failed test on Ascent is due to issue fixed in #109. Perhaps a good idea would be rebasing to |
more docs on pre-commit
3fe3220
to
2d45845
Compare
Just rebased. |
pre-commit tests are still failing and no auto-fix is being applied |
https://pre-commit.ci/
clang format style
cmake style formatting [docs]
Fixes #5
Fixes #54