public AnalyzerMessageBase[] AnalyzeProject(IAnalyzerConfig config, string[] sourcePaths, string[] referencedAssemblyPaths) { var traceMessageBuffer = new List <string>(); var typeDependencyValidator = new CachingTypeDependencyValidator(config); var typeDependencyEnumerator = new Roslyn2TypeDependencyEnumerator(i => traceMessageBuffer.Add(i)); var typeDependencies = typeDependencyEnumerator.GetTypeDependencies(sourcePaths, referencedAssemblyPaths); var illegalDependencies = typeDependencies.Where(i => !typeDependencyValidator.IsAllowedDependency(i)).Take(config.MaxIssueCount); traceMessageBuffer.Add(GetCacheStatisticsMessage(typeDependencyValidator)); var traceMessages = traceMessageBuffer.Select(i => new TraceMessage(i)); var illegalDependencyMessages = illegalDependencies.Select(i => new IllegalDependencyMessage(i)); return(illegalDependencyMessages.OfType <AnalyzerMessageBase>().Concat(traceMessages).ToArray()); }
public IRemoteMessage[] AnalyzeProject(IAnalyzerConfig config, string[] sourcePaths, string[] referencedAssemblyPaths) { var messageBuffer = new List <IRemoteMessage>(); var typeDependencyEnumerator = GetTypeDependencyEnumerator(WrapIntoTraceMessage(messageBuffer)); var typeDependencyValidator = new CachingTypeDependencyValidator(config, WrapIntoTraceMessage(messageBuffer)); var illegalDependencyMessages = typeDependencyEnumerator .GetTypeDependencies(sourcePaths, referencedAssemblyPaths) .Where(i => !typeDependencyValidator.IsAllowedDependency(i)) .Take(config.MaxIssueCount + 1) .Select(i => new RemoteIllegalDependencyMessage(i)); messageBuffer.AddRange(illegalDependencyMessages); WrapIntoTraceMessage(messageBuffer)(GetCacheStatisticsMessage(typeDependencyValidator)); return(messageBuffer.ToArray()); }