support SuppressWarning annotation

pull/726/head^2
caikang.ck 5 years ago
parent 54bbd465b3
commit 87ba60818d

@ -32,10 +32,9 @@ import org.jetbrains.annotations.Nls
* @author caikang
* @date 2016/12/16
*/
class AliPmdInspection(private val ruleName: String)
: LocalInspectionTool(),
AliBaseInspection,
PmdRuleInspectionIdentify {
class AliPmdInspection(private val ruleName: String) : LocalInspectionTool(),
AliBaseInspection,
PmdRuleInspectionIdentify {
override fun manualBuildFix(psiElement: PsiElement, isOnTheFly: Boolean): LocalQuickFix? {
return QuickFixes.getQuickFix(ruleName, isOnTheFly)
}
@ -62,8 +61,10 @@ class AliPmdInspection(private val ruleName: String)
return true
}
override fun checkFile(file: PsiFile, manager: InspectionManager,
isOnTheFly: Boolean): Array<ProblemDescriptor>? {
override fun checkFile(
file: PsiFile, manager: InspectionManager,
isOnTheFly: Boolean
): Array<ProblemDescriptor>? {
if (!shouldInspectChecker.shouldInspect(file)) {
return null
}
@ -96,10 +97,6 @@ class AliPmdInspection(private val ruleName: String)
return true
}
override fun isSuppressedFor(element: PsiElement): Boolean {
return false
}
override fun getShortName(): String {
var shortName = "Alibaba" + ruleName

@ -45,8 +45,10 @@ class DelegateLocalInspectionTool : LocalInspectionTool(), AliBaseInspection {
return localInspectionTool.runForWholeFile()
}
override fun checkFile(file: PsiFile, manager: InspectionManager,
isOnTheFly: Boolean): Array<ProblemDescriptor>? {
override fun checkFile(
file: PsiFile, manager: InspectionManager,
isOnTheFly: Boolean
): Array<ProblemDescriptor>? {
return localInspectionTool.checkFile(file, manager, isOnTheFly)
}
@ -81,11 +83,13 @@ class DelegateLocalInspectionTool : LocalInspectionTool(), AliBaseInspection {
}
override fun isSuppressedFor(element: PsiElement): Boolean {
return false
return localInspectionTool.isSuppressedFor(element)
}
override fun buildVisitor(holder: ProblemsHolder, isOnTheFly: Boolean,
session: LocalInspectionToolSession): PsiElementVisitor {
override fun buildVisitor(
holder: ProblemsHolder, isOnTheFly: Boolean,
session: LocalInspectionToolSession
): PsiElementVisitor {
if (!AliLocalInspectionToolProvider.javaShouldInspectChecker.shouldInspect(holder.file)) {
return PsiElementVisitor.EMPTY_VISITOR
}

@ -78,6 +78,6 @@ class DelegatePmdInspection : LocalInspectionTool(), AliBaseInspection, PmdRuleI
}
override fun isSuppressedFor(element: PsiElement): Boolean {
return false
return aliPmdInspection.isSuppressedFor(element)
}
}

Loading…
Cancel
Save