Пример #1
0
        internal static IEnumerable <ActionPackageMetric> TransformActionPackages(MetricsContext context, ProjectResult projectResult)
        {
            var projectFile          = projectResult.ProjectFile;
            var actionPackages       = projectResult.ActionPackages;
            var actionPackagesMetric = new List <ActionPackageMetric>();

            foreach (var actionPackage in actionPackages)
            {
                actionPackagesMetric.Add(new ActionPackageMetric(context, actionPackage, projectFile));
            }

            return(actionPackagesMetric);
        }
Пример #2
0
        internal static IEnumerable <TargetVersionMetric> TransformTargetVersions(MetricsContext context, ProjectResult projectResult)
        {
            var projectFile          = projectResult.ProjectFile;
            var targetVersions       = projectResult.TargetVersions;
            var targetVersionMetrics = new List <TargetVersionMetric>();

            foreach (var targetVersion in targetVersions)
            {
                targetVersionMetrics.Add(new TargetVersionMetric(context, targetVersion, projectFile));
            }

            return(targetVersionMetrics);
        }
Пример #3
0
        internal static IEnumerable <UpgradePackageMetric> TransformUpgradePackages(MetricsContext context, ProjectResult projectResult)
        {
            var projectFile           = projectResult.ProjectFile;
            var upgradePackages       = projectResult.UpgradePackages;
            var upgradePackagesMetric = new List <UpgradePackageMetric>();

            foreach (var upgradePackage in upgradePackages)
            {
                upgradePackagesMetric.Add(new UpgradePackageMetric(context, upgradePackage, projectFile));
            }

            return(upgradePackagesMetric);
        }
Пример #4
0
        internal static IEnumerable <BuildErrorMetric> TransformBuildErrors(MetricsContext context,
                                                                            Dictionary <string, Dictionary <string, int> > buildErrorsByProject)
        {
            var buildErrorMetrics = new List <BuildErrorMetric>();

            foreach (var project in buildErrorsByProject.Keys)
            {
                var buildErrorCounts = buildErrorsByProject[project];
                foreach (var buildError in buildErrorCounts.Keys)
                {
                    var count = buildErrorCounts[buildError];
                    buildErrorMetrics.Add(new BuildErrorMetric(context, buildError, count, project));
                }
            }

            return(buildErrorMetrics);
        }
Пример #5
0
        public GenericActionMetric(MetricsContext context, GenericAction action, string filePath, string projectPath)
        {
            ActionName   = action.Name;
            ActionType   = action.Type;
            ActionValue  = action.Value;
            SolutionPath = context.SolutionPathHash;
            ProjectGuid  = context.ProjectGuidMap.GetValueOrDefault(projectPath, "N/A");

            if (ActionType == Constants.Project)
            {
                FilePath = ProjectGuid;
            }
            else
            {
                FilePath = string.IsNullOrEmpty(filePath) ? "N/A" : EncryptionHelper.ConvertToSHA256Hex(filePath);
            }
        }
Пример #6
0
        internal static IEnumerable <GenericActionMetric> TransformProjectActions(MetricsContext context, ProjectResult projectResult)
        {
            var projectFile           = projectResult.ProjectFile;
            var detectedActionsByFile = projectResult.ProjectActions?.FileActions.ToList();
            var genericActions        = new List <GenericActionMetric>();

            foreach (var fileAction in detectedActionsByFile)
            {
                var fileName         = fileAction.FilePath;
                var actionExecutions = fileAction.AllActions;
                foreach (var actionExecution in actionExecutions)
                {
                    genericActions.Add(new GenericActionMetric(context, actionExecution, fileName, projectFile));
                }
            }

            return(genericActions);
        }
Пример #7
0
        internal static IEnumerable <GenericActionExecutionMetric> TransformGenericActionExecutions(MetricsContext context, ProjectResult projectResult)
        {
            var projectFile                    = projectResult.ProjectFile;
            var executedActionsByFile          = projectResult.ExecutedActions;
            var genericActionExecutionsMetrics = new List <GenericActionExecutionMetric>();

            foreach (var kvp in executedActionsByFile)
            {
                var fileName         = kvp.Key;
                var actionExecutions = kvp.Value;
                foreach (var actionExecution in actionExecutions)
                {
                    genericActionExecutionsMetrics.Add(new GenericActionExecutionMetric(context, actionExecution, projectFile));
                }
            }

            return(genericActionExecutionsMetrics);
        }
