diff --git a/StyleCop.Analyzers/Directory.Build.props b/StyleCop.Analyzers/Directory.Build.props index 0899cc333..736144c76 100644 --- a/StyleCop.Analyzers/Directory.Build.props +++ b/StyleCop.Analyzers/Directory.Build.props @@ -49,6 +49,16 @@ + + + + + + + + + + diff --git a/StyleCop.Analyzers/StyleCop.Analyzers.CodeFixes/DocumentationRules/PropertySummaryDocumentationCodeFixProvider.cs b/StyleCop.Analyzers/StyleCop.Analyzers.CodeFixes/DocumentationRules/PropertySummaryDocumentationCodeFixProvider.cs index 9a5084705..79c7412b1 100644 --- a/StyleCop.Analyzers/StyleCop.Analyzers.CodeFixes/DocumentationRules/PropertySummaryDocumentationCodeFixProvider.cs +++ b/StyleCop.Analyzers/StyleCop.Analyzers.CodeFixes/DocumentationRules/PropertySummaryDocumentationCodeFixProvider.cs @@ -21,7 +21,7 @@ namespace StyleCop.Analyzers.DocumentationRules /// [ExportCodeFixProvider(LanguageNames.CSharp, Name = nameof(PropertySummaryDocumentationCodeFixProvider))] [Shared] - public class PropertySummaryDocumentationCodeFixProvider : CodeFixProvider + internal class PropertySummaryDocumentationCodeFixProvider : CodeFixProvider { /// public override ImmutableArray FixableDiagnosticIds { get; } = diff --git a/StyleCop.Analyzers/StyleCop.Analyzers.CodeFixes/PublicAPI.Shipped.txt b/StyleCop.Analyzers/StyleCop.Analyzers.CodeFixes/PublicAPI.Shipped.txt new file mode 100644 index 000000000..e69de29bb diff --git a/StyleCop.Analyzers/StyleCop.Analyzers.CodeFixes/PublicAPI.Unshipped.txt b/StyleCop.Analyzers/StyleCop.Analyzers.CodeFixes/PublicAPI.Unshipped.txt new file mode 100644 index 000000000..e69de29bb diff --git a/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/InheritdocCodeFixProviderUnitTests.cs b/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/InheritdocCodeFixProviderUnitTests.cs index 83cef1b84..5b5efceea 100644 --- a/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/InheritdocCodeFixProviderUnitTests.cs +++ b/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/InheritdocCodeFixProviderUnitTests.cs @@ -194,7 +194,6 @@ public class ChildClass : ParentClass Diagnostic(SA1600).WithLocation(12, 35), }, FixedCode = testCode, - FixedState = { InheritanceMode = StateInheritanceMode.AutoInheritAll }, NumberOfIncrementalIterations = 1, NumberOfFixAllIterations = 1, }.RunAsync(CancellationToken.None).ConfigureAwait(false); @@ -232,7 +231,6 @@ public class ChildClass : ParentClass Diagnostic(SA1600).WithLocation(12, 35), }, FixedCode = testCode, - FixedState = { InheritanceMode = StateInheritanceMode.AutoInheritAll }, NumberOfIncrementalIterations = 1, NumberOfFixAllIterations = 1, }.RunAsync(CancellationToken.None).ConfigureAwait(false); diff --git a/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1609UnitTests.cs b/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1609UnitTests.cs index dd88ed39f..140bcbdd1 100644 --- a/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1609UnitTests.cs +++ b/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1609UnitTests.cs @@ -414,14 +414,6 @@ private static Task VerifyCSharpFixAsync(string source, DiagnosticResult[] expec }, }; - if (source == fixedSource) - { - test.FixedState.InheritanceMode = StateInheritanceMode.AutoInheritAll; - test.FixedState.MarkupHandling = MarkupMode.Allow; - test.BatchFixedState.InheritanceMode = StateInheritanceMode.AutoInheritAll; - test.BatchFixedState.MarkupHandling = MarkupMode.Allow; - } - test.ExpectedDiagnostics.AddRange(expected); return test.RunAsync(cancellationToken); } diff --git a/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1610UnitTests.cs b/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1610UnitTests.cs index cd8e76b6f..6bf2d2ada 100644 --- a/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1610UnitTests.cs +++ b/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1610UnitTests.cs @@ -414,18 +414,10 @@ private static Task VerifyCSharpFixAsync(string source, DiagnosticResult[] expec }, }; - if (source == fixedSource) + if (source == fixedSource && offerEmptyFixer) { - test.FixedState.InheritanceMode = StateInheritanceMode.AutoInheritAll; - test.FixedState.MarkupHandling = MarkupMode.Allow; - test.BatchFixedState.InheritanceMode = StateInheritanceMode.AutoInheritAll; - test.BatchFixedState.MarkupHandling = MarkupMode.Allow; - - if (offerEmptyFixer) - { - test.NumberOfIncrementalIterations = 1; - test.NumberOfFixAllIterations = 1; - } + test.NumberOfIncrementalIterations = 1; + test.NumberOfFixAllIterations = 1; } test.ExpectedDiagnostics.AddRange(expected); diff --git a/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1616UnitTests.cs b/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1616UnitTests.cs index 556d0eb4f..d27c13d38 100644 --- a/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1616UnitTests.cs +++ b/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1616UnitTests.cs @@ -612,18 +612,10 @@ private static Task VerifyCSharpFixAsync(string source, DiagnosticResult[] expec }, }; - if (source == fixedSource) + if (source == fixedSource && offerEmptyFixer) { - test.FixedState.InheritanceMode = StateInheritanceMode.AutoInheritAll; - test.FixedState.MarkupHandling = MarkupMode.Allow; - test.BatchFixedState.InheritanceMode = StateInheritanceMode.AutoInheritAll; - test.BatchFixedState.MarkupHandling = MarkupMode.Allow; - - if (offerEmptyFixer) - { - test.NumberOfIncrementalIterations = 1; - test.NumberOfFixAllIterations = 1; - } + test.NumberOfIncrementalIterations = 1; + test.NumberOfFixAllIterations = 1; } test.ExpectedDiagnostics.AddRange(expected); diff --git a/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1617UnitTests.cs b/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1617UnitTests.cs index d9b842629..86648986e 100644 --- a/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1617UnitTests.cs +++ b/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1617UnitTests.cs @@ -359,14 +359,6 @@ private static Task VerifyCSharpFixAsync(string source, DiagnosticResult[] expec }, }; - if (source == fixedSource) - { - test.FixedState.InheritanceMode = StateInheritanceMode.AutoInheritAll; - test.FixedState.MarkupHandling = MarkupMode.Allow; - test.BatchFixedState.InheritanceMode = StateInheritanceMode.AutoInheritAll; - test.BatchFixedState.MarkupHandling = MarkupMode.Allow; - } - test.ExpectedDiagnostics.AddRange(expected); return test.RunAsync(cancellationToken); } diff --git a/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1629UnitTests.cs b/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1629UnitTests.cs index c94a682a9..e59a4cc55 100644 --- a/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1629UnitTests.cs +++ b/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1629UnitTests.cs @@ -869,14 +869,6 @@ private static Task VerifyCSharpFixAsync(string source, DiagnosticResult[] expec test.TestCode = source; test.FixedCode = fixedSource; - if (source == fixedSource) - { - test.FixedState.InheritanceMode = StateInheritanceMode.AutoInheritAll; - test.FixedState.MarkupHandling = MarkupMode.Allow; - test.BatchFixedState.InheritanceMode = StateInheritanceMode.AutoInheritAll; - test.BatchFixedState.MarkupHandling = MarkupMode.Allow; - } - return test.RunAsync(cancellationToken); } diff --git a/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1642UnitTests.cs b/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1642UnitTests.cs index ed5321f04..0e8961745 100644 --- a/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1642UnitTests.cs +++ b/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1642UnitTests.cs @@ -1245,14 +1245,6 @@ private static Task VerifyCSharpFixAsync(string source, DiagnosticResult[] expec test.TestCode = source; test.FixedCode = fixedSource; - if (source == fixedSource) - { - test.FixedState.InheritanceMode = StateInheritanceMode.AutoInheritAll; - test.FixedState.MarkupHandling = MarkupMode.Allow; - test.BatchFixedState.InheritanceMode = StateInheritanceMode.AutoInheritAll; - test.BatchFixedState.MarkupHandling = MarkupMode.Allow; - } - return test.RunAsync(cancellationToken); } diff --git a/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1643UnitTests.cs b/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1643UnitTests.cs index 0af620c72..86c73bd02 100644 --- a/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1643UnitTests.cs +++ b/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1643UnitTests.cs @@ -346,14 +346,6 @@ private static Task VerifyCSharpFixAsync(string source, DiagnosticResult[] expec test.TestCode = source; test.FixedCode = fixedSource; - if (source == fixedSource) - { - test.FixedState.InheritanceMode = StateInheritanceMode.AutoInheritAll; - test.FixedState.MarkupHandling = MarkupMode.Allow; - test.BatchFixedState.InheritanceMode = StateInheritanceMode.AutoInheritAll; - test.BatchFixedState.MarkupHandling = MarkupMode.Allow; - } - return test.RunAsync(cancellationToken); } diff --git a/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1651UnitTests.cs b/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1651UnitTests.cs index 35b523863..5684ef4f0 100644 --- a/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1651UnitTests.cs +++ b/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1651UnitTests.cs @@ -264,14 +264,6 @@ private static Task VerifyCSharpFixAsync(string source, DiagnosticResult[] expec test.TestCode = source; test.FixedCode = fixedSource; - if (source == fixedSource) - { - test.FixedState.InheritanceMode = StateInheritanceMode.AutoInheritAll; - test.FixedState.MarkupHandling = MarkupMode.Allow; - test.BatchFixedState.InheritanceMode = StateInheritanceMode.AutoInheritAll; - test.BatchFixedState.MarkupHandling = MarkupMode.Allow; - } - return test.RunAsync(cancellationToken); } diff --git a/StyleCop.Analyzers/StyleCop.Analyzers.Test/HelperTests/ObjectPools/SharedPoolsTests.cs b/StyleCop.Analyzers/StyleCop.Analyzers.Test/HelperTests/ObjectPools/SharedPoolsTests.cs index 0583a8ad3..bbd62dc4b 100644 --- a/StyleCop.Analyzers/StyleCop.Analyzers.Test/HelperTests/ObjectPools/SharedPoolsTests.cs +++ b/StyleCop.Analyzers/StyleCop.Analyzers.Test/HelperTests/ObjectPools/SharedPoolsTests.cs @@ -211,17 +211,31 @@ public void TestClearAndFreeLarge() [Fact] public void TestPooledObjectHandlesNullAllocation() { - object Allocator(ObjectPool pool) + object NullAllocator(ObjectPool pool) => null; + object NonNullAllocator(ObjectPool pool) + => new object(); + + bool releaserCalled = false; void Releaser(ObjectPool pool, object obj) { + releaserCalled = true; } - using (var obj = new PooledObject(SharedPools.Default(), Allocator, Releaser)) + using (var obj = new PooledObject(SharedPools.Default(), NullAllocator, Releaser)) { Assert.Null(obj.Object); } + + Assert.False(releaserCalled); + + using (var obj = new PooledObject(SharedPools.Default(), NonNullAllocator, Releaser)) + { + Assert.NotNull(obj.Object); + } + + Assert.True(releaserCalled); } } } diff --git a/StyleCop.Analyzers/StyleCop.Analyzers.Test/Helpers/TestDiagnosticProvider.cs b/StyleCop.Analyzers/StyleCop.Analyzers.Test/Helpers/TestDiagnosticProvider.cs deleted file mode 100644 index df3a1c849..000000000 --- a/StyleCop.Analyzers/StyleCop.Analyzers.Test/Helpers/TestDiagnosticProvider.cs +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved. -// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. - -namespace StyleCop.Analyzers.Test.Helpers -{ - using System.Collections.Generic; - using System.Collections.Immutable; - using System.Linq; - using System.Threading; - using System.Threading.Tasks; - using Microsoft.CodeAnalysis; - using Microsoft.CodeAnalysis.CodeFixes; - - internal sealed class TestDiagnosticProvider : FixAllContext.DiagnosticProvider - { - private ImmutableArray diagnostics; - - private TestDiagnosticProvider(ImmutableArray diagnostics) - { - this.diagnostics = diagnostics; - } - - public override Task> GetAllDiagnosticsAsync(Project project, CancellationToken cancellationToken) - { - return Task.FromResult>(this.diagnostics); - } - - public override Task> GetDocumentDiagnosticsAsync(Document document, CancellationToken cancellationToken) - { - return Task.FromResult(this.diagnostics.Where(i => i.Location.GetLineSpan().Path == document.Name)); - } - - public override Task> GetProjectDiagnosticsAsync(Project project, CancellationToken cancellationToken) - { - return Task.FromResult(this.diagnostics.Where(i => !i.Location.IsInSource)); - } - - internal static TestDiagnosticProvider Create(ImmutableArray diagnostics) - { - return new TestDiagnosticProvider(diagnostics); - } - } -} diff --git a/StyleCop.Analyzers/StyleCop.Analyzers.Test/Helpers/TestXmlReferenceResolver.cs b/StyleCop.Analyzers/StyleCop.Analyzers.Test/Helpers/TestXmlReferenceResolver.cs deleted file mode 100644 index db94515ec..000000000 --- a/StyleCop.Analyzers/StyleCop.Analyzers.Test/Helpers/TestXmlReferenceResolver.cs +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved. -// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. - -namespace StyleCop.Analyzers.Test.Helpers -{ - using System.Collections.Generic; - using System.IO; - using System.Runtime.CompilerServices; - using System.Text; - using Microsoft.CodeAnalysis; - - internal class TestXmlReferenceResolver : XmlReferenceResolver - { - public Dictionary XmlReferences { get; } = - new Dictionary(); - - public override bool Equals(object other) - { - return ReferenceEquals(this, other); - } - - public override int GetHashCode() - { - return RuntimeHelpers.GetHashCode(this); - } - - public override Stream OpenRead(string resolvedPath) - { - string content; - if (!this.XmlReferences.TryGetValue(resolvedPath, out content)) - { - return null; - } - - return new MemoryStream(Encoding.UTF8.GetBytes(content)); - } - - public override string ResolveReference(string path, string baseFilePath) - { - return path; - } - } -} diff --git a/StyleCop.Analyzers/StyleCop.Analyzers.Test/MaintainabilityRules/DebugMessagesUnitTestsBase.cs b/StyleCop.Analyzers/StyleCop.Analyzers.Test/MaintainabilityRules/DebugMessagesUnitTestsBase.cs index d10bb8215..34357a0e8 100644 --- a/StyleCop.Analyzers/StyleCop.Analyzers.Test/MaintainabilityRules/DebugMessagesUnitTestsBase.cs +++ b/StyleCop.Analyzers/StyleCop.Analyzers.Test/MaintainabilityRules/DebugMessagesUnitTestsBase.cs @@ -297,16 +297,7 @@ protected Task VerifyCSharpDiagnosticAsync(string source, DiagnosticResult[] exp protected virtual string BuildTestCode(string format) { StringBuilder argumentList = new StringBuilder(); - foreach (var argument in this.InitialArguments) - { - if (argumentList.Length > 0) - { - argumentList.Append(", "); - } - - argumentList.Append(argument); - } - + argumentList.Append(string.Join(", ", this.InitialArguments)); if (argumentList.Length > 0) { argumentList.Append(", "); @@ -406,7 +397,7 @@ public void Bar() await this.VerifyCSharpDiagnosticAsync(string.Format(this.BuildTestCode(testCodeFormat), argument), expected, CancellationToken.None).ConfigureAwait(false); } - private class CSharpTest : StyleCopDiagnosticVerifier.CSharpTest + private class CSharpTest : StyleCopDiagnosticVerifier.CSharpTest { private readonly DebugMessagesUnitTestsBase testFixture; diff --git a/StyleCop.Analyzers/StyleCop.Analyzers.Test/MaintainabilityRules/FileMayOnlyContainTestBase.cs b/StyleCop.Analyzers/StyleCop.Analyzers.Test/MaintainabilityRules/FileMayOnlyContainTestBase.cs index 0af4a6fc2..95b33203a 100644 --- a/StyleCop.Analyzers/StyleCop.Analyzers.Test/MaintainabilityRules/FileMayOnlyContainTestBase.cs +++ b/StyleCop.Analyzers/StyleCop.Analyzers.Test/MaintainabilityRules/FileMayOnlyContainTestBase.cs @@ -339,23 +339,13 @@ protected Task VerifyCSharpFixAsync(string source, string testSettings, Diagnost test.FixedSources.Add(fixedSource); } - if (fixedSources.Length == 1 - && (fixedSources[0].fileName == string.Empty || fixedSources[0].fileName == "Test0.cs") - && source == fixedSources[0].content) - { - test.FixedState.InheritanceMode = StateInheritanceMode.AutoInheritAll; - test.FixedState.MarkupHandling = MarkupMode.Allow; - test.BatchFixedState.InheritanceMode = StateInheritanceMode.AutoInheritAll; - test.BatchFixedState.MarkupHandling = MarkupMode.Allow; - } - test.ExpectedDiagnostics.AddRange(expected); return test.RunAsync(cancellationToken); } protected virtual string GetSettings() => null; - private class CSharpTest : StyleCopCodeFixVerifier.CSharpTest + private class CSharpTest : StyleCopCodeFixVerifier.CSharpTest { private readonly FileMayOnlyContainTestBase testFixture; diff --git a/StyleCop.Analyzers/StyleCop.Analyzers.Test/OrderingRules/UsingCodeFixProviderUnitTests.cs b/StyleCop.Analyzers/StyleCop.Analyzers.Test/OrderingRules/UsingCodeFixProviderUnitTests.cs index e5007ab64..be0d6cf75 100644 --- a/StyleCop.Analyzers/StyleCop.Analyzers.Test/OrderingRules/UsingCodeFixProviderUnitTests.cs +++ b/StyleCop.Analyzers/StyleCop.Analyzers.Test/OrderingRules/UsingCodeFixProviderUnitTests.cs @@ -660,14 +660,6 @@ private Task VerifyCSharpFixAsync(string source, DiagnosticResult[] expected, st Settings = testSettings, }; - if (source == fixedSource) - { - test.FixedState.InheritanceMode = StateInheritanceMode.AutoInheritAll; - test.FixedState.MarkupHandling = MarkupMode.Allow; - test.BatchFixedState.InheritanceMode = StateInheritanceMode.AutoInheritAll; - test.BatchFixedState.MarkupHandling = MarkupMode.Allow; - } - test.ExpectedDiagnostics.AddRange(expected); test.RemainingDiagnostics.AddRange(remainingDiagnostics); return test.RunAsync(cancellationToken); diff --git a/StyleCop.Analyzers/StyleCop.Analyzers.Test/PublicApiTests.cs b/StyleCop.Analyzers/StyleCop.Analyzers.Test/PublicApiTests.cs deleted file mode 100644 index 4254199e8..000000000 --- a/StyleCop.Analyzers/StyleCop.Analyzers.Test/PublicApiTests.cs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved. -// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. - -namespace StyleCop.Analyzers.Test -{ - using System; - using System.Text; - using Xunit; - - /// - /// Unit tests related to the public API surface of StyleCop.Analyzers.dll. - /// - public class PublicApiTests - { - /// - /// This test ensures all types in StyleCop.Analyzers.dll are marked internal. - /// - [Fact] - public void TestAllTypesAreInternal() - { - StringBuilder publicTypes = new StringBuilder(); - foreach (Type type in typeof(AnalyzerCategory).Assembly.ExportedTypes) - { - if (publicTypes.Length > 0) - { - publicTypes.Append(", "); - } - - publicTypes.Append(type.Name); - } - - Assert.Equal(string.Empty, publicTypes.ToString()); - } - } -} diff --git a/StyleCop.Analyzers/StyleCop.Analyzers.Test/Settings/SettingsFileCodeFixProviderUnitTests.cs b/StyleCop.Analyzers/StyleCop.Analyzers.Test/Settings/SettingsFileCodeFixProviderUnitTests.cs index a712fac1e..9b21b8d07 100644 --- a/StyleCop.Analyzers/StyleCop.Analyzers.Test/Settings/SettingsFileCodeFixProviderUnitTests.cs +++ b/StyleCop.Analyzers/StyleCop.Analyzers.Test/Settings/SettingsFileCodeFixProviderUnitTests.cs @@ -84,7 +84,6 @@ public async Task TestSettingsFileAlreadyExistsAsync() TestCode = TestCode, ExpectedDiagnostics = { Diagnostic(FileHeaderAnalyzers.SA1633DescriptorMissing).WithLocation(1, 1) }, FixedCode = TestCode, - FixedState = { InheritanceMode = StateInheritanceMode.AutoInheritAll }, Settings = "{}", SettingsFileName = SettingsHelper.SettingsFileName, }; @@ -105,7 +104,6 @@ public async Task TestDotPrefixedSettingsFileAlreadyExistsAsync() TestCode = TestCode, ExpectedDiagnostics = { Diagnostic(FileHeaderAnalyzers.SA1633DescriptorMissing).WithLocation(1, 1) }, FixedCode = TestCode, - FixedState = { InheritanceMode = StateInheritanceMode.AutoInheritAll }, Settings = "{}", SettingsFileName = SettingsHelper.AltSettingsFileName, }; diff --git a/StyleCop.Analyzers/StyleCop.Analyzers.Test/SpacingRules/NumberSignSpacingTestBase.cs b/StyleCop.Analyzers/StyleCop.Analyzers.Test/SpacingRules/NumberSignSpacingTestBase.cs index a05fee87d..59c666fa5 100644 --- a/StyleCop.Analyzers/StyleCop.Analyzers.Test/SpacingRules/NumberSignSpacingTestBase.cs +++ b/StyleCop.Analyzers/StyleCop.Analyzers.Test/SpacingRules/NumberSignSpacingTestBase.cs @@ -590,19 +590,11 @@ private Task VerifyCSharpFixAsync(string source, DiagnosticResult[] expected, st FixedCode = fixedSource, }; - if (source == fixedSource) - { - test.FixedState.InheritanceMode = StateInheritanceMode.AutoInheritAll; - test.FixedState.MarkupHandling = MarkupMode.Allow; - test.BatchFixedState.InheritanceMode = StateInheritanceMode.AutoInheritAll; - test.BatchFixedState.MarkupHandling = MarkupMode.Allow; - } - test.ExpectedDiagnostics.AddRange(expected); return test.RunAsync(cancellationToken); } - private class CSharpTest : StyleCopCodeFixVerifier.CSharpTest + private class CSharpTest : StyleCopCodeFixVerifier.CSharpTest { private readonly NumberSignSpacingTestBase testFixture; diff --git a/StyleCop.Analyzers/StyleCop.Analyzers.Test/Verifiers/EmptyAnalyzer.cs b/StyleCop.Analyzers/StyleCop.Analyzers.Test/Verifiers/EmptyAnalyzer.cs deleted file mode 100644 index c1acec2f0..000000000 --- a/StyleCop.Analyzers/StyleCop.Analyzers.Test/Verifiers/EmptyAnalyzer.cs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved. -// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. - -namespace StyleCop.Analyzers.Test.Verifiers -{ - using System.Collections.Immutable; - using Microsoft.CodeAnalysis; - using Microsoft.CodeAnalysis.Diagnostics; - - [DiagnosticAnalyzer(LanguageNames.CSharp, LanguageNames.VisualBasic)] - public class EmptyAnalyzer : DiagnosticAnalyzer - { - public override ImmutableArray SupportedDiagnostics - => ImmutableArray.Empty; - - public override void Initialize(AnalysisContext context) - { - } - } -} diff --git a/StyleCop.Analyzers/StyleCop.Analyzers.Test/Verifiers/StyleCopCodeFixVerifier`2.cs b/StyleCop.Analyzers/StyleCop.Analyzers.Test/Verifiers/StyleCopCodeFixVerifier`2.cs index 653e9d0f2..704878d46 100644 --- a/StyleCop.Analyzers/StyleCop.Analyzers.Test/Verifiers/StyleCopCodeFixVerifier`2.cs +++ b/StyleCop.Analyzers/StyleCop.Analyzers.Test/Verifiers/StyleCopCodeFixVerifier`2.cs @@ -61,14 +61,6 @@ internal static Task VerifyCSharpFixAsync(string source, DiagnosticResult[] expe FixedCode = fixedSource, }; - if (source == fixedSource) - { - test.FixedState.InheritanceMode = StateInheritanceMode.AutoInheritAll; - test.FixedState.MarkupHandling = MarkupMode.Allow; - test.BatchFixedState.InheritanceMode = StateInheritanceMode.AutoInheritAll; - test.BatchFixedState.MarkupHandling = MarkupMode.Allow; - } - test.ExpectedDiagnostics.AddRange(expected); return test.RunAsync(cancellationToken); } @@ -88,14 +80,6 @@ internal static Task VerifyCSharpFixAsync(LanguageVersion? languageVersion, stri FixedCode = fixedSource, }; - if (source == fixedSource) - { - test.FixedState.InheritanceMode = StateInheritanceMode.AutoInheritAll; - test.FixedState.MarkupHandling = MarkupMode.Allow; - test.BatchFixedState.InheritanceMode = StateInheritanceMode.AutoInheritAll; - test.BatchFixedState.MarkupHandling = MarkupMode.Allow; - } - test.ExpectedDiagnostics.AddRange(expected); return test.RunAsync(cancellationToken); } diff --git a/StyleCop.Analyzers/StyleCop.Analyzers/PublicAPI.Shipped.txt b/StyleCop.Analyzers/StyleCop.Analyzers/PublicAPI.Shipped.txt new file mode 100644 index 000000000..e69de29bb diff --git a/StyleCop.Analyzers/StyleCop.Analyzers/PublicAPI.Unshipped.txt b/StyleCop.Analyzers/StyleCop.Analyzers/PublicAPI.Unshipped.txt new file mode 100644 index 000000000..e69de29bb