WEAK_WARNING -> GENERIC_ERROR_OR_WARNING in three inspections

Now there inspection use configured highlight level instead of
forced weak warning: null check to safe call, reformat, sort modifiers
This commit is contained in:
Mikhail Glukhikh
2018-02-20 19:38:23 +03:00
parent 17e64ebae0
commit acd8edaa9c
3 changed files with 17 additions and 13 deletions
@@ -20,14 +20,16 @@ import org.jetbrains.kotlin.types.TypeUtils
class NullChecksToSafeCallInspection : AbstractKotlinInspection() {
override fun buildVisitor(holder: ProblemsHolder, isOnTheFly: Boolean, session: LocalInspectionToolSession) =
binaryExpressionVisitor { expression ->
if (isNullChecksToSafeCallFixAvailable(expression)) {
holder.registerProblem(expression,
"Null-checks replaceable with safe-calls",
ProblemHighlightType.WEAK_WARNING,
NullChecksToSafeCallCheckFix())
}
binaryExpressionVisitor { expression ->
if (isNullChecksToSafeCallFixAvailable(expression)) {
holder.registerProblem(
expression,
"Null-checks replaceable with safe-calls",
ProblemHighlightType.GENERIC_ERROR_OR_WARNING,
NullChecksToSafeCallCheckFix()
)
}
}
private class NullChecksToSafeCallCheckFix : LocalQuickFix {
override fun getName() = "Replace chained null-checks with safe-calls"
@@ -52,11 +52,13 @@ class ReformatInspection : LocalInspectionTool() {
}.filterNotNull()
return elements.map {
ProblemDescriptorImpl(it, it,
"File is not properly formatted",
arrayOf(ReformatQuickFix),
ProblemHighlightType.WEAK_WARNING, false, null,
isOnTheFly)
ProblemDescriptorImpl(
it, it,
"File is not properly formatted",
arrayOf(ReformatQuickFix),
ProblemHighlightType.GENERIC_ERROR_OR_WARNING, false, null,
isOnTheFly
)
}.toTypedArray()
}
@@ -44,7 +44,7 @@ class SortModifiersInspection : AbstractKotlinInspection(), CleanupLocalInspecti
holder.registerProblem(
list,
message,
ProblemHighlightType.WEAK_WARNING,
ProblemHighlightType.GENERIC_ERROR_OR_WARNING,
SortModifiersFix(sortedModifiers)
)
}