예제 #1
0
        /// <summary>
        /// Merges two or more Stylecop report files into a single xml document.
        /// </summary>
        /// <param name="context">The cake context.</param>
        /// <param name="resultFiles">A collection of report files to merge.</param>
        /// <returns>The resultant Xml document.</returns>
        public static XDocument MergeResultFile(ICakeContext context, FilePathCollection resultFiles)
        {
            context.Log.Information($"Stylecop: Loading result xml file {resultFiles.First().FullPath}");
            var xFileRoot = XDocument.Load(resultFiles.First().FullPath);

            foreach (var resultFile in resultFiles.Skip(1))
            {
                context.Log.Information($"Stylecop: Loading result xml file {resultFile.FullPath}");
                var xFileChild = XDocument.Load(resultFile.FullPath);
                xFileRoot.Root.Add(xFileChild.Root.Elements());
            }

            return(xFileRoot);
        }