Skip to content

Commit

Permalink
Merge pull request #233 from earloc/chore/namespace
Browse files Browse the repository at this point in the history
chore: normalize project name and namespaces
  • Loading branch information
earloc authored Oct 26, 2024
2 parents 46da57c + 6d6bc39 commit 3db6d56
Show file tree
Hide file tree
Showing 22 changed files with 62 additions and 57 deletions.
8 changes: 4 additions & 4 deletions TypealizR.sln
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/Playground.Console/Playground.Console.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Playground.Common\Playground.Common.csproj" />
<ProjectReference Include="..\TypealizeR.Analyzers.CodeFixes\TypealizeR.Analyzers.CodeFixes.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
<ProjectReference Include="..\TypealizeR.Analyzers\TypealizeR.Analyzers.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
<ProjectReference Include="..\TypealizR.Analyzers.CodeFixes\TypealizR.Analyzers.CodeFixes.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
<ProjectReference Include="..\TypealizR.Analyzers\TypealizR.Analyzers.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
<ProjectReference Include="..\TypealizR\TypealizR.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="true" />
</ItemGroup>

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using Microsoft.CodeAnalysis;
using Document = Microsoft.CodeAnalysis.Document;

namespace TypealizeR.Analyzers;
namespace TypealizR.Analyzers;

internal interface ICodeFixer
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<RootNamespace>TypealizeR.Analyzers</RootNamespace>
<RootNamespace>TypealizR.Analyzers</RootNamespace>
<LangVersion>latest</LangVersion>
</PropertyGroup>

Expand Down Expand Up @@ -36,7 +36,7 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\TypealizeR.Analyzers\TypealizeR.Analyzers.csproj" />
<ProjectReference Include="..\TypealizR.Analyzers\TypealizR.Analyzers.csproj" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, CodeFixerFactory> codeFixers = new()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<InvocationExpressionSyntax>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\TypealizeR.Analyzers.CodeFixes\TypealizeR.Analyzers.CodeFixes.csproj" />
<ProjectReference Include="..\TypealizeR.Analyzers\TypealizeR.Analyzers.csproj" />
<ProjectReference Include="..\TypealizR.Analyzers.CodeFixes\TypealizR.Analyzers.CodeFixes.csproj" />
<ProjectReference Include="..\TypealizR.Analyzers\TypealizR.Analyzers.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -373,7 +375,7 @@ public Foo(IStringLocalizer<Foo> 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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

<PropertyGroup>
<TargetFramework>net472</TargetFramework>
<RootNamespace>TypealizeR.Analyzers.Vsix</RootNamespace>
<AssemblyName>TypealizeR.Analyzers.Vsix</AssemblyName>
<RootNamespace>TypealizR.Analyzers.Vsix</RootNamespace>
<AssemblyName>TypealizR.Analyzers.Vsix</AssemblyName>
<IsPackable>false</IsPackable>
</PropertyGroup>

Expand Down Expand Up @@ -36,8 +36,8 @@
<Import Project="$(VSToolsPath)\VSSDK\Microsoft.VsSDK.targets" Condition="Exists('$(VSToolsPath)\VSSDK\Microsoft.VsSDK.targets')" />

<ItemGroup>
<ProjectReference Include="..\TypealizeR.Analyzers.CodeFixes\TypealizeR.Analyzers.CodeFixes.csproj" />
<ProjectReference Include="..\TypealizeR.Analyzers\TypealizeR.Analyzers.csproj" />
<ProjectReference Include="..\TypealizR.Analyzers.CodeFixes\TypealizR.Analyzers.CodeFixes.csproj" />
<ProjectReference Include="..\TypealizR.Analyzers\TypealizR.Analyzers.csproj" />
</ItemGroup>

