public static void Analyze(SyntaxNodeAnalysisContext context, ConditionalExpressionSyntax conditionalExpression) { if (CanRefactor(conditionalExpression, context.SemanticModel, context.CancellationToken) && !conditionalExpression.SpanContainsDirectives()) { context.ReportDiagnostic( DiagnosticDescriptors.SimplifyConditionalExpression, conditionalExpression.GetLocation()); } }
public static void Analyze(SyntaxNodeAnalysisContext context, ConditionalExpressionSyntax conditionalExpression) { if (conditionalExpression.Condition?.IsMissing == false && CanBeReplacedWithCoalesceExpression(conditionalExpression) && conditionalExpression .DescendantTrivia(conditionalExpression.Span) .All(f => f.IsWhitespaceOrEndOfLineTrivia())) { context.ReportDiagnostic( DiagnosticDescriptors.ReplaceConditionalExpressionWithCoalesceExpression, conditionalExpression.GetLocation()); } }