コード例 #1
0
        private async Task ExecuteProjectsAnalysisImplAsync(IList <ProjectData> projects, ProjectsAnalysisStat statistics, String appPath, IConfigDataProvider configDataProvider)
        {
            await OutputHelper.OutputMessageAsync(ServiceProvider, $"Source code analysis for {statistics.TargetType} named \"{statistics.ProjectNames}\" is started");

            foreach (ProjectData project in projects)
            {
                String target = project.FileName;
                if (String.Equals(project.LanguageId, LanguageCSharpId))
                {
                    String          configPath  = ConfigFinder.FindConfig(configDataProvider, target);
                    OutputLevel     outputLevel = configDataProvider.GetOutputLevel();
                    ExecutionResult result      = await ExecutionHelper.ExecuteSourceCodeAnalysisAsync(appPath, target, configPath, outputLevel);

                    if (result.ExitCode == 0)
                    {
                        ++statistics.SuccessCount;
                    }
                    else
                    {
                        ++statistics.FailedCount;
                    }
                    await OutputHelper.OutputTargetAnalysisResultAsync(ServiceProvider, result, target, "project");
                }
                else
                {
                    ++statistics.SkippedCount;
                    await OutputHelper.OutputMessageAsync(ServiceProvider, $"Project \"{target}\" can't be processed due to unsupported language");
                }
            }
            await OutputHelper.OutputMessageAsync(ServiceProvider, $"Source code analysis for {statistics.TargetType} named \"{statistics.ProjectNames}\" is finished");

            await UIHelper.ShowProjectsSummaryAsync(_package, statistics);
        }
コード例 #2
0
        private async Task ExecuteSolutionAnalysisImplAsync(String target, String appPath, IConfigDataProvider configDataProvider)
        {
            await OutputHelper.OutputMessageAsync(ServiceProvider, $"Source code analysis for solution named \"{target}\" is started");

            String          configPath  = ConfigFinder.FindConfig(configDataProvider, target);
            OutputLevel     outputLevel = configDataProvider.GetOutputLevel();
            ExecutionResult result      = await ExecutionHelper.ExecuteSourceCodeAnalysisAsync(appPath, target, configPath, outputLevel);

            await OutputHelper.OutputTargetAnalysisResultAsync(ServiceProvider, result, target, "solution");

            await OutputHelper.OutputMessageAsync(ServiceProvider, $"Source code analysis for solution named \"{target}\" is finished");

            await UIHelper.ShowSolutionSummaryAsync(_package, result, target);
        }