diff --git a/TypealizR.sln b/TypealizR.sln index 75739e4..7b4356e 100644 --- a/TypealizR.sln +++ b/TypealizR.sln @@ -32,15 +32,15 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TypealizR.CLI", "src\Typeal EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Playground.Common", "src\Playground.Common\Playground.Common.csproj", "{0E9B0505-3680-40A2-A0AC-31C9117D1A24}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TypealizeR.Analyzers", "src\TypealizeR.Analyzers\TypealizeR.Analyzers.csproj", "{9900F54D-8EAB-470F-9936-BC14B24081F3}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TypealizR.Analyzers", "src\TypealizR.Analyzers\TypealizR.Analyzers.csproj", "{9900F54D-8EAB-470F-9936-BC14B24081F3}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TypealizeR.Analyzers.CodeFixes", "src\TypealizeR.Analyzers.CodeFixes\TypealizeR.Analyzers.CodeFixes.csproj", "{9729BAAA-29C7-471A-A3EE-9F9409477E16}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TypealizR.Analyzers.CodeFixes", "src\TypealizR.Analyzers.CodeFixes\TypealizR.Analyzers.CodeFixes.csproj", "{9729BAAA-29C7-471A-A3EE-9F9409477E16}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TypealizeR.Analyzers.Tests", "src\TypealizeR.Analyzers.Test\TypealizeR.Analyzers.Tests.csproj", "{4B7D4786-87BE-45B5-A8F3-D3BD33E46AB0}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TypealizR.Analyzers.Tests", "src\TypealizR.Analyzers.Test\TypealizR.Analyzers.Tests.csproj", "{4B7D4786-87BE-45B5-A8F3-D3BD33E46AB0}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{F1ACB111-3C06-4CB5-B08B-3560F625EF7C}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TypealizeR.Analyzers.Vsix", "src\TypealizeR.Analyzers.Vsix\TypealizeR.Analyzers.Vsix.csproj", "{FBF87176-01A1-4715-B220-FAC79E35DB2F}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TypealizR.Analyzers.Vsix", "src\TypealizR.Analyzers.Vsix\TypealizR.Analyzers.Vsix.csproj", "{FBF87176-01A1-4715-B220-FAC79E35DB2F}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/src/Playground.Console/Playground.Console.csproj b/src/Playground.Console/Playground.Console.csproj index aac52e3..a4be081 100644 --- a/src/Playground.Console/Playground.Console.csproj +++ b/src/Playground.Console/Playground.Console.csproj @@ -11,8 +11,8 @@ - - + + diff --git a/src/TypealizeR.Analyzers.CodeFixes/CodeFixResources.Designer.cs b/src/TypealizR.Analyzers.CodeFixes/CodeFixResources.Designer.cs similarity index 92% rename from src/TypealizeR.Analyzers.CodeFixes/CodeFixResources.Designer.cs rename to src/TypealizR.Analyzers.CodeFixes/CodeFixResources.Designer.cs index 9dfde60..acb427b 100644 --- a/src/TypealizeR.Analyzers.CodeFixes/CodeFixResources.Designer.cs +++ b/src/TypealizR.Analyzers.CodeFixes/CodeFixResources.Designer.cs @@ -8,7 +8,7 @@ // //------------------------------------------------------------------------------ -namespace TypealizeR.Analyzers { +namespace TypealizR.Analyzers { using System; @@ -39,7 +39,7 @@ internal CodeFixResources() { internal static global::System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("TypealizeR.Analyzers.CodeFixResources", typeof(CodeFixResources).Assembly); + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("TypealizR.Analyzers.CodeFixResources", typeof(CodeFixResources).Assembly); resourceMan = temp; } return resourceMan; diff --git a/src/TypealizeR.Analyzers.CodeFixes/CodeFixResources.resx b/src/TypealizR.Analyzers.CodeFixes/CodeFixResources.resx similarity index 100% rename from src/TypealizeR.Analyzers.CodeFixes/CodeFixResources.resx rename to src/TypealizR.Analyzers.CodeFixes/CodeFixResources.resx diff --git a/src/TypealizeR.Analyzers.CodeFixes/ICodeFixer.cs b/src/TypealizR.Analyzers.CodeFixes/ICodeFixer.cs similarity index 88% rename from src/TypealizeR.Analyzers.CodeFixes/ICodeFixer.cs rename to src/TypealizR.Analyzers.CodeFixes/ICodeFixer.cs index a50dc76..4133fae 100644 --- a/src/TypealizeR.Analyzers.CodeFixes/ICodeFixer.cs +++ b/src/TypealizR.Analyzers.CodeFixes/ICodeFixer.cs @@ -3,7 +3,7 @@ using Microsoft.CodeAnalysis; using Document = Microsoft.CodeAnalysis.Document; -namespace TypealizeR.Analyzers; +namespace TypealizR.Analyzers; internal interface ICodeFixer { diff --git a/src/TypealizeR.Analyzers.CodeFixes/TypealizeR.Analyzers.CodeFixes.csproj b/src/TypealizR.Analyzers.CodeFixes/TypealizR.Analyzers.CodeFixes.csproj similarity index 88% rename from src/TypealizeR.Analyzers.CodeFixes/TypealizeR.Analyzers.CodeFixes.csproj rename to src/TypealizR.Analyzers.CodeFixes/TypealizR.Analyzers.CodeFixes.csproj index 0b5b9de..81caeb1 100644 --- a/src/TypealizeR.Analyzers.CodeFixes/TypealizeR.Analyzers.CodeFixes.csproj +++ b/src/TypealizR.Analyzers.CodeFixes/TypealizR.Analyzers.CodeFixes.csproj @@ -1,8 +1,8 @@ - + netstandard2.0 - TypealizeR.Analyzers + TypealizR.Analyzers latest @@ -36,7 +36,7 @@ - + diff --git a/src/TypealizeR.Analyzers.CodeFixes/TypealizeRCodeFixProvider.cs b/src/TypealizR.Analyzers.CodeFixes/TypealizeRCodeFixProvider.cs similarity index 91% rename from src/TypealizeR.Analyzers.CodeFixes/TypealizeRCodeFixProvider.cs rename to src/TypealizR.Analyzers.CodeFixes/TypealizeRCodeFixProvider.cs index 52d86ac..d1e594e 100644 --- a/src/TypealizeR.Analyzers.CodeFixes/TypealizeRCodeFixProvider.cs +++ b/src/TypealizR.Analyzers.CodeFixes/TypealizeRCodeFixProvider.cs @@ -7,12 +7,12 @@ using Microsoft.CodeAnalysis.CodeActions; using Microsoft.CodeAnalysis.CodeFixes; -namespace TypealizeR.Analyzers; +namespace TypealizR.Analyzers; internal delegate ICodeFixer CodeFixerFactory(SyntaxNode root, Diagnostic diagnostic); -[ExportCodeFixProvider(LanguageNames.CSharp, Name = nameof(TypealizeRCodeFixProvider)), Shared] -public class TypealizeRCodeFixProvider : CodeFixProvider +[ExportCodeFixProvider(LanguageNames.CSharp, Name = nameof(TypealizRCodeFixProvider)), Shared] +public class TypealizRCodeFixProvider : CodeFixProvider { private readonly Dictionary codeFixers = new() diff --git a/src/TypealizeR.Analyzers.CodeFixes/UseIndexerCodeFixer.cs b/src/TypealizR.Analyzers.CodeFixes/UseIndexerCodeFixer.cs similarity index 96% rename from src/TypealizeR.Analyzers.CodeFixes/UseIndexerCodeFixer.cs rename to src/TypealizR.Analyzers.CodeFixes/UseIndexerCodeFixer.cs index 293bf91..b16f1f5 100644 --- a/src/TypealizeR.Analyzers.CodeFixes/UseIndexerCodeFixer.cs +++ b/src/TypealizR.Analyzers.CodeFixes/UseIndexerCodeFixer.cs @@ -7,7 +7,7 @@ using Microsoft.CodeAnalysis.CSharp.Syntax; using Document = Microsoft.CodeAnalysis.Document; -namespace TypealizeR.Analyzers; +namespace TypealizR.Analyzers; public class UseIndexerCodeFixer(SyntaxNode root, Diagnostic diagnostic) : ICodeFixer { diff --git a/src/TypealizeR.Analyzers.Test/GlobalSuppressions.cs b/src/TypealizR.Analyzers.Test/GlobalSuppressions.cs similarity index 100% rename from src/TypealizeR.Analyzers.Test/GlobalSuppressions.cs rename to src/TypealizR.Analyzers.Test/GlobalSuppressions.cs diff --git a/src/TypealizeR.Analyzers.Test/TypealizeR.Analyzers.Tests.csproj b/src/TypealizR.Analyzers.Test/TypealizR.Analyzers.Tests.csproj similarity index 85% rename from src/TypealizeR.Analyzers.Test/TypealizeR.Analyzers.Tests.csproj rename to src/TypealizR.Analyzers.Test/TypealizR.Analyzers.Tests.csproj index 450b5e4..3ee0ff1 100644 --- a/src/TypealizeR.Analyzers.Test/TypealizeR.Analyzers.Tests.csproj +++ b/src/TypealizR.Analyzers.Test/TypealizR.Analyzers.Tests.csproj @@ -22,8 +22,8 @@ - - + + diff --git a/src/TypealizeR.Analyzers.Test/UseIndexerAnalyzer.Tests.cs b/src/TypealizR.Analyzers.Test/UseIndexerAnalyzer.Tests.cs similarity index 87% rename from src/TypealizeR.Analyzers.Test/UseIndexerAnalyzer.Tests.cs rename to src/TypealizR.Analyzers.Test/UseIndexerAnalyzer.Tests.cs index bbc7c14..6007e02 100644 --- a/src/TypealizeR.Analyzers.Test/UseIndexerAnalyzer.Tests.cs +++ b/src/TypealizR.Analyzers.Test/UseIndexerAnalyzer.Tests.cs @@ -1,11 +1,13 @@ using System.Threading.Tasks; using Microsoft.VisualStudio.TestTools.UnitTesting; +using static TypealizR.Diagnostics.DiagnosticsId; + using Verify = Microsoft.CodeAnalysis.CSharp.Testing.CSharpCodeFixVerifier< - TypealizeR.Analyzers.UseIndexerAnalyzer, - TypealizeR.Analyzers.TypealizeRCodeFixProvider, + TypealizR.Analyzers.UseIndexerAnalyzer, + TypealizR.Analyzers.TypealizRCodeFixProvider, Microsoft.CodeAnalysis.Testing.DefaultVerifier>; -namespace TypealizeR.Analyzers.Tests; +namespace TypealizR.Analyzers.Tests; [TestClass] public class UseIndexerAnalyzer_Test @@ -108,7 +110,7 @@ public Foo(IStringLocalizer localizer) { } """); - var expectedDiagnostics = Verify.Diagnostic(nameof(UseIndexerAnalyzer)).WithLocation(0).WithArguments("Bar"); + var expectedDiagnostics = Verify.Diagnostic(TR1000.ToString()).WithLocation(0).WithArguments("Bar"); var expectedCode = TestCode(""" namespace ConsoleApplication1 { @@ -143,7 +145,7 @@ private IStringLocalizer GetLocalizer() { } """); - var expectedDiagnostics = Verify.Diagnostic(nameof(UseIndexerAnalyzer)).WithLocation(0).WithArguments("Bar"); + var expectedDiagnostics = Verify.Diagnostic(TR1000.ToString()).WithLocation(0).WithArguments("Bar"); var expectedCode = TestCode(""" namespace ConsoleApplication1 { @@ -179,7 +181,7 @@ public Foo() { } """); - var expectedDiagnostics = Verify.Diagnostic(nameof(UseIndexerAnalyzer)).WithLocation(0).WithArguments("Bar"); + var expectedDiagnostics = Verify.Diagnostic(TR1000.ToString()).WithLocation(0).WithArguments("Bar"); var expectedCode = TestCode(""" namespace ConsoleApplication1 { @@ -249,7 +251,7 @@ public Foo(IStringLocalizer localizer) { } """); - var expectedDiagnostics = Verify.Diagnostic(nameof(UseIndexerAnalyzer)).WithLocation(0).WithArguments("Bar_With_Foo"); + var expectedDiagnostics = Verify.Diagnostic(TR1000.ToString()).WithLocation(0).WithArguments("Bar_With_Foo"); var expectedCode = TestCode(""" namespace ConsoleApplication1 { @@ -279,7 +281,7 @@ public Foo(IStringLocalizer localizer) { } """); - var expectedDiagnostics = Verify.Diagnostic(nameof(UseIndexerAnalyzer)).WithLocation(0).WithArguments("Bar_With_Foo"); + var expectedDiagnostics = Verify.Diagnostic(TR1000.ToString()).WithLocation(0).WithArguments("Bar_With_Foo"); var expectedCode = TestCode(""" namespace ConsoleApplication1 { @@ -310,7 +312,7 @@ public Foo(IStringLocalizer localizer) { } """); - var expectedDiagnostics = Verify.Diagnostic(nameof(UseIndexerAnalyzer)).WithLocation(0).WithArguments("Bar_With_Foo"); + var expectedDiagnostics = Verify.Diagnostic(TR1000.ToString()).WithLocation(0).WithArguments("Bar_With_Foo"); var expectedCode = TestCode(""" namespace ConsoleApplication1 { @@ -342,7 +344,7 @@ public Foo(IStringLocalizer localizer) { } """); - var expectedDiagnostics = Verify.Diagnostic(nameof(UseIndexerAnalyzer)).WithLocation(0).WithArguments("Bar_With_Foo"); + var expectedDiagnostics = Verify.Diagnostic(TR1000.ToString()).WithLocation(0).WithArguments("Bar_With_Foo"); var expectedCode = TestCode(""" namespace ConsoleApplication1 { @@ -373,7 +375,7 @@ public Foo(IStringLocalizer localizer) { } """); - var expected = Verify.Diagnostic(nameof(UseIndexerAnalyzer)).WithLocation(0).WithArguments("Bar"); + var expected = Verify.Diagnostic(TR1000.ToString()).WithLocation(0).WithArguments("Bar"); await Verify.VerifyAnalyzerAsync(test, expected); } } diff --git a/src/TypealizeR.Analyzers.Vsix/TypealizeR.Analyzers.Vsix.csproj b/src/TypealizR.Analyzers.Vsix/TypealizR.Analyzers.Vsix.csproj similarity index 83% rename from src/TypealizeR.Analyzers.Vsix/TypealizeR.Analyzers.Vsix.csproj rename to src/TypealizR.Analyzers.Vsix/TypealizR.Analyzers.Vsix.csproj index 6e48e0b..1f86255 100644 --- a/src/TypealizeR.Analyzers.Vsix/TypealizeR.Analyzers.Vsix.csproj +++ b/src/TypealizR.Analyzers.Vsix/TypealizR.Analyzers.Vsix.csproj @@ -4,8 +4,8 @@ net472 - TypealizeR.Analyzers.Vsix - TypealizeR.Analyzers.Vsix + TypealizR.Analyzers.Vsix + TypealizR.Analyzers.Vsix false @@ -36,8 +36,8 @@ - - + + diff --git a/src/TypealizeR.Analyzers.Vsix/noop.targets b/src/TypealizR.Analyzers.Vsix/noop.targets similarity index 100% rename from src/TypealizeR.Analyzers.Vsix/noop.targets rename to src/TypealizR.Analyzers.Vsix/noop.targets diff --git a/src/TypealizeR.Analyzers.Vsix/source.extension.vsixmanifest b/src/TypealizR.Analyzers.Vsix/source.extension.vsixmanifest similarity index 69% rename from src/TypealizeR.Analyzers.Vsix/source.extension.vsixmanifest rename to src/TypealizR.Analyzers.Vsix/source.extension.vsixmanifest index 9106b0f..7e2e923 100644 --- a/src/TypealizeR.Analyzers.Vsix/source.extension.vsixmanifest +++ b/src/TypealizR.Analyzers.Vsix/source.extension.vsixmanifest @@ -1,8 +1,8 @@ - - TypealizeR.Analyzers + + TypealizR.Analyzers This is a sample diagnostic extension for the .NET Compiler Platform ("Roslyn"). @@ -12,10 +12,10 @@ - - - - + + + + diff --git a/src/TypealizeR.Analyzers/AnalyzerReleases.Shipped.md b/src/TypealizR.Analyzers/AnalyzerReleases.Shipped.md similarity index 100% rename from src/TypealizeR.Analyzers/AnalyzerReleases.Shipped.md rename to src/TypealizR.Analyzers/AnalyzerReleases.Shipped.md diff --git a/src/TypealizR.Analyzers/AnalyzerReleases.Unshipped.md b/src/TypealizR.Analyzers/AnalyzerReleases.Unshipped.md new file mode 100644 index 0000000..f5fb0e8 --- /dev/null +++ b/src/TypealizR.Analyzers/AnalyzerReleases.Unshipped.md @@ -0,0 +1,8 @@ +; Unshipped analyzer release + +### New Rules + +Rule ID | Category | Severity | Notes +--------|----------|----------|-------------------- +TR1000 | Usage | Hidden | UseIndexerAnalyzer_UseIndexSignature + diff --git a/src/TypealizeR.Analyzers/Resources.Designer.cs b/src/TypealizR.Analyzers/Resources.Designer.cs similarity index 93% rename from src/TypealizeR.Analyzers/Resources.Designer.cs rename to src/TypealizR.Analyzers/Resources.Designer.cs index 66541e8..80911e0 100644 --- a/src/TypealizeR.Analyzers/Resources.Designer.cs +++ b/src/TypealizR.Analyzers/Resources.Designer.cs @@ -8,7 +8,7 @@ // //------------------------------------------------------------------------------ -namespace TypealizeR.Analyzers { +namespace TypealizR.Analyzers { using System; @@ -39,7 +39,7 @@ internal Resources() { internal static global::System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("TypealizeR.Analyzers.Resources", typeof(Resources).Assembly); + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("TypealizR.Analyzers.Resources", typeof(Resources).Assembly); resourceMan = temp; } return resourceMan; diff --git a/src/TypealizeR.Analyzers/Resources.resx b/src/TypealizR.Analyzers/Resources.resx similarity index 100% rename from src/TypealizeR.Analyzers/Resources.resx rename to src/TypealizR.Analyzers/Resources.resx diff --git a/src/TypealizeR.Analyzers/TypealizeR.Analyzers.csproj b/src/TypealizR.Analyzers/TypealizR.Analyzers.csproj similarity index 88% rename from src/TypealizeR.Analyzers/TypealizeR.Analyzers.csproj rename to src/TypealizR.Analyzers/TypealizR.Analyzers.csproj index 64226e3..ede47d1 100644 --- a/src/TypealizeR.Analyzers/TypealizeR.Analyzers.csproj +++ b/src/TypealizR.Analyzers/TypealizR.Analyzers.csproj @@ -45,10 +45,12 @@ - - + + + + + + \ No newline at end of file diff --git a/src/TypealizeR.Analyzers/UseIndexerAnalyzer.cs b/src/TypealizR.Analyzers/UseIndexerAnalyzer.cs similarity index 94% rename from src/TypealizeR.Analyzers/UseIndexerAnalyzer.cs rename to src/TypealizR.Analyzers/UseIndexerAnalyzer.cs index 001ef25..4fe7f3e 100644 --- a/src/TypealizeR.Analyzers/UseIndexerAnalyzer.cs +++ b/src/TypealizR.Analyzers/UseIndexerAnalyzer.cs @@ -5,12 +5,12 @@ using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Diagnostics; -namespace TypealizeR.Analyzers; +namespace TypealizR.Analyzers; [DiagnosticAnalyzer(LanguageNames.CSharp)] public class UseIndexerAnalyzer : DiagnosticAnalyzer { - public const string DiagnosticId = nameof(UseIndexerAnalyzer); + public const string DiagnosticId = nameof(TypealizR.Diagnostics.DiagnosticsId.TR1000); // You can change these strings in the Resources.resx file. If you do not want your analyzer to be localize-able, you can use regular strings for Title and MessageFormat. // See https://github.com/dotnet/roslyn/blob/main/docs/analyzers/Localizing%20Analyzers.md for more on localization diff --git a/src/TypealizR/Diagnostics/DiagnosticsId.cs b/src/TypealizR/Diagnostics/DiagnosticsId.cs index 35b118a..9a06ee4 100644 --- a/src/TypealizR/Diagnostics/DiagnosticsId.cs +++ b/src/TypealizR/Diagnostics/DiagnosticsId.cs @@ -1,9 +1,10 @@ namespace TypealizR.Diagnostics; -internal enum DiagnosticsId +public enum DiagnosticsId { TR0001, TR0002, TR0003, - TR0004, TR0005 + TR0004, TR0005, + TR1000 } diff --git a/src/TypealizeR.Analyzers/AnalyzerReleases.Unshipped.md b/src/TypealizeR.Analyzers/AnalyzerReleases.Unshipped.md deleted file mode 100644 index 7c98c5d..0000000 --- a/src/TypealizeR.Analyzers/AnalyzerReleases.Unshipped.md +++ /dev/null @@ -1,8 +0,0 @@ -; Unshipped analyzer release - -### New Rules - -Rule ID | Category | Severity | Notes ---------------------|----------|----------|-------------------- -UseIndexerAnalyzer | Usage | Hidden | UseIndexerAnalyzer_UseIndexSignature -