Пример #8
0
        internal static IEnumerable <WebFormsActionMetric> TransformWebFormActionMetrics(MetricsContext context, ProjectResult projectResult)
        {
            var projectFile          = projectResult.ProjectFile;
            var webFormActionMetrics = new List <WebFormsActionMetric>();

            foreach (var metric in projectResult.WebFormsMetricResults)
            {
                if (metric.ActionName == WebFormsActionType.FileConversion)
                {
                    webFormActionMetrics.Add(new FileConversionMetric(context, metric.ChildAction, projectFile));
                }
                else if (metric.ActionName == WebFormsActionType.ControlConversion)
                {
                    webFormActionMetrics.Add(new ControlConversionMetric(context, metric.ChildAction, metric.NodeName, projectFile));
                }
                else if (metric.ActionName == WebFormsActionType.ClassConversion)
                {
                    webFormActionMetrics.Add(new ClassConversionMetric(context, metric.ChildAction, projectFile));
                }
                else if (metric.ActionName == WebFormsActionType.DirectiveConversion)
                {
                    webFormActionMetrics.Add(new DirectiveConversionMetric(context, metric.ChildAction, projectFile));
                }
                else
                {
                    LogHelper.LogInformation($"WebForms porting action not found with the name" + metric.ActionName.ToString());
                }
            }

            return(webFormActionMetrics);
        }
Пример #9
0
        internal static IEnumerable <MissingMetaReferenceMetric> TransformMissingMetaReferences(MetricsContext context, ProjectResult projectResult)
        {
            var projectFile                 = projectResult.ProjectFile;
            var missingMetaReferences       = projectResult.MissingMetaReferences;
            var missingMetaReferenceMetrics = new List <MissingMetaReferenceMetric>();

            foreach (var reference in missingMetaReferences)
            {
                missingMetaReferenceMetrics.Add(new MissingMetaReferenceMetric(context, reference, projectFile));
            }

            return(missingMetaReferenceMetrics);
        }
Пример #10
0
 public TargetVersionMetric(MetricsContext context, string targetVersion, string projectPath)
 {
     TargetVersion    = targetVersion;
     SolutionPathHash = context.SolutionPathHash;
     ProjectGuid      = context.ProjectGuidMap.GetValueOrDefault(projectPath, "N/A");
 }
Пример #11
0
 public DownloadedFilesMetric(MetricsContext context, string downloadedFile)
 {
     DownloadedFile   = downloadedFile;
     SolutionPathHash = context.SolutionPathHash;
 }
Пример #12
0
 public MissingMetaReferenceMetric(MetricsContext context, string metaReference, string projectPath)
 {
     MetaReference    = metaReference;
     SolutionPathHash = context.SolutionPathHash;
     ProjectGuid      = context.ProjectGuidMap.GetValueOrDefault(projectPath, "N/A");
 }
Пример #13
0
 public FeatureDetectionMetric(MetricsContext context, string featureName, string projectPath)
 {
     FeatureName  = featureName;
     SolutionPath = context.SolutionPathHash;
     ProjectGuid  = context.ProjectGuidMap.GetValueOrDefault(projectPath, "N/A");
 }
Пример #14
0
 public ReferencesMetric(MetricsContext context, string reference)
 {
     Reference        = reference;
     SolutionPathHash = context.SolutionPathHash;
 }
Пример #15
0
        internal static IEnumerable <FeatureDetectionMetric> TransformFeatureDetectionResults(MetricsContext context,
                                                                                              Dictionary <string, FeatureDetectionResult> featureDetectionResults)
        {
            var featureDetectionMetrics = new List <FeatureDetectionMetric>();

            foreach (var kvp in featureDetectionResults)
            {
                var featureDetectionResult = kvp.Value;
                var metrics = featureDetectionResult.PresentFeatures.Select(featureName =>
                                                                            new FeatureDetectionMetric(context, featureName, featureDetectionResult.ProjectPath));

                featureDetectionMetrics.AddRange(metrics);
            }

            return(featureDetectionMetrics);
        }
Пример #16
0
 public PortSolutionResultReportGenerator(MetricsContext context, PortSolutionResult portSolutionResult)
 {
     Context                 = context;
     PortSolutionResult      = portSolutionResult;
     FeatureDetectionResults = new Dictionary <string, FeatureDetectionResult>();
 }
 public PortSolutionResultReportGenerator(MetricsContext context, PortSolutionResult portSolutionResult)
 {
     Context            = context;
     PortSolutionResult = portSolutionResult;
 }