Remove braces around single-statement if blocks to maintain consistent code style and improve readability. This applies to all control flow statements with single statements, including if, else if, and else blocks.
Remove braces around single-statement if blocks to maintain consistent code style and improve readability. This applies to all control flow statements with single statements, including if, else if, and else blocks.
The codebase follows a consistent style where braces are omitted for single-statement conditionals. This reduces visual clutter and maintains consistency across the project.
Examples:
โ Avoid:
if (condition) {
return;
}
if (pWindow) {
pWindow->close();
}
โ Prefer:
if (condition)
return;
if (pWindow)
pWindow->close();
Exception: Keep braces when the statement spans multiple lines or when it improves clarity in complex nested conditions.
This rule helps maintain visual consistency throughout the codebase and follows the established project conventions. Apply this consistently across all new code and when modifying existing code.
Enter the URL of a public GitHub repository