Exemplo n.º 1
0
        public static void SolutionAssessmentCollect(SolutionAnalysisResult result, string targetFramework, string version, string source, double analysisTime, string tag)
        {
            var sha256hash     = SHA256.Create();
            var date           = DateTime.Now;
            var solutionDetail = result.SolutionDetails;
            // Solution Metrics
            var solutionMetrics = createSolutionMetric(solutionDetail, targetFramework, version, source, analysisTime, tag, sha256hash, date);

            TelemetryCollector.Collect <SolutionMetrics>(solutionMetrics);

            foreach (var project in solutionDetail.Projects)
            {
                var projectMetrics = createProjectMetric(project, targetFramework, version, source, analysisTime, tag, sha256hash, date);
                TelemetryCollector.Collect <ProjectMetrics>(projectMetrics);
            }

            //nuget metrics
            result.ProjectAnalysisResults.ForEach(project =>
            {
                foreach (var nuget in project.PackageAnalysisResults)
                {
                    nuget.Value.Wait();
                    var packageID      = nuget.Value.Result.PackageVersionPair.PackageId;
                    var packageVersion = nuget.Value.Result.PackageVersionPair.Version;
                    var compatability  = nuget.Value.Result.CompatibilityResults[targetFramework].Compatibility;
                    var nugetMetrics   = createNugetMetric(targetFramework, version, source, analysisTime, tag, date, packageID, packageVersion, compatability);
                    TelemetryCollector.Collect <NugetMetrics>(nugetMetrics);
                }

                foreach (var sourceFile in project.SourceFileAnalysisResults)
                {
                    FileAssessmentCollect(sourceFile, targetFramework, version, source, tag);
                }
            });
        }
Exemplo n.º 2
0
        public static void FileAssessmentCollect(SourceFileAnalysisResult result, string targetFramework, string version, string source, string tag)
        {
            var date = DateTime.Now;

            foreach (var api in result.ApiAnalysisResults)
            {
                var apiMetrics = createAPIMetric(api, targetFramework, version, source, tag, date);
                TelemetryCollector.Collect <APIMetrics>(apiMetrics);
            }
        }