Skip to content

style: expand .clang-format with declaration alignment, pointer style, and loop formatting#318

Merged
plexoos merged 2 commits into
mainfrom
update-clang-format
May 1, 2026
Merged

style: expand .clang-format with declaration alignment, pointer style, and loop formatting#318
plexoos merged 2 commits into
mainfrom
update-clang-format

Conversation

@plexoos

@plexoos plexoos commented May 1, 2026

Copy link
Copy Markdown
Member

Expands .clang-format with three new formatting rules and reorders all keys alphabetically.

New rules

  • AlignConsecutiveDeclarations — enabled with AcrossEmptyLines: false, AcrossComments: false, and AlignFunctionDeclarations: false. Aligns the names in consecutive variable/member declarations without crossing blank lines, comments, or function signatures.
  • AllowShortLoopsOnASingleLine: true — permits simple for/while loops to stay on one line.
  • PointerAlignment: Left — attaches * and & to the type rather than the variable name (e.g. int* p instead of int *p).

Housekeeping

BreakConstructorInitializers: AfterColon was already present; this PR moves it to its correct alphabetical position. No behavior changes for any pre-existing rule.

Copilot AI review requested due to automatic review settings May 1, 2026 20:07

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the repository’s clang-format configuration to enforce alignment of consecutive declarations, improving formatting consistency across the C/C++ codebase.

Changes:

  • Enable AlignConsecutiveDeclarations: Consecutive in the root .clang-format.
  • Reorder existing clang-format keys (no functional impact beyond style configuration).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@plexoos plexoos force-pushed the update-clang-format branch from dda0cc4 to 9331230 Compare May 1, 2026 22:10
@plexoos

plexoos commented May 1, 2026

Copy link
Copy Markdown
Member Author

@copilot update the PR description to match the actual changes

Copilot AI commented May 1, 2026

Copy link
Copy Markdown
Contributor

@copilot update the PR description to match the actual changes

Updated the PR description to reflect the actual changes: adding AlignConsecutiveDeclarations with fine-grained options, AllowShortLoopsOnASingleLine: true, PointerAlignment: Left, and alphabetical reordering of keys.

Copilot finished work on behalf of plexoos May 1, 2026 22:28
@plexoos plexoos changed the title style: align consecutive declarations in clang-format style: expand .clang-format with declaration alignment, pointer style, and loop formatting May 1, 2026
@plexoos plexoos merged commit 5e9db7e into main May 1, 2026
14 checks passed
@plexoos plexoos deleted the update-clang-format branch May 1, 2026 22:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants