예제 #1
0
        public static FilePath CreateIssueReport(
            this ICakeContext context,
            IEnumerable <IIssue> issues,
            IIssueReportFormat reportFormat,
            ICreateIssueReportSettings settings)
        {
            context.NotNull(nameof(context));

            // ReSharper disable once PossibleMultipleEnumeration
            issues.NotNullOrEmptyElement(nameof(issues));

            reportFormat.NotNull(nameof(reportFormat));
            settings.NotNull(nameof(settings));

            var issueReportCreator = new IssueReportCreator(context.Log);

            // ReSharper disable once PossibleMultipleEnumeration
            return(issueReportCreator.CreateReport(issues, reportFormat, settings));
        }
        /// <summary>
        /// Creates a report from a list of issues.
        /// </summary>
        /// <param name="issues">Issues for which the report should be created.</param>
        /// <param name="reportFormat">Report format to use.</param>
        /// <param name="settings">Settings to use.</param>
        /// <returns>Path to the created report or <c>null</c> if report could not be created.</returns>
        public FilePath CreateReport(
            IEnumerable <IIssue> issues,
            IIssueReportFormat reportFormat,
            ICreateIssueReportSettings settings)
        {
            issues.NotNullOrEmptyElement(nameof(issues));
            reportFormat.NotNull(nameof(reportFormat));
            settings.NotNull(nameof(settings));

            var reportFormatName = reportFormat.GetType().Name;

            this.log.Verbose("Initialize report format {0}...", reportFormatName);

            if (!reportFormat.Initialize(settings))
            {
                this.log.Warning("Error initializing report format {0}.", reportFormatName);
                return(null);
            }

            this.log.Verbose("Creating report {0}...", reportFormatName);
            return(reportFormat.CreateReport(issues));
        }