override fun visitMethodCall()

in lint-checks/src/main/java/com/uber/lintchecks/StringFormatNoLocaleDetector.kt [49:63]


  override fun visitMethodCall(context: JavaContext, node: UCallExpression, method: PsiMethod) {
    if (!getApplicableMethodNames().contains(node.methodName)) return

    val evaluator = context.evaluator
    val psiMethod = node.resolve()
    if (psiMethod != null &&
        node.methodName == "format" &&
        isStringType(evaluator, node)) {
      val parameters = node.valueArguments
      val firstParamFQCN = parameters.first().getExpressionType()?.internalCanonicalText
      if (stringTypes().contains(firstParamFQCN)) {
        context.report(ISSUE, context.getLocation(node), LINT_ERROR_MESSAGE)
      }
    }
  }