Skip to content

tools/nxstyle: indent code against its enclosing brace, not modulo 4 - #19933

Draft
raiden00pl wants to merge 3 commits into
apache:masterfrom
raiden00pl:nxstyle_fixes_pr3
Draft

tools/nxstyle: indent code against its enclosing brace, not modulo 4#19933
raiden00pl wants to merge 3 commits into
apache:masterfrom
raiden00pl:nxstyle_fixes_pr3

Conversation

@raiden00pl

Copy link
Copy Markdown
Member

Summary

tools/nxstyle: indent code against its enclosing brace, not modulo 4

Impact

nuttx standard compatibility

Testing

correctly detect wrong alignment like below:

int demo(int a)
{
  switch (a)
    {
        case 1:      /* case label belongs at column 6 */
          a++;
          break;

      default:
              a--;
          break;
    }

      if (a > 0)     /* statement belongs at column 2 */
        {
          a = 0;
        }

  return a;
}

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
The check added by the preceding commit reports ten braces in nxstyle.c
that do not line up with the brace they close, and a comment that does
not share the column of the run it belongs to.  Bring the whole file
into line with the standard, so that the checks added by the commits
that follow are not introduced against a file that breaks them.

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
@github-actions github-actions Bot added Area: Tooling Size: XL The size of the change in this PR is very large. Consider breaking down the PR into smaller pieces. labels Aug 22, 2026
@github-actions

Copy link
Copy Markdown

MemBrowse Memory Report

No memory changes detected for:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: Tooling Size: XL The size of the change in this PR is very large. Consider breaking down the PR into smaller pieces.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant