Skip to content

Commit d37f65a

Browse files
committed
Automatically apply StateInheritanceMode
The need for the manual setting was removed in dotnet/roslyn-sdk#246
1 parent 1fe16b6 commit d37f65a

14 files changed

Lines changed: 6 additions & 116 deletions

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

StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1642UnitTests.cs

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

1248-
if (source == fixedSource)
1249-
{
1250-
test.FixedState.InheritanceMode = StateInheritanceMode.AutoInheritAll;
1251-
test.FixedState.MarkupHandling = MarkupMode.Allow;
1252-
test.BatchFixedState.InheritanceMode = StateInheritanceMode.AutoInheritAll;
1253-
test.BatchFixedState.MarkupHandling = MarkupMode.Allow;
1254-
}
1255-
12561248
return test.RunAsync(cancellationToken);
12571249
}
12581250

StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1643UnitTests.cs

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

349-
if (source == fixedSource)
350-
{
351-
test.FixedState.InheritanceMode = StateInheritanceMode.AutoInheritAll;
352-
test.FixedState.MarkupHandling = MarkupMode.Allow;
353-
test.BatchFixedState.InheritanceMode = StateInheritanceMode.AutoInheritAll;
354-
test.BatchFixedState.MarkupHandling = MarkupMode.Allow;
355-
}
356-
357349
return test.RunAsync(cancellationToken);
358350
}
359351

StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1651UnitTests.cs

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

267-
if (source == fixedSource)
268-
{
269-
test.FixedState.InheritanceMode = StateInheritanceMode.AutoInheritAll;
270-
test.FixedState.MarkupHandling = MarkupMode.Allow;
271-
test.BatchFixedState.InheritanceMode = StateInheritanceMode.AutoInheritAll;
272-
test.BatchFixedState.MarkupHandling = MarkupMode.Allow;
273-
}
274-
275267
return test.RunAsync(cancellationToken);
276268
}
277269

StyleCop.Analyzers/StyleCop.Analyzers.Test/MaintainabilityRules/FileMayOnlyContainTestBase.cs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -339,16 +339,6 @@ protected Task VerifyCSharpFixAsync(string source, string testSettings, Diagnost
339339
test.FixedSources.Add(fixedSource);
340340
}
341341

342-
if (fixedSources.Length == 1
343-
&& (fixedSources[0].fileName == string.Empty || fixedSources[0].fileName == "Test0.cs")
344-
&& source == fixedSources[0].content)
345-
{
346-
test.FixedState.InheritanceMode = StateInheritanceMode.AutoInheritAll;
347-
test.FixedState.MarkupHandling = MarkupMode.Allow;
348-
test.BatchFixedState.InheritanceMode = StateInheritanceMode.AutoInheritAll;
349-
test.BatchFixedState.MarkupHandling = MarkupMode.Allow;
350-
}
351-
352342
test.ExpectedDiagnostics.AddRange(expected);
353343
return test.RunAsync(cancellationToken);
354344
}

0 commit comments

Comments
 (0)