报告问题
report an issue
class MyDetector : Detector(), Detector.UastScanner {
companion object {
val ISSUE_HELLO_WORLD: Issue = IssueFactory.create(
"HelloWorld",
"Don't use method helloWorld",
"Don't use method helloWorld, because it's too simple",
Category.CORRECTNESS,
10,
Severity.ERROR,
Implementation(
MyDetector::class.java,
EnumSet.of(Scope.JAVA_FILE)
))
.setEnabledByDefault(true)
}
override fun getApplicableMethodNames() = listOf("helloWorld")
override fun visitMethod(context: JavaContext,
node: UCallExpression,
method: PsiMethod) {
context.report(ISSUE_HELLO_WORLD,
node,
context.getNameLocation(node),
"hello world!")
}
}Last updated