<ItemGroup>
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
<Metadata>
<Identity Id="TypealizeR.Analyzers.ff4d36aa-259c-4d7a-ae36-d44b0d6e7a0e" Version="1.0" Language="en-US" Publisher="earloc"/>
<DisplayName>TypealizeR.Analyzers</DisplayName>
<Identity Id="TypealizR.Analyzers.ff4d36aa-259c-4d7a-ae36-d44b0d6e7a0e" Version="1.0" Language="en-US" Publisher="earloc"/>
<DisplayName>TypealizR.Analyzers</DisplayName>
<Description xml:space="preserve">This is a sample diagnostic extension for the .NET Compiler Platform ("Roslyn").</Description>
</Metadata>
<Installation>
Expand All @@ -12,10 +12,10 @@
<Dependency Id="Microsoft.Framework.NDP" DisplayName="Microsoft .NET Framework" d:Source="Manual" Version="[4.5,)" />
</Dependencies>
<Assets>
<Asset Type="Microsoft.VisualStudio.MefComponent" d:Source="Project" d:ProjectName="TypealizeR.Analyzers" Path="|TypealizeR.Analyzers|"/>
<Asset Type="Microsoft.VisualStudio.Analyzer" d:Source="Project" d:ProjectName="TypealizeR.Analyzers" Path="|TypealizeR.Analyzers|"/>
<Asset Type="Microsoft.VisualStudio.MefComponent" d:Source="Project" d:ProjectName="TypealizeR.Analyzers.CodeFixes" Path="|TypealizeR.Analyzers.CodeFixes|"/>
<Asset Type="Microsoft.VisualStudio.Analyzer" d:Source="Project" d:ProjectName="TypealizeR.Analyzers.CodeFixes" Path="|TypealizeR.Analyzers.CodeFixes|"/>
<Asset Type="Microsoft.VisualStudio.MefComponent" d:Source="Project" d:ProjectName="TypealizR.Analyzers" Path="|TypealizR.Analyzers|"/>
<Asset Type="Microsoft.VisualStudio.Analyzer" d:Source="Project" d:ProjectName="TypealizR.Analyzers" Path="|TypealizR.Analyzers|"/>
<Asset Type="Microsoft.VisualStudio.MefComponent" d:Source="Project" d:ProjectName="TypealizR.Analyzers.CodeFixes" Path="|TypealizR.Analyzers.CodeFixes|"/>
<Asset Type="Microsoft.VisualStudio.Analyzer" d:Source="Project" d:ProjectName="TypealizR.Analyzers.CodeFixes" Path="|TypealizR.Analyzers.CodeFixes|"/>
</Assets>
<Prerequisites>
<Prerequisite Id="Microsoft.VisualStudio.Component.CoreEditor" Version="[15.0,)" DisplayName="Visual Studio core editor" />
Expand Down
8 changes: 8 additions & 0 deletions src/TypealizR.Analyzers/AnalyzerReleases.Unshipped.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
; Unshipped analyzer release

### New Rules

Rule ID | Category | Severity | Notes
--------|----------|----------|--------------------
TR1000 | Usage | Hidden | UseIndexerAnalyzer_UseIndexSignature

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,12 @@
</ItemGroup>

<ItemGroup>
<Compile Update="Resources.Designer.cs" DesignTime="True" AutoGen="True"
DependentUpon="Resources.resx" />
<EmbeddedResource Update="Resources.resx" Generator="ResXFileCodeGenerator"
LastGenOutput="Resources.Designer.cs" />
<ProjectReference Include="..\TypealizR\TypealizR.csproj" />
</ItemGroup>

<ItemGroup>
<Compile Update="Resources.Designer.cs" DesignTime="True" AutoGen="True" DependentUpon="Resources.resx" />
<EmbeddedResource Update="Resources.resx" Generator="ResXFileCodeGenerator" LastGenOutput="Resources.Designer.cs" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions src/TypealizR/Diagnostics/DiagnosticsId.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
namespace TypealizR.Diagnostics;

internal enum DiagnosticsId
public enum DiagnosticsId
{
TR0001,
TR0002,
TR0003,
TR0004, TR0005
TR0004, TR0005,
TR1000
}
Expand Down
8 changes: 0 additions & 8 deletions src/TypealizeR.Analyzers/AnalyzerReleases.Unshipped.md

This file was deleted.

0 comments on commit 3db6d56

Please sign in to comment.