Ejemplo n.º 1
0
        public static ImmutableDictionary <ProjectId, CodeMetricsInfo> CountLinesInParallel(
            IEnumerable <Project> projects,
            Func <string, CodeMetricsCounter> counterFactory,
            CodeMetricsOptions options          = null,
            CancellationToken cancellationToken = default)
        {
            var codeMetrics = new ConcurrentBag <(ProjectId projectId, CodeMetricsInfo codeMetrics)>();

            Parallel.ForEach(projects, project =>
            {
                CodeMetricsCounter counter = counterFactory(project.Language);

                CodeMetricsInfo projectMetrics = (counter != null)
                    ? CountLinesAsync(project, counter, options, cancellationToken).Result
                    : CodeMetricsInfo.NotAvailable;

                codeMetrics.Add((project.Id, codeMetrics: projectMetrics));
            });
Ejemplo n.º 2
0
 public abstract CodeMetricsInfo CountLines(SyntaxNode node, SourceText sourceText, CodeMetricsOptions options, CancellationToken cancellationToken);