Skip to content
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

Adds format-filepath to customize the filepath of .clang-format #211

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

jr1221
Copy link

@jr1221 jr1221 commented Aug 4, 2024

See title.

This allows any file with valid clang format contents to be specified as the filepath.

In my organization this allows a submodule common across multiple C repositories to contain the clang-format, so an update of the submodule updates the styling across the org.

Closes #156

@jidicula jidicula marked this pull request as ready for review August 4, 2024 21:24
@jidicula jidicula marked this pull request as draft August 4, 2024 21:25
Copy link
Owner

@jidicula jidicula left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution! Could you add some test coverage in test/? I think it should be enough to move .clang-format in that directory to a nested directory and pass its new path to this arg that you've added to the shellscript invocation in test.sh.

@jr1221 jr1221 marked this pull request as ready for review August 6, 2024 00:49
@jr1221
Copy link
Author

jr1221 commented Aug 6, 2024

Should be ready. I needed to rename the format file not .clang-format so clang doesn't automatically find it and use it implicitly.
Please let me know if anything else is needed. Thanks for making a great action!

@jr1221
Copy link
Author

jr1221 commented Aug 6, 2024

Wow big oversight on my part. The syntax I am using for clang-format style=file: was added in clang 14. I guess there is not much that could be done here short of making the use of the file option conditional and adding a note in the documentation?

I pushed a fix to the CI for the clang 14+ failures.

@emik-dev
Copy link

Hey guys, how is this change progressing? This is something we are looking forward to. It would be great if we could get these changes integrated.

@mrousavy
Copy link

mrousavy commented Nov 4, 2024

Hey - is this PR still being worked on?

@jr1221
Copy link
Author

jr1221 commented Nov 7, 2024

Clang format before v14 does not have the filepath setting. Therefore in order to have passing CI behavior and correct operation on lower versions, I must re-arrange the way we test the format filepath setting. Ill work on that in the next week or two.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add -style file:<path> option
4 participants