-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Add action to auto format pull requests and pushes #7975
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
Comments
For reference, in most new Espressif projects we use pre-commit framework to format the code at commit time. For example, https://github.com/espressif/esp-bsp/blob/160c0d66d851c3e247de4c535dc8ddad5a7e585f/.pre-commit-config.yaml#L6 |
I love the idea of a consistent coding style. |
Sharing this as another option: https://peterevans.dev/posts/github-actions-how-to-automate-code-formatting-in-pull-requests/ In general, we would like to implement this, we are now in phase of investigating the best option how to do this. |
"Important caveat 1: Due to token restrictions on public repository forks these workflows do not work for pull requests raised from forks. Private repositories can be configured to enable workflows from forks to run without restriction." |
Yes, formatting is not applied to PR from forks. This question is explained on link in my first post. |
yea, tokens restriction is somehow manageable but there are other cons, sharing 2 points from @igrr:
So far pre commit hook looks as a best option, there are some requirements on developers side and also we need to think about some special cases as option to skip it, it's influence on review process, exceptions and so on. |
Related area
Software contribuition
Hardware specification
All boards
Is your feature request related to a problem?
Hi!
I'm have noticed some maintainers and reviewers complaining about code formatting in PR here.
I would like to request to someone with more skills than me to create a script to apply formatting to all contributions for this repository.
I know that Espressif team is using Artistic style as formatter.
I was doing some tests with this action but later I have noticed that it only does a dry run for check for non compliant code.
Anyway I think the script used for this action can be useful as base to create the action for this repository.
I know there's security problems while triggering an action from public fork but I'm sure that this problem can be solved.
Alternatively I would like to suggest the use of lint with clang formatter as shown on example below.
On example below the commit with formatting changes is always signed by someone with write permission in this repository.
Best regards.
Describe the solution you'd like
Here an basic example:
Describe alternatives you've considered
No response
Additional context
No response
I have checked existing list of Feature requests and the Contribution Guide
The text was updated successfully, but these errors were encountered: