ArchiMetrics.CodeReview.Rules.Semantic.UnreadValueRule.EvaluateImpl C# (CSharp) Method

EvaluateImpl() protected method

protected EvaluateImpl ( Microsoft.CodeAnalysis.SyntaxNode node, Microsoft.CodeAnalysis.SemanticModel semanticModel, Microsoft.CodeAnalysis.Solution solution ) : Task
node Microsoft.CodeAnalysis.SyntaxNode
semanticModel Microsoft.CodeAnalysis.SemanticModel
solution Microsoft.CodeAnalysis.Solution
return Task
		protected override async Task<EvaluationResult> EvaluateImpl(SyntaxNode node, SemanticModel semanticModel, Solution solution)
		{
			var referenceTasks = GetSymbols(node, semanticModel)
				.Select(solution.FindReferences);
			var references = (await Task.WhenAll(referenceTasks).ConfigureAwait(false))
				.SelectMany(x => x.Locations)
				.Select(x => x.Location.SourceTree.GetRoot().FindToken(x.Location.SourceSpan.Start))
				.Select(x => x.Parent)
				.Where(x => x != null)
				.Select(x => new { Value = x, Parent = x.Parent })
				.Where(x => IsNotAssignment(x.Parent, x.Value))
				.AsArray();

			if (!references.Any())
			{
				return new EvaluationResult
					   {
						   Snippet = node.ToFullString()
					   };
			}

			return null;
		}