diff --git a/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1604UnitTests.cs b/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1604UnitTests.cs
index 17c3dcac6..bc64b551c 100644
--- a/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1604UnitTests.cs
+++ b/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1604UnitTests.cs
@@ -63,6 +63,21 @@ public async Task TestTypeWithInheritedDocumentationAsync(string typeName)
await VerifyCSharpDiagnosticAsync(string.Format(testCode, typeName), DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
}
+ [Theory]
+ [InlineData("enum")]
+ [InlineData("class")]
+ [InlineData("struct")]
+ [InlineData("interface")]
+ public async Task TestTypeWithExcludedDocumentationAsync(string typeName)
+ {
+ var testCode = @"
+///
+{0} TypeName
+{{
+}}";
+ await VerifyCSharpDiagnosticAsync(string.Format(testCode, typeName), DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
+ }
+
[Theory]
[InlineData("enum")]
[InlineData("class")]
@@ -129,6 +144,16 @@ public delegate
await VerifyCSharpDiagnosticAsync(testCode, DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
}
+ [Fact]
+ public async Task TestDelegateWithExcludedDocumentationAsync()
+ {
+ var testCode = @"
+///
+public delegate
+void TypeName();";
+ await VerifyCSharpDiagnosticAsync(testCode, DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
+ }
+
[Fact]
public async Task TestDelegateWithoutDocumentationAsync()
{
@@ -188,6 +213,21 @@ public void Test() { }
await VerifyCSharpDiagnosticAsync(testCode, DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
}
+ [Fact]
+ public async Task TestMethodWithExcludedDocumentationAsync()
+ {
+ var testCode = @"
+///
+///
+///
+public class ClassName
+{
+ ///
+ public void Test() { }
+}";
+ await VerifyCSharpDiagnosticAsync(testCode, DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
+ }
+
[Fact]
public async Task TestMethodWithoutDocumentationAsync()
{
@@ -290,6 +330,21 @@ public ClassName() { }
await VerifyCSharpDiagnosticAsync(testCode, DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
}
+ [Fact]
+ public async Task TestConstructorWithExcludedDocumentationAsync()
+ {
+ var testCode = @"
+///
+///
+///
+public class ClassName
+{
+ ///
+ public ClassName() { }
+}";
+ await VerifyCSharpDiagnosticAsync(testCode, DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
+ }
+
[Fact]
public async Task TestConstructorWithoutDocumentationAsync()
{
@@ -354,6 +409,21 @@ public class ClassName
await VerifyCSharpDiagnosticAsync(testCode, DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
}
+ [Fact]
+ public async Task TestDestructorWithExcludedDocumentationAsync()
+ {
+ var testCode = @"
+///
+///
+///
+public class ClassName
+{
+ ///
+ ~ClassName() { }
+}";
+ await VerifyCSharpDiagnosticAsync(testCode, DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
+ }
+
[Fact]
public async Task TestDestructorWithoutDocumentationAsync()
{
@@ -404,6 +474,21 @@ public class ClassName
await VerifyCSharpDiagnosticAsync(testCode, DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
}
+ [Fact]
+ public async Task TestPropertyWithExcludedDocumentationAsync()
+ {
+ var testCode = @"
+///
+///
+///
+public class ClassName
+{
+ ///
+ public ClassName Property { get; set; }
+}";
+ await VerifyCSharpDiagnosticAsync(testCode, DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
+ }
+
[Fact]
public async Task TestPropertyNoDocumentationAsync()
{
@@ -468,6 +553,21 @@ public class ClassName
await VerifyCSharpDiagnosticAsync(testCode, DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
}
+ [Fact]
+ public async Task TestIndexerWithExcludedDocumentationAsync()
+ {
+ var testCode = @"
+///
+///
+///
+public class ClassName
+{
+ ///
+ public ClassName this[string t] { get { return null; } }
+}";
+ await VerifyCSharpDiagnosticAsync(testCode, DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
+ }
+
[Fact]
public async Task TestIndexerNoDocumentationAsync()
{
@@ -532,6 +632,21 @@ public class ClassName
await VerifyCSharpDiagnosticAsync(testCode, DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
}
+ [Fact]
+ public async Task TestFieldWithExcludedDocumentationAsync()
+ {
+ var testCode = @"
+///
+///
+///
+public class ClassName
+{
+ ///
+ public ClassName Foo;
+}";
+ await VerifyCSharpDiagnosticAsync(testCode, DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
+ }
+
[Fact]
public async Task TestFieldNoDocumentationAsync()
{
@@ -596,6 +711,21 @@ public class ClassName
await VerifyCSharpDiagnosticAsync(testCode, DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
}
+ [Fact]
+ public async Task TestEventWithExcludedDocumentationAsync()
+ {
+ var testCode = @"
+///
+///
+///
+public class ClassName
+{
+ ///
+ public event System.Action Foo;
+}";
+ await VerifyCSharpDiagnosticAsync(testCode, DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
+ }
+
[Fact]
public async Task TestEventNoDocumentationAsync()
{
@@ -660,6 +790,21 @@ event System.Action Foo { add { } remove { } }
await VerifyCSharpDiagnosticAsync(testCode, DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
}
+ [Fact]
+ public async Task TestEventPropertyWithExcludedDocumentationAsync()
+ {
+ var testCode = @"
+///
+///
+///
+public class ClassName
+{
+ ///
+ event System.Action Foo { add { } remove { } }
+}";
+ await VerifyCSharpDiagnosticAsync(testCode, DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
+ }
+
[Fact]
public async Task TestEventPropertyNoDocumentationAsync()
{
diff --git a/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1605UnitTests.cs b/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1605UnitTests.cs
index fda3ca1cb..4b63eb70d 100644
--- a/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1605UnitTests.cs
+++ b/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1605UnitTests.cs
@@ -86,6 +86,20 @@ public async Task TestTypeWithInheritedDocumentationAsync(string typeName)
await VerifyCSharpDiagnosticAsync(string.Format(testCode, typeName), DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
}
+ [Theory]
+ [InlineData("class")]
+ [InlineData("struct")]
+ [InlineData("interface")]
+ public async Task TestTypeWithExcludedDocumentationAsync(string typeName)
+ {
+ var testCode = @"
+///
+partial {0} TypeName
+{{
+}}";
+ await VerifyCSharpDiagnosticAsync(string.Format(testCode, typeName), DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
+ }
+
[Theory]
[InlineData("class")]
[InlineData("struct")]
@@ -184,6 +198,21 @@ public partial class ClassName
await VerifyCSharpDiagnosticAsync(testCode, DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
}
+ [Fact]
+ public async Task TestMethodWithExcludedDocumentationAsync()
+ {
+ var testCode = @"
+///
+///
+///
+public partial class ClassName
+{
+ ///
+ partial void Test();
+}";
+ await VerifyCSharpDiagnosticAsync(testCode, DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
+ }
+
[Fact]
public async Task TestMethodWithoutDocumentationAsync()
{
diff --git a/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1606UnitTests.cs b/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1606UnitTests.cs
index dae77067c..9090c4c11 100644
--- a/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1606UnitTests.cs
+++ b/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1606UnitTests.cs
@@ -63,6 +63,21 @@ public async Task TestTypeWithInheritedDocumentationAsync(string typeName)
await VerifyCSharpDiagnosticAsync(string.Format(testCode, typeName), DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
}
+ [Theory]
+ [InlineData("enum")]
+ [InlineData("class")]
+ [InlineData("struct")]
+ [InlineData("interface")]
+ public async Task TestTypeWithExcludedDocumentationAsync(string typeName)
+ {
+ var testCode = @"
+///
+{0} TypeName
+{{
+}}";
+ await VerifyCSharpDiagnosticAsync(string.Format(testCode, typeName), DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
+ }
+
[Theory]
[InlineData("enum")]
[InlineData("class")]
@@ -133,6 +148,16 @@ public delegate
await VerifyCSharpDiagnosticAsync(testCode, DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
}
+ [Fact]
+ public async Task TestDelegateWithExcludedDocumentationAsync()
+ {
+ var testCode = @"
+///
+public delegate
+void TypeName();";
+ await VerifyCSharpDiagnosticAsync(testCode, DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
+ }
+
[Fact]
public async Task TestDelegateWithoutDocumentationAsync()
{
@@ -194,6 +219,21 @@ public void Test() { }
await VerifyCSharpDiagnosticAsync(testCode, DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
}
+ [Fact]
+ public async Task TestMethodWithExcludedDocumentationAsync()
+ {
+ var testCode = @"
+///
+/// Foo
+///
+public class ClassName
+{
+ ///
+ public void Test() { }
+}";
+ await VerifyCSharpDiagnosticAsync(testCode, DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
+ }
+
[Fact]
public async Task TestMethodWithoutDocumentationAsync()
{
@@ -278,6 +318,21 @@ public ClassName() { }
await VerifyCSharpDiagnosticAsync(testCode, DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
}
+ [Fact]
+ public async Task TestConstructorWithExcludedDocumentationAsync()
+ {
+ var testCode = @"
+///
+/// Foo
+///
+public class ClassName
+{
+ ///
+ public ClassName() { }
+}";
+ await VerifyCSharpDiagnosticAsync(testCode, DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
+ }
+
[Fact]
public async Task TestConstructorWithoutDocumentationAsync()
{
@@ -344,6 +399,21 @@ public class ClassName
await VerifyCSharpDiagnosticAsync(testCode, DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
}
+ [Fact]
+ public async Task TestDestructorWithExcludedDocumentationAsync()
+ {
+ var testCode = @"
+///
+/// Foo
+///
+public class ClassName
+{
+ ///
+ ~ClassName() { }
+}";
+ await VerifyCSharpDiagnosticAsync(testCode, DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
+ }
+
[Fact]
public async Task TestDestructorWithoutDocumentationAsync()
{
@@ -396,6 +466,21 @@ public class ClassName
await VerifyCSharpDiagnosticAsync(testCode, DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
}
+ [Fact]
+ public async Task TestPropertyWithExcludedDocumentationAsync()
+ {
+ var testCode = @"
+///
+/// Foo
+///
+public class ClassName
+{
+ ///
+ public ClassName Property { get; set; }
+}";
+ await VerifyCSharpDiagnosticAsync(testCode, DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
+ }
+
[Fact]
public async Task TestPropertyNoDocumentationAsync()
{
@@ -462,6 +547,21 @@ public class ClassName
await VerifyCSharpDiagnosticAsync(testCode, DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
}
+ [Fact]
+ public async Task TestIndexerWithExcludedDocumentationAsync()
+ {
+ var testCode = @"
+///
+/// Foo
+///
+public class ClassName
+{
+ ///
+ public ClassName this[string t] { get { return null; } }
+}";
+ await VerifyCSharpDiagnosticAsync(testCode, DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
+ }
+
[Fact]
public async Task TestIndexerNoDocumentationAsync()
{
@@ -528,6 +628,21 @@ public class ClassName
await VerifyCSharpDiagnosticAsync(testCode, DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
}
+ [Fact]
+ public async Task TestFieldWithExcludedDocumentationAsync()
+ {
+ var testCode = @"
+///
+/// Foo
+///
+public class ClassName
+{
+ ///
+ public ClassName Foo;
+}";
+ await VerifyCSharpDiagnosticAsync(testCode, DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
+ }
+
[Fact]
public async Task TestFieldNoDocumentationAsync()
{
@@ -594,6 +709,21 @@ public class ClassName
await VerifyCSharpDiagnosticAsync(testCode, DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
}
+ [Fact]
+ public async Task TestEventWithExcludedDocumentationAsync()
+ {
+ var testCode = @"
+///
+/// Foo
+///
+public class ClassName
+{
+ ///
+ public event System.Action Foo;
+}";
+ await VerifyCSharpDiagnosticAsync(testCode, DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
+ }
+
[Fact]
public async Task TestEventNoDocumentationAsync()
{
@@ -660,6 +790,21 @@ event System.Action Foo { add { } remove { } }
await VerifyCSharpDiagnosticAsync(testCode, DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
}
+ [Fact]
+ public async Task TestEventPropertyWithExcludedDocumentationAsync()
+ {
+ var testCode = @"
+///
+/// Foo
+///
+public class ClassName
+{
+ ///
+ event System.Action Foo { add { } remove { } }
+}";
+ await VerifyCSharpDiagnosticAsync(testCode, DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
+ }
+
[Fact]
public async Task TestEventPropertyNoDocumentationAsync()
{
diff --git a/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1607UnitTests.cs b/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1607UnitTests.cs
index 42278288a..09ab951cc 100644
--- a/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1607UnitTests.cs
+++ b/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1607UnitTests.cs
@@ -76,6 +76,20 @@ public async Task TestTypeWithInheritedDocumentationAsync(string typeName)
await VerifyCSharpDiagnosticAsync(string.Format(testCode, typeName), DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
}
+ [Theory]
+ [InlineData("class")]
+ [InlineData("struct")]
+ [InlineData("interface")]
+ public async Task TestTypeWithExcludedDocumentationAsync(string typeName)
+ {
+ var testCode = @"
+///
+partial {0} TypeName
+{{
+}}";
+ await VerifyCSharpDiagnosticAsync(string.Format(testCode, typeName), DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
+ }
+
[Theory]
[InlineData("class")]
[InlineData("struct")]
@@ -215,6 +229,21 @@ public partial class ClassName
await VerifyCSharpDiagnosticAsync(testCode, DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
}
+ [Fact]
+ public async Task TestMethodWithExcludedDocumentationAsync()
+ {
+ var testCode = @"
+///
+/// Foo
+///
+public partial class ClassName
+{
+ ///
+ partial void Test();
+}";
+ await VerifyCSharpDiagnosticAsync(testCode, DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
+ }
+
[Fact]
public async Task TestMethodWithoutSummaryDocumentationAsync()
{
diff --git a/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1608UnitTests.cs b/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1608UnitTests.cs
index 01aaf48db..23bf2ee95 100644
--- a/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1608UnitTests.cs
+++ b/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1608UnitTests.cs
@@ -76,6 +76,20 @@ public async Task TestTypeWithInheritedDocumentationAsync(string typeName)
await VerifyCSharpDiagnosticAsync(string.Format(testCode, typeName), DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
}
+ [Theory]
+ [InlineData("class")]
+ [InlineData("struct")]
+ [InlineData("interface")]
+ public async Task TestTypeWithExcludedDocumentationAsync(string typeName)
+ {
+ var testCode = @"
+///
+{0} TypeName
+{{
+}}";
+ await VerifyCSharpDiagnosticAsync(string.Format(testCode, typeName), DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
+ }
+
[Theory]
[InlineData("class")]
[InlineData("struct")]
diff --git a/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1609UnitTests.cs b/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1609UnitTests.cs
index 140bcbdd1..024e80990 100644
--- a/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1609UnitTests.cs
+++ b/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1609UnitTests.cs
@@ -52,6 +52,21 @@ public class ClassName
await VerifyCSharpDiagnosticAsync(testCode, DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
}
+ [Fact]
+ public async Task TestPropertyWithExcludedDocumentationAsync()
+ {
+ var testCode = @"
+///
+///
+///
+public class ClassName
+{
+ ///
+ public ClassName Property { get; set; }
+}";
+ await VerifyCSharpDiagnosticAsync(testCode, DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
+ }
+
[Fact]
public async Task TestPropertyNoDocumentationAsync()
{
diff --git a/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1610UnitTests.cs b/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1610UnitTests.cs
index 6bf2d2ada..63383c2ee 100644
--- a/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1610UnitTests.cs
+++ b/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1610UnitTests.cs
@@ -49,6 +49,21 @@ public class ClassName
await VerifyCSharpDiagnosticAsync(testCode, DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
}
+ [Fact]
+ public async Task TestPropertyWithExcludedDocumentationAsync()
+ {
+ var testCode = @"
+///
+/// Foo
+///
+public class ClassName
+{
+ ///
+ public ClassName Property { get; set; }
+}";
+ await VerifyCSharpDiagnosticAsync(testCode, DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
+ }
+
[Fact]
public async Task TestPropertyNoDocumentationAsync()
{
diff --git a/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1611UnitTests.cs b/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1611UnitTests.cs
index a3dc8406e..f33ad1826 100644
--- a/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1611UnitTests.cs
+++ b/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1611UnitTests.cs
@@ -130,6 +130,22 @@ public class ClassName
await VerifyCSharpDiagnosticAsync(testCode.Replace("##", p), DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
}
+ [Theory]
+ [MemberData(nameof(Data))]
+ public async Task TestExcludeAsync(string p)
+ {
+ var testCode = @"
+///
+/// Foo
+///
+public class ClassName
+{
+ ///
+ public ##
+}";
+ await VerifyCSharpDiagnosticAsync(testCode.Replace("##", p), DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
+ }
+
[Theory]
[MemberData(nameof(Data))]
public async Task TestMissingParametersAsync(string p)
diff --git a/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1612UnitTests.cs b/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1612UnitTests.cs
index 41b5ad6e8..7d8485d71 100644
--- a/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1612UnitTests.cs
+++ b/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1612UnitTests.cs
@@ -271,6 +271,22 @@ public class ClassName
await VerifyCSharpDiagnosticAsync(testCode.Replace("$$", declaration), DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
}
+ [Theory]
+ [MemberData(nameof(Declarations))]
+ public async Task VerifyExcludedDocumentationReportsNoDiagnosticsAsync(string declaration)
+ {
+ var testCode = @"
+///
+/// Foo
+///
+public class ClassName
+{
+ ///
+ $$
+}";
+ await VerifyCSharpDiagnosticAsync(testCode.Replace("$$", declaration), DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
+ }
+
[Fact]
public async Task VerifyIncludedMemberWithoutParamsIsNotReportedAsync()
{
diff --git a/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1617UnitTests.cs b/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1617UnitTests.cs
index 86648986e..b6772a50e 100644
--- a/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1617UnitTests.cs
+++ b/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1617UnitTests.cs
@@ -97,6 +97,24 @@ public class ClassName
await VerifyCSharpDiagnosticAsync(testCode, DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
}
+ [Fact]
+ public async Task TestPropertyWithExcludedDocumentationAsync()
+ {
+ var testCode = @"
+///
+/// Foo
+///
+public class ClassName
+{
+ ///
+ public ClassName Method() { return null; }
+
+ ///
+ public delegate ClassName MethodDelegate();
+}";
+ await VerifyCSharpDiagnosticAsync(testCode, DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
+ }
+
[Fact]
public async Task TestMethodWithoutReturnValueNoDocumentationAsync()
{
diff --git a/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1618UnitTests.cs b/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1618UnitTests.cs
index 27813997b..f9e8ae65e 100644
--- a/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1618UnitTests.cs
+++ b/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1618UnitTests.cs
@@ -223,6 +223,32 @@ public async Task TestTypesInheritDocAsync(string p)
await VerifyCSharpDiagnosticAsync(testCode.Replace("##", p), DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
}
+ [Theory]
+ [MemberData(nameof(Members))]
+ public async Task TestMembersExcludeAsync(string p)
+ {
+ var testCode = @"
+///
+/// Foo
+///
+public class ClassName
+{
+ ///
+ public ##
+}";
+ await VerifyCSharpDiagnosticAsync(testCode.Replace("##", p), DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
+ }
+
+ [Theory]
+ [MemberData(nameof(Types))]
+ public async Task TestTypesExcludeAsync(string p)
+ {
+ var testCode = @"
+///
+public ##";
+ await VerifyCSharpDiagnosticAsync(testCode.Replace("##", p), DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
+ }
+
[Theory]
[MemberData(nameof(Members))]
public async Task TestMembersWithMissingDocumentationAsync(string p)
diff --git a/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1619UnitTests.cs b/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1619UnitTests.cs
index 7063f250f..915979d34 100644
--- a/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1619UnitTests.cs
+++ b/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1619UnitTests.cs
@@ -103,6 +103,16 @@ public async Task TestPartialTypesInheritDocAsync(string p)
await VerifyCSharpDiagnosticAsync(testCode.Replace("##", p), DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
}
+ [Theory]
+ [MemberData(nameof(Types))]
+ public async Task TestPartialTypesExcludeAsync(string p)
+ {
+ var testCode = @"
+///
+public partial ##";
+ await VerifyCSharpDiagnosticAsync(testCode.Replace("##", p), DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
+ }
+
[Theory]
[MemberData(nameof(Types))]
public async Task TestPartialTypesWithMissingDocumentationAsync(string p)
diff --git a/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1620UnitTests.cs b/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1620UnitTests.cs
index f2595bd4a..184e48dd3 100644
--- a/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1620UnitTests.cs
+++ b/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1620UnitTests.cs
@@ -231,6 +231,22 @@ public class ClassName
await VerifyCSharpDiagnosticAsync(testCode.Replace("##", p), DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
}
+ [Theory]
+ [MemberData(nameof(Members))]
+ public async Task TestMembersExcludeAsync(string p)
+ {
+ var testCode = @"
+///
+/// Foo
+///
+public class ClassName
+{
+ ///
+ public ##
+}";
+ await VerifyCSharpDiagnosticAsync(testCode.Replace("##", p), DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
+ }
+
[Theory]
[MemberData(nameof(Types))]
public async Task TestTypesInheritDocAsync(string p)
@@ -241,6 +257,16 @@ public async Task TestTypesInheritDocAsync(string p)
await VerifyCSharpDiagnosticAsync(testCode.Replace("##", p), DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
}
+ [Theory]
+ [MemberData(nameof(Types))]
+ public async Task TestTypesExcludeAsync(string p)
+ {
+ var testCode = @"
+///
+public ##";
+ await VerifyCSharpDiagnosticAsync(testCode.Replace("##", p), DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
+ }
+
[Theory]
[MemberData(nameof(Members))]
public async Task TestMembersWithMissingDocumentationAsync(string p)
diff --git a/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1625UnitTests.cs b/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1625UnitTests.cs
index 8e2caef80..efbeb364d 100644
--- a/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1625UnitTests.cs
+++ b/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1625UnitTests.cs
@@ -84,6 +84,20 @@ public class TestClass
await VerifyCSharpDiagnosticAsync(testCode, DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
}
+ [Theory]
+ [MemberData(nameof(Members))]
+ public async Task VerifyThatTheAnalyzerDoesNotCrashOnExcludeAsync(string member)
+ {
+ var testCode = $@"
+public class TestClass
+{{
+ ///
+ {member}
+}}
+";
+ await VerifyCSharpDiagnosticAsync(testCode, DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
+ }
+
[Theory]
[MemberData(nameof(Members))]
public async Task VerifyThatWhitespacesAreNormalizedForEmptyXmlElementsAsync(string member)
diff --git a/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/ElementDocumentationBase.cs b/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/ElementDocumentationBase.cs
index 511473902..9df26db62 100644
--- a/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/ElementDocumentationBase.cs
+++ b/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/ElementDocumentationBase.cs
@@ -209,6 +209,12 @@ private void HandleDeclaration(SyntaxNodeAnalysisContext context, StyleCopSettin
return;
}
+ if (documentation.Content.GetFirstXmlElement(XmlCommentHelper.ExcludeXmlTag) != null)
+ {
+ // Ignore nodes with an tag in the included XML
+ return;
+ }
+
if (this.inheritDocSuppressesWarnings
&& documentation.Content.GetFirstXmlElement(XmlCommentHelper.InheritdocXmlTag) != null)
{
@@ -238,6 +244,12 @@ private void HandleDeclaration(SyntaxNodeAnalysisContext context, StyleCopSettin
return;
}
+ if (completeDocumentation.Nodes().OfType().Any(element => element.Name == XmlCommentHelper.ExcludeXmlTag))
+ {
+ // Ignore nodes with an tag in the included XML
+ return;
+ }
+
this.HandleCompleteDocumentation(context, needsComment, completeDocumentation, locations);
return; // done
}
diff --git a/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/FileHeaderAnalyzers.cs b/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/FileHeaderAnalyzers.cs
index 6f3101607..ac2a3ae27 100644
--- a/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/FileHeaderAnalyzers.cs
+++ b/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/FileHeaderAnalyzers.cs
@@ -203,16 +203,20 @@ public static void HandleSyntaxTree(SyntaxTreeAnalysisContext context, StyleCopS
if (settings.DocumentationRules.XmlHeader)
{
var fileHeader = FileHeaderHelpers.ParseXmlFileHeader(root);
- if (fileHeader.IsMissing)
- {
- context.ReportDiagnostic(Diagnostic.Create(SA1633DescriptorMissing, fileHeader.GetLocation(context.Tree)));
- return;
- }
- if (fileHeader.IsMalformed)
+ if (fileHeader != null)
{
- context.ReportDiagnostic(Diagnostic.Create(SA1633DescriptorMalformed, fileHeader.GetLocation(context.Tree)));
- return;
+ if (fileHeader.IsMissing)
+ {
+ context.ReportDiagnostic(Diagnostic.Create(SA1633DescriptorMissing, fileHeader.GetLocation(context.Tree)));
+ return;
+ }
+
+ if (fileHeader.IsMalformed)
+ {
+ context.ReportDiagnostic(Diagnostic.Create(SA1633DescriptorMalformed, fileHeader.GetLocation(context.Tree)));
+ return;
+ }
}
if (!compilation.IsAnalyzerSuppressed(SA1634Descriptor))
diff --git a/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/GenericTypeParameterDocumentationAnalyzer.cs b/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/GenericTypeParameterDocumentationAnalyzer.cs
index 3d0a42c0c..7537b33b1 100644
--- a/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/GenericTypeParameterDocumentationAnalyzer.cs
+++ b/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/GenericTypeParameterDocumentationAnalyzer.cs
@@ -136,6 +136,12 @@ private static void HandleDeclaration(SyntaxNodeAnalysisContext context, SyntaxN
rawDocumentation = declaration.GetDocumentationCommentXml(expandIncludes: true, cancellationToken: context.CancellationToken);
var completeDocumentation = XElement.Parse(rawDocumentation, LoadOptions.None);
+ if (completeDocumentation.Nodes().OfType().Any(element => element.Name == XmlCommentHelper.ExcludeXmlTag))
+ {
+ // Ignore nodes with an tag in the included XML
+ return;
+ }
+
if (completeDocumentation.Nodes().OfType().Any(element => element.Name == XmlCommentHelper.InheritdocXmlTag))
{
// Ignore nodes with an tag in the included XML.
diff --git a/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/PartialElementDocumentationSummaryBase.cs b/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/PartialElementDocumentationSummaryBase.cs
index 3931fe36b..e6bf74267 100644
--- a/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/PartialElementDocumentationSummaryBase.cs
+++ b/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/PartialElementDocumentationSummaryBase.cs
@@ -119,6 +119,12 @@ private void HandleDeclaration(SyntaxNodeAnalysisContext context, bool needsComm
return;
}
+ if (documentation.Content.GetFirstXmlElement(XmlCommentHelper.ExcludeXmlTag) != null)
+ {
+ // Ignore nodes with an tag.
+ return;
+ }
+
if (documentation.Content.GetFirstXmlElement(XmlCommentHelper.InheritdocXmlTag) != null)
{
// Ignore nodes with an tag.
@@ -151,6 +157,12 @@ private void HandleDeclaration(SyntaxNodeAnalysisContext context, bool needsComm
}
completeDocumentation = XElement.Parse(rawDocumentation, LoadOptions.None);
+ if (completeDocumentation.Nodes().OfType().Any(element => element.Name == XmlCommentHelper.ExcludeXmlTag))
+ {
+ // Ignore nodes with an tag in the included XML.
+ return;
+ }
+
if (completeDocumentation.Nodes().OfType().Any(element => element.Name == XmlCommentHelper.InheritdocXmlTag))
{
// Ignore nodes with an tag in the included XML.
diff --git a/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/PropertyDocumentationBase.cs b/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/PropertyDocumentationBase.cs
index d3fbe65f2..3a4847f07 100644
--- a/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/PropertyDocumentationBase.cs
+++ b/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/PropertyDocumentationBase.cs
@@ -83,6 +83,12 @@ private void HandleDeclaration(SyntaxNodeAnalysisContext context, bool needsComm
return;
}
+ if (documentation.Content.GetFirstXmlElement(XmlCommentHelper.ExcludeXmlTag) != null)
+ {
+ // Ignore nodes with an tag.
+ return;
+ }
+
if (documentation.Content.GetFirstXmlElement(XmlCommentHelper.InheritdocXmlTag) != null)
{
// Ignore nodes with an tag.
@@ -100,6 +106,12 @@ private void HandleDeclaration(SyntaxNodeAnalysisContext context, bool needsComm
var declaration = context.SemanticModel.GetDeclaredSymbol(node, context.CancellationToken);
var rawDocumentation = declaration?.GetDocumentationCommentXml(expandIncludes: true, cancellationToken: context.CancellationToken);
completeDocumentation = XElement.Parse(rawDocumentation, LoadOptions.None);
+ if (completeDocumentation.Nodes().OfType().Any(element => element.Name == XmlCommentHelper.ExcludeXmlTag))
+ {
+ // Ignore nodes with an tag in the included XML.
+ return;
+ }
+
if (completeDocumentation.Nodes().OfType().Any(element => element.Name == XmlCommentHelper.InheritdocXmlTag))
{
// Ignore nodes with an tag in the included XML.
diff --git a/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/PropertySummaryDocumentationAnalyzer.cs b/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/PropertySummaryDocumentationAnalyzer.cs
index 08438be3e..8f04ac516 100644
--- a/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/PropertySummaryDocumentationAnalyzer.cs
+++ b/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/PropertySummaryDocumentationAnalyzer.cs
@@ -6,6 +6,7 @@ namespace StyleCop.Analyzers.DocumentationRules
using System;
using System.Collections.Immutable;
using System.Globalization;
+ using System.Linq;
using System.Xml.Linq;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
diff --git a/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/SA1604ElementDocumentationMustHaveSummary.cs b/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/SA1604ElementDocumentationMustHaveSummary.cs
index c65cfafe2..8a1cc7713 100644
--- a/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/SA1604ElementDocumentationMustHaveSummary.cs
+++ b/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/SA1604ElementDocumentationMustHaveSummary.cs
@@ -51,6 +51,12 @@ protected override void HandleXmlElement(SyntaxNodeAnalysisContext context, bool
if (completeDocumentation != null)
{
+ // This documentation rule is excluded via the tag
+ if (completeDocumentation.Nodes().OfType().Any(element => element.Name == XmlCommentHelper.ExcludeXmlTag))
+ {
+ return;
+ }
+
// We are working with an element
if (completeDocumentation.Nodes().OfType().Any(element => element.Name == XmlCommentHelper.SummaryXmlTag))
{
@@ -75,6 +81,12 @@ protected override void HandleXmlElement(SyntaxNodeAnalysisContext context, bool
// Ignore nodes with an tag.
return;
}
+
+ // This documentation rule is excluded via the tag
+ if (documentation?.Content.GetFirstXmlElement(XmlCommentHelper.ExcludeXmlTag) != null)
+ {
+ return;
+ }
}
foreach (var location in diagnosticLocations)
diff --git a/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/SA1606ElementDocumentationMustHaveSummaryText.cs b/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/SA1606ElementDocumentationMustHaveSummaryText.cs
index d5f82693a..308dce407 100644
--- a/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/SA1606ElementDocumentationMustHaveSummaryText.cs
+++ b/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/SA1606ElementDocumentationMustHaveSummaryText.cs
@@ -51,6 +51,12 @@ protected override void HandleXmlElement(SyntaxNodeAnalysisContext context, bool
if (completeDocumentation != null)
{
+ // This documentation rule is excluded via the tag
+ if (completeDocumentation.Nodes().OfType().Any(element => element.Name == XmlCommentHelper.ExcludeXmlTag))
+ {
+ return;
+ }
+
XElement summaryNode = completeDocumentation.Nodes().OfType().FirstOrDefault(element => element.Name == XmlCommentHelper.SummaryXmlTag);
if (summaryNode == null)
{
diff --git a/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/SA1607PartialElementDocumentationMustHaveSummaryText.cs b/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/SA1607PartialElementDocumentationMustHaveSummaryText.cs
index be0d4670f..467704063 100644
--- a/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/SA1607PartialElementDocumentationMustHaveSummaryText.cs
+++ b/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/SA1607PartialElementDocumentationMustHaveSummaryText.cs
@@ -90,6 +90,12 @@ protected override void HandleXmlElement(SyntaxNodeAnalysisContext context, bool
{
if (completeDocumentation != null)
{
+ // This documentation rule is excluded via the tag
+ if (completeDocumentation.Nodes().OfType().Any(element => element.Name == XmlCommentHelper.ExcludeXmlTag))
+ {
+ return;
+ }
+
var summaryTag = completeDocumentation.Nodes().OfType().FirstOrDefault(element => element.Name == XmlCommentHelper.SummaryXmlTag);
var contentTag = completeDocumentation.Nodes().OfType().FirstOrDefault(element => element.Name == XmlCommentHelper.ContentXmlTag);
diff --git a/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/SA1608ElementDocumentationMustNotHaveDefaultSummary.cs b/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/SA1608ElementDocumentationMustNotHaveDefaultSummary.cs
index 755931598..f47c0d0e0 100644
--- a/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/SA1608ElementDocumentationMustNotHaveDefaultSummary.cs
+++ b/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/SA1608ElementDocumentationMustNotHaveDefaultSummary.cs
@@ -79,6 +79,12 @@ protected override void HandleXmlElement(SyntaxNodeAnalysisContext context, Styl
///
protected override void HandleCompleteDocumentation(SyntaxNodeAnalysisContext context, bool needsComment, XElement completeDocumentation, params Location[] diagnosticLocations)
{
+ // This documentation rule is excluded via the tag
+ if (completeDocumentation.Nodes().OfType().Any(element => element.Name == XmlCommentHelper.ExcludeXmlTag))
+ {
+ return;
+ }
+
// We are working with an element
var includedSummaryElement = completeDocumentation.Nodes().OfType().FirstOrDefault(element => element.Name == XmlCommentHelper.SummaryXmlTag);
if (includedSummaryElement != null)
diff --git a/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/SA1609PropertyDocumentationMustHaveValue.cs b/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/SA1609PropertyDocumentationMustHaveValue.cs
index ce71c5eb0..a81b485a3 100644
--- a/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/SA1609PropertyDocumentationMustHaveValue.cs
+++ b/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/SA1609PropertyDocumentationMustHaveValue.cs
@@ -55,7 +55,6 @@ protected override void HandleXmlElement(SyntaxNodeAnalysisContext context, bool
}
var properties = ImmutableDictionary.Create();
-
if (completeDocumentation != null)
{
var hasValueTag = completeDocumentation.Nodes().OfType().Any(element => element.Name == XmlCommentHelper.ValueXmlTag);
diff --git a/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/SA1610PropertyDocumentationMustHaveValueText.cs b/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/SA1610PropertyDocumentationMustHaveValueText.cs
index 72e3e2a75..3b624fa58 100644
--- a/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/SA1610PropertyDocumentationMustHaveValueText.cs
+++ b/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/SA1610PropertyDocumentationMustHaveValueText.cs
@@ -52,6 +52,12 @@ protected override void HandleXmlElement(SyntaxNodeAnalysisContext context, bool
if (completeDocumentation != null)
{
+ // This documentation rule is excluded via the tag
+ if (completeDocumentation.Nodes().OfType().Any(element => element.Name == XmlCommentHelper.ExcludeXmlTag))
+ {
+ return;
+ }
+
var valueTag = completeDocumentation.Nodes().OfType().FirstOrDefault(element => element.Name == XmlCommentHelper.ValueXmlTag);
if (valueTag == null)
{
diff --git a/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/SA1611ElementParametersMustBeDocumented.cs b/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/SA1611ElementParametersMustBeDocumented.cs
index 0b2bf644f..0eacf5a00 100644
--- a/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/SA1611ElementParametersMustBeDocumented.cs
+++ b/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/SA1611ElementParametersMustBeDocumented.cs
@@ -75,6 +75,12 @@ protected override void HandleXmlElement(SyntaxNodeAnalysisContext context, Styl
///
protected override void HandleCompleteDocumentation(SyntaxNodeAnalysisContext context, bool needsComment, XElement completeDocumentation, params Location[] diagnosticLocations)
{
+ // This documentation rule is excluded via the tag
+ if (completeDocumentation.Nodes().OfType().Any(element => element.Name == XmlCommentHelper.ExcludeXmlTag))
+ {
+ return;
+ }
+
if (!needsComment)
{
// Omitting documentation for a parameter is allowed for this element.
diff --git a/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/SA1612ElementParameterDocumentationMustMatchElementParameters.cs b/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/SA1612ElementParameterDocumentationMustMatchElementParameters.cs
index 8ef915a21..5ee1ed5e1 100644
--- a/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/SA1612ElementParameterDocumentationMustMatchElementParameters.cs
+++ b/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/SA1612ElementParameterDocumentationMustMatchElementParameters.cs
@@ -143,6 +143,12 @@ protected override void HandleCompleteDocumentation(SyntaxNodeAnalysisContext co
return;
}
+ // This documentation rule is excluded via the tag
+ if (completeDocumentation.Nodes().OfType().Any(element => element.Name == XmlCommentHelper.ExcludeXmlTag))
+ {
+ return;
+ }
+
// We are working with an element
var xmlParamTags = completeDocumentation.Nodes()
.OfType()
diff --git a/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/SA1613ElementParameterDocumentationMustDeclareParameterName.cs b/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/SA1613ElementParameterDocumentationMustDeclareParameterName.cs
index 0a9ad7c4f..de77c3223 100644
--- a/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/SA1613ElementParameterDocumentationMustDeclareParameterName.cs
+++ b/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/SA1613ElementParameterDocumentationMustDeclareParameterName.cs
@@ -72,6 +72,12 @@ protected override void HandleXmlElement(SyntaxNodeAnalysisContext context, Styl
///
protected override void HandleCompleteDocumentation(SyntaxNodeAnalysisContext context, bool needsComment, XElement completeDocumentation, params Location[] diagnosticLocations)
{
+ // This documentation rule is excluded via the tag
+ if (completeDocumentation.Nodes().OfType().Any(element => element.Name == XmlCommentHelper.ExcludeXmlTag))
+ {
+ return;
+ }
+
var xmlParamTags = completeDocumentation.Nodes()
.OfType()
.Where(e => e.Name == XmlCommentHelper.ParamXmlTag);
diff --git a/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/SA1614ElementParameterDocumentationMustHaveText.cs b/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/SA1614ElementParameterDocumentationMustHaveText.cs
index d782c2c6e..2c2622bd5 100644
--- a/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/SA1614ElementParameterDocumentationMustHaveText.cs
+++ b/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/SA1614ElementParameterDocumentationMustHaveText.cs
@@ -66,6 +66,12 @@ protected override void HandleXmlElement(SyntaxNodeAnalysisContext context, Styl
///
protected override void HandleCompleteDocumentation(SyntaxNodeAnalysisContext context, bool needsComment, XElement completeDocumentation, params Location[] diagnosticLocations)
{
+ // This documentation rule is excluded via the tag
+ if (completeDocumentation.Nodes().OfType().Any(element => element.Name == XmlCommentHelper.ExcludeXmlTag))
+ {
+ return;
+ }
+
var xmlParamTags = completeDocumentation.Nodes()
.OfType()
.Where(e => e.Name == XmlCommentHelper.ParamXmlTag);
diff --git a/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/SA1615ElementReturnValueMustBeDocumented.cs b/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/SA1615ElementReturnValueMustBeDocumented.cs
index e16273adb..c0b1c7090 100644
--- a/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/SA1615ElementReturnValueMustBeDocumented.cs
+++ b/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/SA1615ElementReturnValueMustBeDocumented.cs
@@ -117,6 +117,13 @@ private static void HandleDeclaration(SyntaxNodeAnalysisContext context, bool ne
var declaration = context.SemanticModel.GetDeclaredSymbol(context.Node, context.CancellationToken);
var rawDocumentation = declaration?.GetDocumentationCommentXml(expandIncludes: true, cancellationToken: context.CancellationToken);
XElement completeDocumentation = XElement.Parse(rawDocumentation, LoadOptions.None);
+
+ // This documentation rule is excluded via the tag
+ if (completeDocumentation.Nodes().OfType().Any(element => element.Name == XmlCommentHelper.ExcludeXmlTag))
+ {
+ return;
+ }
+
if (completeDocumentation.Nodes().OfType().Any(element => element.Name == XmlCommentHelper.InheritdocXmlTag))
{
// Ignore nodes with an tag in the included XML.
diff --git a/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/SA1616ElementReturnValueDocumentationMustHaveText.cs b/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/SA1616ElementReturnValueDocumentationMustHaveText.cs
index 24e6b3186..14156ef97 100644
--- a/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/SA1616ElementReturnValueDocumentationMustHaveText.cs
+++ b/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/SA1616ElementReturnValueDocumentationMustHaveText.cs
@@ -64,6 +64,12 @@ protected override void HandleXmlElement(SyntaxNodeAnalysisContext context, Styl
///
protected override void HandleCompleteDocumentation(SyntaxNodeAnalysisContext context, bool needsComment, XElement completeDocumentation, params Location[] diagnosticLocations)
{
+ // This documentation rule is excluded via the tag
+ if (completeDocumentation.Nodes().OfType().Any(element => element.Name == XmlCommentHelper.ExcludeXmlTag))
+ {
+ return;
+ }
+
var returnsNodes = completeDocumentation.Nodes()
.OfType()
.Where(n => n.Name == XmlCommentHelper.ReturnsXmlTag);
diff --git a/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/SA1617VoidReturnValueMustNotBeDocumented.cs b/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/SA1617VoidReturnValueMustNotBeDocumented.cs
index 02d805077..fe2ebf82b 100644
--- a/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/SA1617VoidReturnValueMustNotBeDocumented.cs
+++ b/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/SA1617VoidReturnValueMustNotBeDocumented.cs
@@ -106,6 +106,13 @@ private static void HandleMember(SyntaxNodeAnalysisContext context, TypeSyntax r
rawDocumentation = declaration.GetDocumentationCommentXml(expandIncludes: true, cancellationToken: context.CancellationToken);
var completeDocumentation = XElement.Parse(rawDocumentation, LoadOptions.None);
+
+ // This documentation rule is excluded via the tag
+ if (completeDocumentation.Nodes().OfType().Any(element => element.Name == XmlCommentHelper.ExcludeXmlTag))
+ {
+ return;
+ }
+
if (completeDocumentation.Nodes().OfType().Any(element => element.Name == XmlCommentHelper.InheritdocXmlTag))
{
// Ignore nodes with an tag in the included XML.
diff --git a/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/SA1618GenericTypeParametersMustBeDocumented.cs b/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/SA1618GenericTypeParametersMustBeDocumented.cs
index e6699c744..ef1e921db 100644
--- a/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/SA1618GenericTypeParametersMustBeDocumented.cs
+++ b/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/SA1618GenericTypeParametersMustBeDocumented.cs
@@ -122,6 +122,12 @@ private static void HandleMemberDeclaration(SyntaxNodeAnalysisContext context, b
return;
}
+ if (documentation.Content.GetFirstXmlElement(XmlCommentHelper.ExcludeXmlTag) != null)
+ {
+ // Ignore nodes with an tag.
+ return;
+ }
+
// Check if the return value is documented
var includeElement = documentation.Content.GetFirstXmlElement(XmlCommentHelper.IncludeXmlTag);
if (includeElement != null)
@@ -135,6 +141,13 @@ private static void HandleMemberDeclaration(SyntaxNodeAnalysisContext context, b
rawDocumentation = declaration.GetDocumentationCommentXml(expandIncludes: true, cancellationToken: context.CancellationToken);
var completeDocumentation = XElement.Parse(rawDocumentation, LoadOptions.None);
+
+ // This documentation rule is excluded via the tag
+ if (completeDocumentation.Nodes().OfType().Any(element => element.Name == XmlCommentHelper.ExcludeXmlTag))
+ {
+ return;
+ }
+
if (completeDocumentation.Nodes().OfType().Any(element => element.Name == XmlCommentHelper.InheritdocXmlTag))
{
// Ignore nodes with an tag in the included XML.
diff --git a/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/SA1619GenericTypeParametersMustBeDocumentedPartialClass.cs b/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/SA1619GenericTypeParametersMustBeDocumentedPartialClass.cs
index 004b53c17..27248ef1d 100644
--- a/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/SA1619GenericTypeParametersMustBeDocumentedPartialClass.cs
+++ b/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/SA1619GenericTypeParametersMustBeDocumentedPartialClass.cs
@@ -149,6 +149,13 @@ private static void HandleTypeDeclaration(SyntaxNodeAnalysisContext context, Sty
rawDocumentation = declaration.GetDocumentationCommentXml(expandIncludes: true, cancellationToken: context.CancellationToken);
var completeDocumentation = XElement.Parse(rawDocumentation, LoadOptions.None);
+
+ // This documentation rule is excluded via the tag
+ if (completeDocumentation.Nodes().OfType().Any(element => element.Name == XmlCommentHelper.ExcludeXmlTag))
+ {
+ return;
+ }
+
if (completeDocumentation.Nodes().OfType().Any(element => element.Name == XmlCommentHelper.InheritdocXmlTag))
{
// Ignore nodes with an tag in the included XML.
diff --git a/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/SA1625ElementDocumentationMustNotBeCopiedAndPasted.cs b/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/SA1625ElementDocumentationMustNotBeCopiedAndPasted.cs
index 2ba1fab0a..5bd108af0 100644
--- a/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/SA1625ElementDocumentationMustNotBeCopiedAndPasted.cs
+++ b/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/SA1625ElementDocumentationMustNotBeCopiedAndPasted.cs
@@ -124,6 +124,12 @@ protected override void HandleCompleteDocumentation(SyntaxNodeAnalysisContext co
var culture = new CultureInfo(settings.DocumentationRules.DocumentationCulture);
var resourceManager = DocumentationResources.ResourceManager;
+ // This documentation rule is excluded via the tag
+ if (completeDocumentation.Nodes().OfType().Any(element => element.Name == XmlCommentHelper.ExcludeXmlTag))
+ {
+ return;
+ }
+
// Concatenate all XML node values
var documentationElements = completeDocumentation.Nodes()
.OfType()
diff --git a/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/SA1627DocumentationTextMustNotBeEmpty.cs b/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/SA1627DocumentationTextMustNotBeEmpty.cs
index cce5094ae..0b620f083 100644
--- a/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/SA1627DocumentationTextMustNotBeEmpty.cs
+++ b/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/SA1627DocumentationTextMustNotBeEmpty.cs
@@ -122,6 +122,13 @@ private static void HandleIncludedDocumentation(SyntaxNodeAnalysisContext contex
var rawDocumentation = declaration.GetDocumentationCommentXml(expandIncludes: true, cancellationToken: context.CancellationToken);
var completeDocumentation = XElement.Parse(rawDocumentation, LoadOptions.None);
+
+ // This documentation rule is excluded via the tag
+ if (completeDocumentation.Nodes().OfType().Any(element => element.Name == XmlCommentHelper.ExcludeXmlTag))
+ {
+ return;
+ }
+
if (completeDocumentation.Nodes().OfType().Any(element => element.Name == XmlCommentHelper.InheritdocXmlTag))
{
// Ignore nodes with an tag in the included XML.
diff --git a/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/SA1629DocumentationTextMustEndWithAPeriod.cs b/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/SA1629DocumentationTextMustEndWithAPeriod.cs
index b3fc5b0f9..461232211 100644
--- a/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/SA1629DocumentationTextMustEndWithAPeriod.cs
+++ b/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/SA1629DocumentationTextMustEndWithAPeriod.cs
@@ -86,6 +86,12 @@ protected override void HandleXmlElement(SyntaxNodeAnalysisContext context, Styl
///
protected override void HandleCompleteDocumentation(SyntaxNodeAnalysisContext context, bool needsComment, XElement completeDocumentation, params Location[] diagnosticLocations)
{
+ // This documentation rule is excluded via the tag
+ if (completeDocumentation.Nodes().OfType().Any(element => element.Name == XmlCommentHelper.ExcludeXmlTag))
+ {
+ return;
+ }
+
foreach (var node in completeDocumentation.Nodes().OfType())
{
var textWithoutTrailingWhitespace = node.Value.TrimEnd(' ', '\r', '\n');
diff --git a/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/SA1648InheritDocMustBeUsedWithInheritingClass.cs b/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/SA1648InheritDocMustBeUsedWithInheritingClass.cs
index 663705536..85beda937 100644
--- a/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/SA1648InheritDocMustBeUsedWithInheritingClass.cs
+++ b/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/SA1648InheritDocMustBeUsedWithInheritingClass.cs
@@ -95,6 +95,12 @@ private static void HandleBaseTypeLikeDeclaration(SyntaxNodeAnalysisContext cont
var rawDocumentation = declaration.GetDocumentationCommentXml(expandIncludes: true, cancellationToken: context.CancellationToken);
var completeDocumentation = XElement.Parse(rawDocumentation, LoadOptions.None);
+ // This documentation rule is excluded via the tag
+ if (completeDocumentation.Nodes().OfType().Any(element => element.Name == XmlCommentHelper.ExcludeXmlTag))
+ {
+ return;
+ }
+
var inheritDocElement = completeDocumentation.Nodes().OfType().FirstOrDefault(element => element.Name == XmlCommentHelper.InheritdocXmlTag);
if (inheritDocElement == null)
{
diff --git a/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/SA1651DoNotUsePlaceholderElements.cs b/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/SA1651DoNotUsePlaceholderElements.cs
index d2301755a..005e54690 100644
--- a/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/SA1651DoNotUsePlaceholderElements.cs
+++ b/StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/SA1651DoNotUsePlaceholderElements.cs
@@ -123,6 +123,13 @@ private static bool IncludedDocumentationContainsPlaceHolderTags(SyntaxNodeAnaly
var rawDocumentation = declaration.GetDocumentationCommentXml(expandIncludes: true, cancellationToken: context.CancellationToken);
var completeDocumentation = XElement.Parse(rawDocumentation, LoadOptions.None);
+
+ // This documentation rule is excluded via the tag
+ if (completeDocumentation.Nodes().OfType().Any(element => element.Name == XmlCommentHelper.ExcludeXmlTag))
+ {
+ return false;
+ }
+
return completeDocumentation.DescendantNodesAndSelf().OfType().Any(element => element.Name == XmlCommentHelper.PlaceholderTag);
}
}
diff --git a/StyleCop.Analyzers/StyleCop.Analyzers/Helpers/XmlCommentHelper.cs b/StyleCop.Analyzers/StyleCop.Analyzers/Helpers/XmlCommentHelper.cs
index b03e45a6e..61f89e748 100644
--- a/StyleCop.Analyzers/StyleCop.Analyzers/Helpers/XmlCommentHelper.cs
+++ b/StyleCop.Analyzers/StyleCop.Analyzers/Helpers/XmlCommentHelper.cs
@@ -37,6 +37,7 @@ internal static class XmlCommentHelper
internal const string PermissionXmlTag = "permission";
internal const string ExceptionXmlTag = "exception";
internal const string IncludeXmlTag = "include";
+ internal const string ExcludeXmlTag = "exclude";
internal const string FileAttributeName = "file";
internal const string PathAttributeName = "path";
internal const string CrefArgumentName = "cref";