use of org.jetbrains.uast.java.JavaUSimpleNameReferenceExpression in project Signal-Android by WhisperSystems.
the class SignalLogDetector method visitMethodCall.
@Override
public void visitMethodCall(JavaContext context, @NotNull UCallExpression call, @NotNull PsiMethod method) {
JavaEvaluator evaluator = context.getEvaluator();
if (evaluator.isMemberInClass(method, "android.util.Log")) {
LintFix fix = quickFixIssueLog(call);
context.report(LOG_NOT_SIGNAL, call, context.getLocation(call), "Using 'android.util.Log' instead of a Signal Logger", fix);
}
if (evaluator.isMemberInClass(method, "org.signal.glide.Log")) {
LintFix fix = quickFixIssueLog(call);
context.report(LOG_NOT_SIGNAL, call, context.getLocation(call), "Using 'org.signal.glide.Log' instead of a Signal Logger", fix);
}
if (evaluator.isMemberInClass(method, "org.whispersystems.libsignal.logging.Log")) {
LintFix fix = quickFixIssueLog(call);
context.report(LOG_NOT_APP, call, context.getLocation(call), "Using Signal server logger instead of app level Logger", fix);
}
if (evaluator.isMemberInClass(method, "org.signal.core.util.logging.Log")) {
List<UExpression> arguments = call.getValueArguments();
UExpression tag = arguments.get(0);
if (!(tag instanceof JavaUSimpleNameReferenceExpression || tag instanceof KotlinUSimpleReferenceExpression || tag instanceof KotlinUQualifiedReferenceExpression)) {
context.report(INLINE_TAG, call, context.getLocation(call), "Not using a tag constant");
}
}
}
use of org.jetbrains.uast.java.JavaUSimpleNameReferenceExpression in project Signal-Android by signalapp.
the class SignalLogDetector method visitMethodCall.
@Override
public void visitMethodCall(JavaContext context, @NotNull UCallExpression call, @NotNull PsiMethod method) {
JavaEvaluator evaluator = context.getEvaluator();
if (evaluator.isMemberInClass(method, "android.util.Log")) {
LintFix fix = quickFixIssueLog(call);
context.report(LOG_NOT_SIGNAL, call, context.getLocation(call), "Using 'android.util.Log' instead of a Signal Logger", fix);
}
if (evaluator.isMemberInClass(method, "org.signal.glide.Log")) {
LintFix fix = quickFixIssueLog(call);
context.report(LOG_NOT_SIGNAL, call, context.getLocation(call), "Using 'org.signal.glide.Log' instead of a Signal Logger", fix);
}
if (evaluator.isMemberInClass(method, "org.whispersystems.libsignal.logging.Log")) {
LintFix fix = quickFixIssueLog(call);
context.report(LOG_NOT_APP, call, context.getLocation(call), "Using Signal server logger instead of app level Logger", fix);
}
if (evaluator.isMemberInClass(method, "org.signal.core.util.logging.Log")) {
List<UExpression> arguments = call.getValueArguments();
UExpression tag = arguments.get(0);
if (!(tag instanceof JavaUSimpleNameReferenceExpression || tag instanceof KotlinUSimpleReferenceExpression || tag instanceof KotlinUQualifiedReferenceExpression)) {
context.report(INLINE_TAG, call, context.getLocation(call), "Not using a tag constant");
}
}
}
Aggregations