コード例 #1
0
        public bool Execute(string[] args, AnalysisConfig config, ITeamBuildSettings settings)
        {
            if (args == null)
            {
                throw new ArgumentNullException(nameof(args));
            }
            if (config == null)
            {
                throw new ArgumentNullException(nameof(config));
            }
            if (settings == null)
            {
                throw new ArgumentNullException(nameof(settings));
            }

            this.targetUninstaller.UninstallTargets(logger);

            logger.SuspendOutput();

            IAnalysisPropertyProvider provider;

            if (!ArgumentProcessor.TryProcessArgs(args, logger, out provider))
            {
                logger.ResumeOutput();
                // logging already done
                return(false);
            }

            logger.Verbosity = VerbosityCalculator.ComputeVerbosity(config.GetAnalysisSettings(true), logger);
            logger.ResumeOutput();
            LogStartupSettings(config, settings);

            if (!CheckEnvironmentConsistency(config, settings))
            {
                // logging already done
                return(false);
            }

            // if initialisation fails a warning will have been logged at the source of the failure
            bool initialised = this.codeCoverageProcessor.Initialise(config, settings, logger);

            if (initialised && !this.codeCoverageProcessor.ProcessCoverageReports())
            {
                // if processing fails, stop the workflow
                return(false);
            }

            ProjectInfoAnalysisResult result = InvokeSonarScanner(provider, config);

            this.reportBuilder.GenerateReports(settings, config, result, logger);
            return(result.RanToCompletion);
        }
コード例 #2
0
        public bool Execute(string[] args, AnalysisConfig config, TeamBuildSettings settings, ILogger logger)
        {
            if (args == null)
            {
                throw new ArgumentNullException("args");
            }
            if (config == null)
            {
                throw new ArgumentNullException("config");
            }
            if (settings == null)
            {
                throw new ArgumentNullException("settings");
            }
            if (logger == null)
            {
                throw new ArgumentNullException("logger");
            }

            IAnalysisPropertyProvider provider;

            if (!ArgumentProcessor.TryProcessArgs(args, logger, out provider))
            {
                return(false);
            }

            logger.Verbosity = VerbosityCalculator.ComputeVerbosity(config.GetAnalysisSettings(true), logger);
            LogStartupSettings(config, settings, logger);

            if (!CheckEnvironmentConsistency(config, settings, logger))
            {
                return(false);
            }

            // if initialisation fails a warning will have been logged at the source of the failure
            bool initialised = this.codeCoverageProcessor.Initialise(config, settings, logger);

            if (initialised && !this.codeCoverageProcessor.ProcessCoverageReports())
            {
                //  if processing fails, stop the workflow
                return(false);
            }

            ProjectInfoAnalysisResult result = InvokeSonarRunner(provider, config, logger);

            this.reportBuilder.GenerateReports(settings, config, result, logger);
            return(result.RanToCompletion);
        }