Exemplo n.º 1
0
 public HasMetricsResultsFilter(ProjectInspectionResult project)
 {
     _packageIDsWithMetrics = project.PackageResults
                              .Where(pr => pr.Metrics.Any(metric => metric != null))
                              .Select(pr => pr.Package.ID)
                              .ToHashSet();
 }
Exemplo n.º 2
0
        private IResultsFilter GetTableFilter(ProjectInspectionResult project)
        {
            IResultsFilter filter = _showAll
                ? new NoopResultsFilter()
                : new HasMetricsResultsFilter(project);

            return(filter);
        }
Exemplo n.º 3
0
 private static LayoutView <View> GetLayoutView(ProjectInspectionResult project)
 {
     return(new StackLayoutView(Orientation.Vertical)
     {
         _newline,
         new ContentView($"Project: {project.Name} (took: {project.Elapsed.Seconds}s {project.Elapsed.Milliseconds}ms)"),
         _newline
     });
 }
        private static IEnumerable <MetricsTableLine> GetTableLines(ProjectInspectionResult project, PackageInspectionResult result, IResultsFilter filter, int depth)
        {
            var(package, metrics) = result;

            if (filter.IsLineExcluded(package))
            {
                yield break;
            }

            yield return(CreateTableLine(package, metrics, depth));

            var children = project.PackageResults
                           .Where(r => r.Package.Parents?.Any(parent => parent.ID == package.ID) ?? false)
                           .OrderBy(r => r.Package.Name);

            foreach (var child in children)
            {
                foreach (var line in GetTableLines(project, child, filter, depth + 1))
                {
                    yield return(line);
                }
            }
        }
        public IReadOnlyList <(int Index, MetricsTableLine Line)> GetIndexedTableLines(ProjectInspectionResult project, IResultsFilter filter)
        {
            var lines = new List <(int Index, MetricsTableLine Line)>();
            var index = 1;

            var roots = project.PackageResults
                        .Where(result => result.Package.ReferenceType == PackageReferenceType.Explicit)
                        .OrderBy(result => result.Package.Name);

            foreach (var root in roots)
            {
                foreach (var line in GetTableLines(project, root, filter, 0))
                {
                    lines.Add((index++, line));
                }
            }

            var unknowns = project.PackageResults
                           .Where(result => result.Package.ReferenceType == PackageReferenceType.Unknown)
                           .OrderBy(result => result.Package.Name);

            foreach (var(package, metrics) in unknowns)
            {
                if (filter.IsLineExcluded(package))
                {
                    continue;
                }

                var line = CreateTableLine(package, metrics, 0);

                lines.Add((index++, line));
            }

            return(lines);
        }