private Diagnostic Analyze(MemberAccessExpressionSyntax methodCall, SemanticModel semanticModel) { var methodName = methodCall.GetName(); switch (methodName) { case Constants.ILog.Debug: case Constants.ILog.DebugFormat: { // check if inside IsDebugEnabled call for if or block if (methodCall.IsInsideIfStatementWithCallTo(Constants.ILog.IsDebugEnabled)) { return(null); } // check for correct type (only ILog methods shall be reported) var type = methodCall.GetTypeSymbol(semanticModel); if (type.Name != Constants.ILog.TypeName) { // skip it as it's no matching type return(null); } if (type.GetMembers(Constants.ILog.IsDebugEnabled).None()) { // skip it as it has no matching method return(null); } var enclosingMethod = methodCall.GetEnclosingMethod(semanticModel); return(Issue(enclosingMethod.Name, methodCall.Parent, methodName, Constants.ILog.IsDebugEnabled)); } default: { return(null); } } }