Skip to content

Add braces to all braceless for statements in src/#223

Draft
billy1arm with Copilot wants to merge 1 commit into
masterfrom
copilot/modify-for-statements-to-add-braces
Draft

Add braces to all braceless for statements in src/#223
billy1arm with Copilot wants to merge 1 commit into
masterfrom
copilot/modify-for-statements-to-add-braces

Conversation

Copilot AI commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

All for statements in src/ (excluding SD3 and Eluna submodules) that lacked braces around their bodies have been wrapped with Allman-style braces to match the existing codebase convention.

Changes

  • 119 files modified — 118 via automated transformation, ObjectGuid.h manually (macro lines require \ continuation alignment)
  • Automated script (/tmp/add_for_braces.py) — tokenizer-based C++ parser that handles comments, string literals, and \ line continuations; processes nested braceless for loops correctly via multi-pass convergence; applies all insertions right-to-left to avoid position-shifting bugs
  • Macro lines skipped by scriptfor loops on \-terminated lines are excluded from automated transformation; the two braceless cases in DEFINE_READGUIDBYTES / DEFINE_WRITEGUIDBYTES were fixed manually with correct \ alignment

Before / After

// Before
for (uint8 i = 0; i < PVP_TEAM_COUNT; ++i)
    for (GroupsQueueType::const_iterator citr = ...; citr != ...; ++citr)
    {
        InviteGroupToBG((*citr), bg2, (*citr)->GroupTeam);
    }

// After
for (uint8 i = 0; i < PVP_TEAM_COUNT; ++i)
{
    for (GroupsQueueType::const_iterator citr = ...; citr != ...; ++citr)
    {
        InviteGroupToBG((*citr), bg2, (*citr)->GroupTeam);
    }
}

Inline single-statement bodies (e.g. for (...) stmt;) are expanded to multi-line Allman style with correct re-indentation.


This change is Reviewable

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants