예제 #1
0
        public ProjectInfoAnalysisResult Execute(AnalysisConfig config, IEnumerable <string> userCmdLineArguments)
        {
            if (config == null)
            {
                throw new ArgumentNullException(nameof(config));
            }
            if (userCmdLineArguments == null)
            {
                throw new ArgumentNullException(nameof(userCmdLineArguments));
            }

            var result = new PropertiesFileGenerator(config, logger).GenerateFile();

            Debug.Assert(result != null, "Not expecting the file generator to return null");
            result.RanToCompletion = false;

            SonarProjectPropertiesValidator.Validate(
                config.SonarScannerWorkingDirectory,
                result.Projects,
                onValid: () =>
            {
                ProjectInfoReportBuilder.WriteSummaryReport(config, result, logger);

                result.RanToCompletion = InternalExecute(config, userCmdLineArguments, logger, result.FullPropertiesFilePath);
            },
                onInvalid: (invalidFolders) =>
            {
                // LOG error message
                logger.LogError(Resources.ERR_ConflictingSonarProjectProperties, string.Join(", ", invalidFolders));
            });

            return(result);
        }
        public static void WriteSummaryReport(AnalysisConfig config, ProjectInfoAnalysisResult result, ILogger logger)
        {
            var builder = new ProjectInfoReportBuilder(config, result, logger);

            builder.Generate();
        }