Skip to content

Commit 59adc83

Browse files
authored
Merge pull request #3063 from sharwell/dead-test-code
Clean up dead test code
2 parents d3e7420 + 8869fb9 commit 59adc83

26 files changed

Lines changed: 37 additions & 273 deletions

StyleCop.Analyzers/Directory.Build.props

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,16 @@
4949
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.CodeStyle" Version="2.11.0-beta2-63603-03" PrivateAssets="all" />
5050
</ItemGroup>
5151

52+
<!-- Public API -->
53+
<ItemGroup>
54+
<PackageReference Include="Microsoft.CodeAnalysis.PublicApiAnalyzers" Version="2.9.7" PrivateAssets="all" />
55+
</ItemGroup>
56+
57+
<ItemGroup>
58+
<AdditionalFiles Include="PublicAPI.Shipped.txt" Condition="Exists('PublicAPI.Shipped.txt')" />
59+
<AdditionalFiles Include="PublicAPI.Unshipped.txt" Condition="Exists('PublicAPI.Unshipped.txt')" />
60+
</ItemGroup>
61+
5262
<ItemGroup>
5363
<None Include="$(MSBuildThisFileDirectory)*.ruleset" Link="%(Filename)%(Extension)" />
5464

StyleCop.Analyzers/StyleCop.Analyzers.CodeFixes/DocumentationRules/PropertySummaryDocumentationCodeFixProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ namespace StyleCop.Analyzers.DocumentationRules
2121
/// </summary>
2222
[ExportCodeFixProvider(LanguageNames.CSharp, Name = nameof(PropertySummaryDocumentationCodeFixProvider))]
2323
[Shared]
24-
public class PropertySummaryDocumentationCodeFixProvider : CodeFixProvider
24+
internal class PropertySummaryDocumentationCodeFixProvider : CodeFixProvider
2525
{
2626
/// <inheritdoc/>
2727
public override ImmutableArray<string> FixableDiagnosticIds { get; } =

StyleCop.Analyzers/StyleCop.Analyzers.CodeFixes/PublicAPI.Shipped.txt

Whitespace-only changes.

StyleCop.Analyzers/StyleCop.Analyzers.CodeFixes/PublicAPI.Unshipped.txt

Whitespace-only changes.

StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/InheritdocCodeFixProviderUnitTests.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,6 @@ public class ChildClass : ParentClass
194194
Diagnostic(SA1600).WithLocation(12, 35),
195195
},
196196
FixedCode = testCode,
197-
FixedState = { InheritanceMode = StateInheritanceMode.AutoInheritAll },
198197
NumberOfIncrementalIterations = 1,
199198
NumberOfFixAllIterations = 1,
200199
}.RunAsync(CancellationToken.None).ConfigureAwait(false);
@@ -232,7 +231,6 @@ public class ChildClass : ParentClass
232231
Diagnostic(SA1600).WithLocation(12, 35),
233232
},
234233
FixedCode = testCode,
235-
FixedState = { InheritanceMode = StateInheritanceMode.AutoInheritAll },
236234
NumberOfIncrementalIterations = 1,
237235
NumberOfFixAllIterations = 1,
238236
}.RunAsync(CancellationToken.None).ConfigureAwait(false);

StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1609UnitTests.cs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -414,14 +414,6 @@ private static Task VerifyCSharpFixAsync(string source, DiagnosticResult[] expec
414414
},
415415
};
416416

417-
if (source == fixedSource)
418-
{
419-
test.FixedState.InheritanceMode = StateInheritanceMode.AutoInheritAll;
420-
test.FixedState.MarkupHandling = MarkupMode.Allow;
421-
test.BatchFixedState.InheritanceMode = StateInheritanceMode.AutoInheritAll;
422-
test.BatchFixedState.MarkupHandling = MarkupMode.Allow;
423-
}
424-
425417
test.ExpectedDiagnostics.AddRange(expected);
426418
return test.RunAsync(cancellationToken);
427419
}

StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1610UnitTests.cs

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -414,18 +414,10 @@ private static Task VerifyCSharpFixAsync(string source, DiagnosticResult[] expec
414414
},
415415
};
416416

417-
if (source == fixedSource)
417+
if (source == fixedSource && offerEmptyFixer)
418418
{
419-
test.FixedState.InheritanceMode = StateInheritanceMode.AutoInheritAll;
420-
test.FixedState.MarkupHandling = MarkupMode.Allow;
421-
test.BatchFixedState.InheritanceMode = StateInheritanceMode.AutoInheritAll;
422-
test.BatchFixedState.MarkupHandling = MarkupMode.Allow;
423-
424-
if (offerEmptyFixer)
425-
{
426-
test.NumberOfIncrementalIterations = 1;
427-
test.NumberOfFixAllIterations = 1;
428-
}
419+
test.NumberOfIncrementalIterations = 1;
420+
test.NumberOfFixAllIterations = 1;
429421
}
430422

431423
test.ExpectedDiagnostics.AddRange(expected);

StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1616UnitTests.cs

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -612,18 +612,10 @@ private static Task VerifyCSharpFixAsync(string source, DiagnosticResult[] expec
612612
},
613613
};
614614

615-
if (source == fixedSource)
615+
if (source == fixedSource && offerEmptyFixer)
616616
{
617-
test.FixedState.InheritanceMode = StateInheritanceMode.AutoInheritAll;
618-
test.FixedState.MarkupHandling = MarkupMode.Allow;
619-
test.BatchFixedState.InheritanceMode = StateInheritanceMode.AutoInheritAll;
620-
test.BatchFixedState.MarkupHandling = MarkupMode.Allow;
621-
622-
if (offerEmptyFixer)
623-
{
624-
test.NumberOfIncrementalIterations = 1;
625-
test.NumberOfFixAllIterations = 1;
626-
}
617+
test.NumberOfIncrementalIterations = 1;
618+
test.NumberOfFixAllIterations = 1;
627619
}
628620

629621
test.ExpectedDiagnostics.AddRange(expected);

StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1617UnitTests.cs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -359,14 +359,6 @@ private static Task VerifyCSharpFixAsync(string source, DiagnosticResult[] expec
359359
},
360360
};
361361

362-
if (source == fixedSource)
363-
{
364-
test.FixedState.InheritanceMode = StateInheritanceMode.AutoInheritAll;
365-
test.FixedState.MarkupHandling = MarkupMode.Allow;
366-
test.BatchFixedState.InheritanceMode = StateInheritanceMode.AutoInheritAll;
367-
test.BatchFixedState.MarkupHandling = MarkupMode.Allow;
368-
}
369-
370362
test.ExpectedDiagnostics.AddRange(expected);
371363
return test.RunAsync(cancellationToken);
372364
}

StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1629UnitTests.cs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -869,14 +869,6 @@ private static Task VerifyCSharpFixAsync(string source, DiagnosticResult[] expec
869869
test.TestCode = source;
870870
test.FixedCode = fixedSource;
871871

872-
if (source == fixedSource)
873-
{
874-
test.FixedState.InheritanceMode = StateInheritanceMode.AutoInheritAll;
875-
test.FixedState.MarkupHandling = MarkupMode.Allow;
876-
test.BatchFixedState.InheritanceMode = StateInheritanceMode.AutoInheritAll;
877-
test.BatchFixedState.MarkupHandling = MarkupMode.Allow;
878-
}
879-
880872
return test.RunAsync(cancellationToken);
881873
}
882874

0 commit comments

Comments
 (0)