创建扫描器
create a detector
class MyDetector : Detector(), SourceCodeScanner {
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.WARNING,
Implementation(
MyDetector::class.java,
EnumSet.of(Scope.JAVA_FILE)
)
)
}
override fun getApplicableMethodNames() = listOf("helloWorld")
override fun visitMethod(context: JavaContext, node: UCallExpression, method: PsiMethod) {
System.out.println("yymobile: method: $node return: ${node.returnType}")
}
}