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:
@@ -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)
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user