tools/nxstyle: fix most of the incompatibilities with the coding standard - #19555
Draft
raiden00pl wants to merge 14 commits into
Draft
tools/nxstyle: fix most of the incompatibilities with the coding standard#19555raiden00pl wants to merge 14 commits into
raiden00pl wants to merge 14 commits into
Conversation
The standard requires braces after 'if', 'else', 'while', 'for' and 'do' even when the body is a single statement. Nothing checked this. Signed-off-by: raiden00pl <raiden00@railab.me> Assisted-by: Claude Code
Braces were only tested against a multiple of the indentation unit, so one at the wrong level still passed. Signed-off-by: raiden00pl <raiden00@railab.me> Assisted-by: Claude Code
A residue modulo four expresses neither the indentation unit nor the alignment of case logic, and all of it was disabled from the first switch to the end of the enclosing function. Signed-off-by: raiden00pl <raiden00@railab.me> Assisted-by: Claude Code
Only lines beginning with a C keyword were checked, so an assignment or a call could sit at any column. Signed-off-by: raiden00pl <raiden00@railab.me> Assisted-by: Claude Code
The fixed list of type names holds neither uint64_t nor any NuttX typedef, so declarations using them went unchecked. Signed-off-by: raiden00pl <raiden00@railab.me> Assisted-by: Claude Code
The standard asks for a blank line between the local declarations at the head of a function and the code. A declaration is recognised by its shape, since no list of type names can be complete. Signed-off-by: raiden00pl <raiden00@railab.me> Assisted-by: Claude Code
Taking the nesting left at the end of the line mistook a statement that opens a multi-line condition for one standing inside parentheses. Signed-off-by: raiden00pl <raiden00@railab.me> Assisted-by: Claude Code
The brace was compared against the line before it rather than the line the statement began on, so a macro broken over two lines was reported. Signed-off-by: raiden00pl <raiden00@railab.me> Assisted-by: Claude Code
…races Alternatives selected by conditional compilation share the braces that follow, and a branch may hold statements before reaching its condition. Signed-off-by: raiden00pl <raiden00@railab.me> Assisted-by: Claude Code
fix nxstyle issues for tools/nxstyle.c Signed-off-by: raiden00pl <raiden00@railab.me> Assisted-by: Claude Code
nxstyle checks one file per invocation. nxstyle_sweep.sh runs it over the directories given, or the whole repository, and collects what it reports. Signed-off-by: raiden00pl <raiden00@railab.me> Assisted-by: Claude Code
fix nxstyle errors for sched Signed-off-by: raiden00pl <raiden00@railab.me> Assisted-by: Claude Code
fix nxstyle errors for audio Signed-off-by: raiden00pl <raiden00@railab.me> Assisted-by: Claude Code
fix nxstyle errors for net Signed-off-by: raiden00pl <raiden00@railab.me> Assisted-by: Claude Code
jerpelea
approved these changes
Jul 28, 2026
Contributor
|
@raiden00pl please fix conflict |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes a lot of gaps in the nxstyle tool. Unfortunately, the codebase contains many inconsistencies with the coding standard. Fixing everything might mess up git history a bit, so I'm not sure if it's worth it.
For now I only fixed nxstyle.c, sched, audio and net
Impact
better compatibility with nuttx coding style.
This solves some of the issues related to nxstyle, but I didn't check which ones: https://github.com/apache/nuttx/issues?q=is%3Aissue%20state%3Aopen%20nxstyle
Testing
Output from
/tools/nxstyle_sweep.shthat checks all files: