-
Notifications
You must be signed in to change notification settings - Fork 99
Use fixed clang format #1405
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
Use fixed clang format #1405
Changes from all commits
b93a16f
1e51515
1db9847
370ff2a
6a98b11
d578455
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| name: Check formatting | ||
| on: workflow_call | ||
|
|
||
| jobs: | ||
| pre-commit: | ||
| name: Run pre-commit hooks | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout the latest code (shallow clone) | ||
| uses: actions/checkout@v4 | ||
| - name: Run Pre-Commit checks | ||
| run: cp .github/check-format.sh /tmp && /tmp/check-format.sh | ||
| id: pre-commit | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| - name: Upload code formatting patch | ||
| if: ${{ failure() }} | ||
| uses: actions/upload-artifact@v3 | ||
| with: | ||
| name: patch | ||
| path: format.patch |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| repos: | ||
| - repo: https://github.com/pre-commit/mirrors-clang-format | ||
| rev: 'v14.0.0' # The default in Ubuntu 22.04, which is used in our CI | ||
|
Comment on lines
+1
to
+3
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. because it install clang-format by pip, I wonder it affects/updates the local python package without notification. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't really know, how the user environment is changes. But what I can tell you is that on my system, where I use pre-commit, I don't have clang-14 in my path, even though it is used by pre-commit. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. After some search, it is handled by python virtualenv. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For what do you need it in your editor? You can just run There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I usually run several times clang-format during coding with the default shortcut. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, I mean no-concatenation will introduce issue from inconsistent clang-format. 2 is from local clang-format (break when it is too long) 3 is format 1 from pre-commit clang-format, less indention so no need for breaking 4 is format 2 from pre-commit clang-format, no-concatenation if it is already split 3 and 4 are different. If we apply format directly, we should get 3. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can you still provide your clang-format version? I will still look into the issue you mentioned. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TBH, I think this might be one of those issues which just change depending on the clang format versions. and the pre-commit gave me: which is your 2. But maybe it depends more on the actual example. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The issue happens when the different indention format clang-format, that's why the example is under the assumption. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure if I understand your point. The whole point of this PR is to fix a clang-format version that is used both in the CI and each local repo. |
||
| hooks: | ||
| - id: clang-format | ||
| types_or: [c, c++, cuda, inc] | ||
| exclude: third_party/SuiteSparse/AMD/.* | ||
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.
abidiff is deleted accidentally
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.
yes, I will revert that, when I prepare this branch for merging