.clang-format: add InsertBraces: true and minor fix to FormatSource.ps1#13712
Merged
.clang-format: add InsertBraces: true and minor fix to FormatSource.ps1#13712
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR aims to enforce brace insertion after control flow statements by adding InsertBraces: true to .clang-format, and fixes a minor issue in the PowerShell formatting script. However, the automated brace insertion has introduced critical compilation errors.
Key Changes:
- Added
InsertBraces: trueconfiguration to.clang-format - Fixed
FormatSource.ps1.into handle execution when$PSScriptRootis empty and corrected property access patterns - Applied automated brace insertion to control flow statements across the codebase
Reviewed Changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 25 comments.
Show a summary per file
| File | Description |
|---|---|
| .clang-format | Added InsertBraces: true configuration option to enforce braces on single-statement control blocks |
| tools/FormatSource.ps1.in | Fixed script to handle direct PowerShell invocation and corrected object property access patterns using $_.Name |
| src/windows/service/exe/WslCoreVm.cpp | CRITICAL BUG: Brace insertion broke 12 try-catch patterns where CATCH_LOG() macro is now separated from try blocks |
| src/windows/service/exe/WslCoreInstance.cpp | CRITICAL BUG: Brace insertion broke 2 try-catch patterns with CATCH_LOG() macro |
| src/windows/service/exe/LxssUserSession.cpp | CRITICAL BUG: Brace insertion broke 3 try-catch patterns with CATCH_LOG() macro |
| src/windows/service/exe/LxssInstance.cpp | CRITICAL BUG: Brace insertion broke 1 try-catch pattern with CATCH_LOG() macro |
| src/windows/common/svccomm.cpp | CRITICAL BUG: Brace insertion broke 2 try-catch patterns with CATCH_LOG() macro |
| src/windows/common/socket.cpp | Added braces to if statement; change is correct (has inline catch block) |
| src/windows/common/WslCoreConfig.cpp | CRITICAL BUG: Brace insertion broke 2 try-catch patterns with CATCH_LOG() macro |
| src/windows/common/WslClient.cpp | CRITICAL BUG: Brace insertion broke 1 try-catch pattern with CATCH_LOG() macro |
| src/linux/netlinkutil/Packet.h | Added braces to simple if-return statements; changes are correct |
| src/linux/netlinkutil/IpNeighborManager.cpp | Added braces to simple if-return statements and continue statement; changes are correct |
| src/linux/init/waitablevalue.h | Added braces to while loops with single wait statements; changes are correct |
| src/linux/init/init.cpp | CRITICAL BUG: Brace insertion broke 1 try-catch pattern with CATCH_RETURN_ERRNO() macro |
| src/linux/init/config.cpp | CRITICAL BUG: Brace insertion broke 1 try-catch pattern with CATCH_LOG() macro |
| src/linux/init/SecCompDispatcher.cpp | Added braces to if-break statement; change is correct |
cdba2de to
fe3d2f5
Compare
Member
Author
|
Wild, I'm not sure what happened there I swear I built it locally - must have forgotten. |
OneBlue
approved these changes
Nov 14, 2025
benhillis
added a commit
that referenced
this pull request
Nov 26, 2025
* wslsettings: allow OOBE window to close with escape key (#13686) * wslsettings: allow OOBE windows to close with escape key * fix memory leak --------- Co-authored-by: Ben Hillis <benhill@ntdev.microsoft.com> * Localization change from build: 133610492 (#13704) Co-authored-by: WSL localization <noreply@microsoft.com> * wslsettings: fix OOBE text truncation at 200% text scaling (#13693) * wslsettings: fix OOBE text truncation at 200% text scaling Add text scaling factor to window resize calculation and make hero image height responsive to text scaling. Increase minimum window size for better accessibility. Fix MAS 1.4.4 compliance for OOBE dialog. * pr feedback --------- Co-authored-by: Ben Hillis <benhill@ntdev.microsoft.com> * wslsettings: add underlines to links in about page (#13703) Co-authored-by: Ben Hillis <benhill@ntdev.microsoft.com> * .clang-format: add InsertBraces: true and minor fix to FormatSource.ps1 (#13712) Co-authored-by: Ben Hillis <benhill@ntdev.microsoft.com> * Localization change from build: 134015316 (#13731) Co-authored-by: WSL localization <noreply@microsoft.com> * wslsettings: ensure selected setting is auto-expanded and selected (#13689) * wslsettings: ensure selected setting is auto-selected Implement keyboard focus management for SettingsExpander controls across settings pages. This resolves an accessibility issue reported internally. * add asserts --------- Co-authored-by: Ben Hillis <benhill@ntdev.microsoft.com> * build: fix minor compiler errors when building with VS2026 (#13744) * build: fix minor compiler errors when building with VS2026 * s * use VS2022 for clang format and cross compiling --------- Co-authored-by: Ben Hillis <benhill@ntdev.microsoft.com> * chore(distributions): Almalinux auto-update - 20251119 12:04:35 (#13743) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * Mask systemd-networkd-wait-online.service during boot (#13611) * deps: update a number of NuGet packages to the latest available versions (#13728) Co-authored-by: Ben Hillis <benhill@ntdev.microsoft.com> * Notice change from build: 134267142 (#13751) Co-authored-by: WSL notice <noreply@microsoft.com> * Add *.slnx to .gitignore (#13754) * Fix service crash when collecting a linux crash dump when maxCrashDumpCount is set to 0 (#13755) * Fix service crash when collecting a linux crash dump when maxCrashDumpCount is set to 0 * Move the check inside the function * cleanup: VirtioNetworking refactoring (#13760) * cleanup: update VirtioNetworking class to not rely on the WslCoreConfig struct * cleanup: simplify VirtioNetworking construction * remove old constructor and other cleanup * more minor cleanup * string cleanup in HandleVirtioModifyOpenPorts --------- Co-authored-by: Ben Hillis <benhill@ntdev.microsoft.com> * cleanup: switch from Microsoft::WRL::ComPtr to wil::com_ptr (#13767) * cleanup: switch from Microsoft::WRL::ComPtr to wil::com_ptr * reformat --------- Co-authored-by: Ben Hillis <benhill@ntdev.microsoft.com> * chore(distributions): Almalinux auto-update - 20251124 17:13:02 (#13780) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * Notice change from build: 134527933 (#13782) Co-authored-by: WSL notice <noreply@microsoft.com> * cleanup: VirtioNetworking refactoring to be more portable (#13783) * cleanup: VirtioNetworking refactoring to be more portable * more refactoring * make m_guestDeviceManager private --------- Co-authored-by: Ben Hillis <benhill@ntdev.microsoft.com> --------- Co-authored-by: Ben Hillis <benhill@ntdev.microsoft.com> Co-authored-by: Blue <OneBlue@users.noreply.github.com> Co-authored-by: WSL localization <noreply@microsoft.com> Co-authored-by: AlmaLinux Autobot <107999298+almalinuxautobot@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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.
Update .clang-format to enforce braces after if statements. Also while testing this I noticed a small issue with the source formatting script that was causing it to not work when run directly from powershell.