-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Clang-Format the FreeRTOS-Kernel #762
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #762 +/- ##
==========================================
+ Coverage 93.64% 93.74% +0.09%
==========================================
Files 6 6
Lines 2549 2589 +40
Branches 608 610 +2
==========================================
+ Hits 2387 2427 +40
Misses 107 107
Partials 55 55
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Sentry. |
I am bin fan of using However, I have two questions/concerns with this implementation:
We are consuming multiple FreeRTOS projects into our project and we enforce that these files are not reformatted, instead keep the FreeRTOS style so that updating and seeing the actual changes is simpler. xyz-project/src/our-sources
...
xyz-project/src/FreeRTOS/.clang-format # matching version of the file copied from the CI/CD repository
xyz-project/src/FreeRTOS/FreeRTOS-Kernel
xyz-project/src/FreeRTOS/FreeRTOS-Plus-TCP and we could simply run What is your opinion on this? |
include/queue.h
Outdated
@@ -217,22 +221,33 @@ typedef struct QueueDefinition * QueueSetMemberHandle_t; | |||
* QueueHandle_t xQueue1; | |||
* | |||
* // Create a queue capable of containing 10 uint32_t values. | |||
* xQueue1 = xQueueCreate( QUEUE_LENGTH, // The number of items the queue can hold. | |||
* xQueue1 = xQueueCreate( QUEUE_LENGTH, // The number of items the queue can | |||
hold. |
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.
Formatting here looks incorrect.
c7b2a65
to
e4e34de
Compare
Hey @swaldhoer, glad to hear that you'd also be interested in using clang-format in this repo!
This is actually an intentional decision.
This is also an intentional choice. We will then maintain that all repos that use the CI-CD-Github-Actions/clang-formatting action use the same format file by running a check against all onboarded repos, as seen here. This way if the "common" .clang-format file is modified, in such a way that it changes the formatting of the files in a repo, we instantly know that the repos need to have their individual ones updated.
First off I'm glad to hear that you're consuming multiple FreeRTOS projects and repository in your project! And I've got some good news for you then! Additionally, using the FreeRTOS/CI-CD-Github-Action formatting check now provides a git patch that can be manually downloaded and applied to your code base. OR! Once #787 gets merged in, you could actually copy the formatting bot github workflow file from this repository and use that to apply your formatting automatically. This bot is already applied to the other FreeRTOS-LTS repos mentioned before. Where think the above should help you with maintaining code consistency with your projects? However, to answer your question about clang-format itself: The reason we haven't merged these changes across our repository is due to worries about the way clang-format handles some specific cases:
Clang-format version: tasks.c:xTaskCreateStatic:1278
(another really rough looking example of this can be found here, if you're curious)
Which then changes to:
The team is working on finding out if there's a way for us to swap to clang-format while minimizing these risks, or if it's possible to tweak the clang-format file enough to solve these issues If you have any suggestions for how to tweak our clang-format file to potentially solve some of these issues, or any other suggestions, it'd be greatly appreciated if you'd share those! |
Regarding 81fd37c: it is not necessary to pollute the code base with clang-format commands, you can just set Regarding fixed clang-format version: The argument can be perfectly twisted around: You pin the version in the CI to the at this date latest version. Because auf backwards compatibility this should not lead to problems for contributes, but we have a defined version. Therefore, we get the both benefits: The version is defined, and the developer workflow is smooth. For things like https://github.com/FreeRTOS/FreeRTOS-Kernel/pull/762/files?diff=unified&w=1#diff-325c4a46abe8fc694989d41460987b02695b3da183826ec9c317a444f1287a09L48 this I have not yet found a working solution for your configuration style. In our project, we move the comments above and set static List_t xDelayedCoRoutineList1; /**< Delayed co-routines. */
/**< Delayed co-routines (two lists are used - one for delays that have overflowed the current tick count. */
static List_t xDelayedCoRoutineList2;
/**< Points to the delayed co-routine list currently being used. */
static List_t *pxDelayedCoRoutineList = NULL;
/**< Points to the delayed co-routine list currently being used to hold co-routines that have overflowed the current tick count. */
static List_t *pxOverflowDelayedCoRoutineList = NULL;
/**< Holds co-routines that have been readied by an external event. They cannot be added directly to the ready lists as the ready lists cannot be accessed by interrupts. */
static List_t xPendingReadyCoRoutineList; but as you said you don't want to have this style. For the Regarding the common clang-format style across repos: perfect, thanks. |
Kudos, SonarCloud Quality Gate passed! |
@Skptak Has clang-format as formatter for this project been dropped? What is the current formatting rule for the repository? If it has been dropped, is this something you will reconsider in the future or if not, what's the plan? |
Hey @swaldhoer, sorry for the delay |
Description
Swap all files to use clang-format instead of uncrustify
Use a new spell checker
Use new version of some CI-CD Actions
Relevant PR for CI-CD-Actions can be found here
Test Steps
Checklist:
Related Issue
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.