From 3ff5c95419e0aa7a123899f445fcf6632ea95067 Mon Sep 17 00:00:00 2001 From: Kirill Rakhman Date: Fri, 21 Jul 2017 16:17:43 +0300 Subject: [PATCH] Improve inspection message for NullableBooleanElvisInspection Also report as "should" or "can" depending on severity So #KT-19006 Fixed --- idea/src/META-INF/plugin.xml | 2 +- .../NullableBooleanElvisInspection.kt | 8 ++++--- .../inspectionData/expected.xml | 24 +++++++++---------- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/idea/src/META-INF/plugin.xml b/idea/src/META-INF/plugin.xml index ed583973293..775d0fb9b93 100644 --- a/idea/src/META-INF/plugin.xml +++ b/idea/src/META-INF/plugin.xml @@ -2305,7 +2305,7 @@ /> parentIfOrWhile.condition else -> null } - val highlightType = - if (condition != null && condition in expression.parentsWithSelf) GENERIC_ERROR_OR_WARNING else INFORMATION + val (highlightType, verb) = if (condition != null && condition in expression.parentsWithSelf) + GENERIC_ERROR_OR_WARNING to "should" + else + INFORMATION to "can" holder.registerProblem(expression, - "Equality check can be used instead of elvis", + "Equality check $verb be used instead of elvis for nullable boolean check", highlightType, ReplaceWithEqualityCheckFix()) } diff --git a/idea/testData/inspections/nullableBooleanElvis/inspectionData/expected.xml b/idea/testData/inspections/nullableBooleanElvis/inspectionData/expected.xml index ed949048701..a02ffb07bb0 100644 --- a/idea/testData/inspections/nullableBooleanElvis/inspectionData/expected.xml +++ b/idea/testData/inspections/nullableBooleanElvis/inspectionData/expected.xml @@ -4,48 +4,48 @@ 4 light_idea_test_case - Equality check can be used instead of elvis - Equality check can be used instead of elvis + Equality check can be used instead of elvis for nullable boolean check + Equality check should be used instead of elvis for nullable boolean check test.kt 7 light_idea_test_case - Equality check can be used instead of elvis - Equality check can be used instead of elvis + Equality check can be used instead of elvis for nullable boolean check + Equality check should be used instead of elvis for nullable boolean check test.kt 10 light_idea_test_case - Equality check can be used instead of elvis - Equality check can be used instead of elvis + Equality check can be used instead of elvis for nullable boolean check + Equality check should be used instead of elvis for nullable boolean check test.kt 10 light_idea_test_case - Equality check can be used instead of elvis - Equality check can be used instead of elvis + Equality check can be used instead of elvis for nullable boolean check + Equality check should be used instead of elvis for nullable boolean check test.kt 13 light_idea_test_case - Equality check can be used instead of elvis - Equality check can be used instead of elvis + Equality check can be used instead of elvis for nullable boolean check + Equality check can be used instead of elvis for nullable boolean check test.kt 14 light_idea_test_case - Equality check can be used instead of elvis - Equality check can be used instead of elvis + Equality check can be used instead of elvis for nullable boolean check + Equality check can be used instead of elvis for nullable boolean check \ No newline at end of file