From 72d3d4546f3ffac069727989f6e2ea77e1289dfc Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Mon, 2 Mar 2026 00:53:47 -0500 Subject: [PATCH] Redo the NeedBraces rule to require braces on if statements with else blocks. --- checkstyle.json | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/checkstyle.json b/checkstyle.json index 2a7ca94ea..7c5fb3ad8 100644 --- a/checkstyle.json +++ b/checkstyle.json @@ -476,15 +476,16 @@ "comment": "If enabled, mandates the use of braces on specific block types, unless they fit on a single line.", "props": { "allowSingleLineStatement": true, - "tokens": [ - "FUNCTION", - "FOR", - "IF", - "ELSE_IF", - "WHILE", - "DO_WHILE", - "CATCH" - ], + "tokens": ["FUNCTION", "FOR", "IF", "IF_WITH_ELSE", "ELSE"], + "severity": "INFO" + }, + "type": "NeedBraces" + }, + { + "comment": "If enabled, mandates the use of braces on specific block types, and prevent them from being placed on a single line.", + "props": { + "allowSingleLineStatement": false, + "tokens": ["IF_WITH_ELSE", "CATCH", "WHILE", "DO_WHILE", "ELSE_IF"], "severity": "INFO" }, "type": "NeedBraces"