コード例 #1
0
        private static void CheckSummaryHeader(SyntaxTreeAnalysisContext context, Compilation compilation, XmlFileHeader fileHeader)
        {
            var summaryElement = fileHeader.GetElement("summary");
            if (summaryElement == null)
            {
                context.ReportDiagnostic(Diagnostic.Create(SA1639Descriptor, fileHeader.GetLocation(context.Tree)));
                return;
            }

            if (string.IsNullOrWhiteSpace(summaryElement.Value))
            {
                var location = fileHeader.GetElementLocation(context.Tree, summaryElement);
                context.ReportDiagnostic(Diagnostic.Create(SA1639Descriptor, location));
            }
        }
コード例 #2
0
        private static void CheckCopyrightHeader(SyntaxTreeAnalysisContext context, Compilation compilation, StyleCopSettings settings, XmlFileHeader fileHeader)
        {
            var copyrightElement = fileHeader.GetElement("copyright");
            if (copyrightElement == null)
            {
                context.ReportDiagnostic(Diagnostic.Create(SA1634Descriptor, fileHeader.GetLocation(context.Tree)));
                return;
            }

            if (!compilation.IsAnalyzerSuppressed(SA1637Identifier))
            {
                CheckFile(context, compilation, fileHeader, copyrightElement, settings);
            }

            if (!compilation.IsAnalyzerSuppressed(SA1640Identifier))
            {
                CheckCompanyName(context, compilation, fileHeader, copyrightElement, settings);
            }

            if (!compilation.IsAnalyzerSuppressed(SA1635Identifier))
            {
                CheckCopyrightText(context, compilation, fileHeader, copyrightElement, settings);
            }
        }