Skip to content

Commit 890f053

Browse files
authored
Fix invalid XML docs in generated code (#228)
* Enable a lot of warnings as errors so we can catch any issues in generated code * Fix invalid #if/#endif in xml doc comments as they're not supported * Fix the cref in the generated warnings * Update snapshots * Ignore interceptor error
1 parent 846629d commit 890f053

65 files changed

Lines changed: 7738 additions & 1207 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/NetEscapades.EnumGenerators/SourceGenerationHelper.cs

Lines changed: 238 additions & 28 deletions
Large diffs are not rendered by default.

tests/NetEscapades.EnumGenerators.IntegrationTests/Enums.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@
55

66
#pragma warning disable NEEG003
77

8+
#pragma warning disable CA1711 // Rename type so that it does not end in Enum
9+
#pragma warning disable CA1028 // Enum storage should be int32
10+
#pragma warning disable CA1069 // Enum values should not be duplicated
11+
#pragma warning disable CA1720 // Member contains type name
12+
#pragma warning disable CA1724 // Namespace conflicts with TypeName
13+
814
[assembly:NetEscapades.EnumGenerators.EnumExtensions<DateTimeKind>()]
915
[assembly:NetEscapades.EnumGenerators.EnumExtensions<System.IO.FileShare>()]
1016

@@ -162,7 +168,7 @@ public enum StringTesting
162168
{
163169
[System.ComponentModel.Description("Quotes \"")] Quotes,
164170
[System.ComponentModel.Description(@"Literal Quotes """)] LiteralQuotes,
165-
[Obsolete]
171+
[Obsolete("Testing obsolete members")]
166172
[System.ComponentModel.Description("Backslash \\")] Backslash,
167173
[System.ComponentModel.Description(@"LiteralBackslash \")] BackslashLiteral,
168174
[System.ComponentModel.Description("Line\nBreak")] LineBreak,

tests/NetEscapades.EnumGenerators.Interceptors.IntegrationTests/InterceptorTests.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,11 @@ void AssertValue(EnumWithDisplayNameInNamespace value)
4242
public void CallingToStringIsIntercepted_StringTesting()
4343
{
4444
#pragma warning disable CS0612
45+
#pragma warning disable CS0618
4546
var result1 = StringTesting.Backslash.ToString();
4647
var result2 = StringTesting.Backslash.ToStringFast();
4748
#pragma warning restore CS0612
49+
#pragma warning restore CS0618
4850
Assert.Equal(result1, result2);
4951
}
5052

tests/NetEscapades.EnumGenerators.NetStandard.SystemMemory/NetEscapades.EnumGenerators.NetStandard.SystemMemory.csproj

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@
77
<IsPackable>false</IsPackable>
88
<Nullable>enable</Nullable>
99
<DefineConstants>$(DefineConstants);NETSTANDARD_SYSTEMMEMORY_INTEGRATION_TESTS</DefineConstants>
10+
11+
<!-- Enable as many warnings as we can so we check the generated code -->
12+
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
13+
<AnalysisMode>All</AnalysisMode>
14+
<CodeAnalysisTreatWarningsAsErrors>true</CodeAnalysisTreatWarningsAsErrors>
15+
<AnalysisLevel>latest</AnalysisLevel>
16+
<WarningLevel>3</WarningLevel>
17+
<GenerateDocumentationFile>true</GenerateDocumentationFile>
1018
</PropertyGroup>
1119

1220
<ItemGroup>

tests/NetEscapades.EnumGenerators.NetStandard/NetEscapades.EnumGenerators.NetStandard.csproj

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@
55
<IsPackable>false</IsPackable>
66
<Nullable>enable</Nullable>
77
<DefineConstants>$(DefineConstants);NETSTANDARD_INTEGRATION_TESTS</DefineConstants>
8+
9+
<!-- Enable as many warnings as we can so we check the generated code -->
10+
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
11+
<AnalysisMode>All</AnalysisMode>
12+
<CodeAnalysisTreatWarningsAsErrors>true</CodeAnalysisTreatWarningsAsErrors>
13+
<AnalysisLevel>latest</AnalysisLevel>
14+
<WarningLevel>3</WarningLevel>
15+
<GenerateDocumentationFile>true</GenerateDocumentationFile>
816
</PropertyGroup>
917

1018
<ItemGroup>

tests/NetEscapades.EnumGenerators.Nuget.NetStandard.SystemMemory/NetEscapades.EnumGenerators.Nuget.NetStandard.SystemMemory.csproj

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@
55
<IsPackable>false</IsPackable>
66
<Nullable>enable</Nullable>
77
<DefineConstants>$(DefineConstants);NUGET_SYSTEMMEMORY_INTEGRATION_TESTS</DefineConstants>
8+
9+
<!-- Enable as many warnings as we can so we check the generated code -->
10+
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
11+
<AnalysisMode>All</AnalysisMode>
12+
<CodeAnalysisTreatWarningsAsErrors>true</CodeAnalysisTreatWarningsAsErrors>
13+
<AnalysisLevel>latest</AnalysisLevel>
14+
<WarningLevel>3</WarningLevel>
15+
<GenerateDocumentationFile>true</GenerateDocumentationFile>
816
</PropertyGroup>
917

1018
<ItemGroup>

tests/NetEscapades.EnumGenerators.Nuget.NetStandard/NetEscapades.EnumGenerators.Nuget.NetStandard.csproj

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@
55
<IsPackable>false</IsPackable>
66
<Nullable>enable</Nullable>
77
<DefineConstants>$(DefineConstants);NUGET_NETSTANDARD_INTERCEPTOR_TESTS</DefineConstants>
8+
9+
<!-- Enable as many warnings as we can so we check the generated code -->
10+
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
11+
<AnalysisMode>All</AnalysisMode>
12+
<CodeAnalysisTreatWarningsAsErrors>true</CodeAnalysisTreatWarningsAsErrors>
13+
<AnalysisLevel>latest</AnalysisLevel>
14+
<WarningLevel>3</WarningLevel>
15+
<GenerateDocumentationFile>true</GenerateDocumentationFile>
816
</PropertyGroup>
917

1018
<ItemGroup>

tests/NetEscapades.EnumGenerators.Tests/Snapshots/EnumGeneratorTests.CanGenerateEnumExtensionsForFlagsEnum_Params.verified.txt

Lines changed: 121 additions & 19 deletions
Large diffs are not rendered by default.

tests/NetEscapades.EnumGenerators.Tests/Snapshots/EnumGeneratorTests.CanGenerateEnumExtensionsInChildNamespace.verified.txt

Lines changed: 121 additions & 19 deletions
Large diffs are not rendered by default.

tests/NetEscapades.EnumGenerators.Tests/Snapshots/EnumGeneratorTests.CanGenerateEnumExtensionsInGlobalNamespace.verified.txt

Lines changed: 122 additions & 20 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)