From 294941ab2ed0d1d3f3ee54a8d51d3130fa51d239 Mon Sep 17 00:00:00 2001 From: Pavel Dolgov Date: Mon, 18 Jul 2016 15:11:43 +0300 Subject: [PATCH] Java inspection: Improved descriptions and messages for "Add Braces" and "Remove Braces" inspections. Test data updated. (IDEA-157727) --- .../siyeh/InspectionGadgetsBundle.properties | 4 +-- .../ControlFlowStatementWithoutBraces.html | 4 +-- .../SingleStatementInBlock.html | 1 + .../style/single_statement_block/expected.xml | 28 +++++++++---------- 4 files changed, 18 insertions(+), 19 deletions(-) diff --git a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/InspectionGadgetsBundle.properties b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/InspectionGadgetsBundle.properties index 86b92f43163e..d8ce66c56396 100644 --- a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/InspectionGadgetsBundle.properties +++ b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/InspectionGadgetsBundle.properties @@ -2203,7 +2203,7 @@ replace.equality.with.equals.name=Replace Equality with Equals replace.equality.with.equals.descriptor=Replace ''{0}'' with ''{1}equals()'' replace.equality.with.safe.equals.name=Replace Equality with Safe Equals replace.equality.with.safe.equals.descriptor=Replace ''{0}'' with safe ''{1}equals()'' -single.statement.in.block.name=Code Block Contains Single Statement +single.statement.in.block.name=Code block contains single statement single.statement.in.block.descriptor=''{0}'' contains single statement single.statement.in.block.quickfix=Remove braces from ''{0}'' statement -single.statement.in.block.family.quickfix=Remove Braces From Statement \ No newline at end of file +single.statement.in.block.family.quickfix=Remove braces from statement \ No newline at end of file diff --git a/plugins/InspectionGadgets/src/inspectionDescriptions/ControlFlowStatementWithoutBraces.html b/plugins/InspectionGadgets/src/inspectionDescriptions/ControlFlowStatementWithoutBraces.html index dd8eb8837735..5afff14a47b8 100644 --- a/plugins/InspectionGadgets/src/inspectionDescriptions/ControlFlowStatementWithoutBraces.html +++ b/plugins/InspectionGadgets/src/inspectionDescriptions/ControlFlowStatementWithoutBraces.html @@ -4,8 +4,6 @@ Reports any if, while or for statements without braces. Braces make the code easier to read and help prevent errors when modifying the code. - -

- +

The quick fix for the inspection wraps the statement body with braces. \ No newline at end of file diff --git a/plugins/InspectionGadgets/src/inspectionDescriptions/SingleStatementInBlock.html b/plugins/InspectionGadgets/src/inspectionDescriptions/SingleStatementInBlock.html index 7ee68dfec244..4a4132a7d46f 100644 --- a/plugins/InspectionGadgets/src/inspectionDescriptions/SingleStatementInBlock.html +++ b/plugins/InspectionGadgets/src/inspectionDescriptions/SingleStatementInBlock.html @@ -2,5 +2,6 @@ This inspection reports control flow statements with only a single statement in their code block. +

The quick fix for the inspection removes braces from the statement body. diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/style/single_statement_block/expected.xml b/plugins/InspectionGadgets/test/com/siyeh/igtest/style/single_statement_block/expected.xml index d049f6bf366a..9d1103579b2d 100644 --- a/plugins/InspectionGadgets/test/com/siyeh/igtest/style/single_statement_block/expected.xml +++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/style/single_statement_block/expected.xml @@ -4,98 +4,98 @@ SingleStatement.java 4 - Code Block Contains Single Statement + Code block contains single statement 'for' contains single statement SingleStatement.java 8 - Code Block Contains Single Statement + Code block contains single statement 'if' contains single statement SingleStatement.java 10 - Code Block Contains Single Statement + Code block contains single statement 'else' contains single statement SingleStatement.java 14 - Code Block Contains Single Statement + Code block contains single statement 'if' contains single statement SingleStatement.java 19 - Code Block Contains Single Statement + Code block contains single statement 'else' contains single statement SingleStatement.java 23 - Code Block Contains Single Statement + Code block contains single statement 'for' contains single statement SingleStatement.java 28 - Code Block Contains Single Statement + Code block contains single statement 'do' contains single statement SingleStatement.java 34 - Code Block Contains Single Statement + Code block contains single statement 'while' contains single statement SingleStatement.java 40 - Code Block Contains Single Statement + Code block contains single statement 'if' contains single statement SingleStatement.java 41 - Code Block Contains Single Statement + Code block contains single statement 'for' contains single statement SingleStatement.java 42 - Code Block Contains Single Statement + Code block contains single statement 'if' contains single statement SingleStatement.java 43 - Code Block Contains Single Statement + Code block contains single statement 'for' contains single statement SingleStatement.java 46 - Code Block Contains Single Statement + Code block contains single statement 'else' contains single statement SingleStatement.java 50 - Code Block Contains Single Statement + Code block contains single statement 'else' contains single statement