-
-
Notifications
You must be signed in to change notification settings - Fork 732
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 implementation #1740
Conversation
Oh, I just noticed that this is not a strictly required build step. But still, having at least one red light is not quite good, I guess. 🤔 |
I'm happy to exclude freertos and driver folders from clang format. The re isn't much in this format I insist on; mostly I use this to stop my ide's folding code at 80 characters or putting {} on their own lines. |
…g-format to keep enums init
Ookay... I tweaked a bit I tried briefly to find some options myself... but I got luck with enums only. So, what I would disable in the first place:
But |
What we may want to do is instead pick an upstream standard one clang-format knows (Google,LLVM etc) and then just stack overrides on that. |
Official documentation doesn't make much of a sense to me for some reason BTW. For example, it says:
Okay, sounds what can be tweaked to disable warnings for macros. Check version in docker:
Okay, 13 > 9. Trying by adding this into
and run
and even after removing
😶 |
As far as I understand, the current |
…e - part 1 out of N
…sing advanced version of diff to get more advanced output to parse & navigate log more easily
… target to make output compatible with gcc-like error compilation format for compatibility with IDEs/editors for easy navigation over files to fix style errors
…ted file names with wrong code style for debug purposes
…logging from makefile
…lean, clear, and tidy
…using reasonable advises ... and then disable it in Makefile from scanning by clang-format
Ufff... what an adventure! Here is a brief write-up of what has been done:
Surprisingly, there were not so many big issues and considering that the rest of the files are having coherent style, I guess current tweaks of
Now, as of for these two "expected checks"... as far as I understand from this conversation, since there is an update of P.S. I swear, I came to this project only to do a couple of PRs for tiny features for my own single one iron... and I even didn't have time to start work on them yet! 🤣 |
And here is how build steps look with current |
…couple of headers a bit
… conditional blocks
…ments style; left two errors intentionally to debug & improve parser
…i-line condition in if-s
Brief status update:
Please, let me know what you think because I can't wait to hear back from you & crew. P.S. If I have to rationale the braces for loop/conditions then I can say that in the most inappropriate moment it can easily fire back when you in the heat of testing/debugging/fixing put just only one extra line to some block not having them. Footnotes
|
I have a couple of thoughts how to improve a bit manageability of |
Yeah definitely seperate PR. I think this is good to go btw, just want to recheck when I'm more awake 😂 |
What kind of change does this PR introduce?
clang-format
check on github CI.What is the current behavior?
make check-style
is not running on github CI via actions. It successful only because it doesn't return error code to the environment:find
external tool is not provided in a container butbusybox
built-in implementation offind
doesn't support required flag forfind
incheck-style
target.What is the new behavior (if this is a feature change)?
Make
check-style
run "successfully"1 (unfortunately) with a lot of warnings.Other information:
Maybe I miss something but while I was working on a slightly different modifications, nearly by accident I discover this situation. Is there any chance that you're aware of that and this is a supposed behavior?
P.S.
To be fully honest with you, I personally in my humble opinion find some of the suggestions by
clang-format
a bit strange because for me they look like "formality over read-ability" likeenum
style declarations or some recommendations on comments style. So maybe instead of makingclang-format
happy, just.clang-format
config can be tweaked a bit. ;)Plus, some source files, especially those which were auto-generated by STM-related IDEs or obtained as 3rd party projects as FreeRTOS/usb-pd/etc., probably should be excluded at all from checking.
Regardless your decision over formatting rules I will be glad to help with code reformatting. As always, let me know what you think about all of this.
Oh, and I took some liberty to split/rename build steps with tests & checks for unification in naming and splitting by code language.
Footnotes
it depends how to treat it. ↩ ↩2