protected override async Task<EvaluationResult> EvaluateImpl(SyntaxNode node, SemanticModel semanticModel, Solution solution)
{
var symbol = (ITypeSymbol)semanticModel.GetDeclaredSymbol(node);
var efferent = GetReferencedTypes(node, symbol, semanticModel).AsArray();
var awaitable = SymbolFinder.FindCallersAsync(symbol, solution, CancellationToken.None).ConfigureAwait(false);
var callers = (await awaitable).AsArray();
var testCallers = callers
.Where(c => c.CallingSymbol.GetAttributes()
.Any(x => x.AttributeClass.Name.IsKnownTestAttribute()))
.AsArray();
var afferent = callers.Except(testCallers)
.Select(x => x.CallingSymbol.ContainingType)
.DistinctBy(s => s.ToDisplayString())
.AsArray();
var efferentLength = (double)efferent.Length;
var stability = efferentLength / (efferentLength + afferent.Length);
if (stability >= 0.8)
{
return new EvaluationResult
{
ImpactLevel = ImpactLevel.Project,
Quality = CodeQuality.NeedsReview,
QualityAttribute = QualityAttribute.CodeQuality | QualityAttribute.Conformance,
Snippet = node.ToFullString()
};
}
return null;
}