Skip to content

Commit

Permalink
调整分析器的命名空间,使其更简洁
Browse files Browse the repository at this point in the history
  • Loading branch information
walterlv committed Jul 16, 2024
1 parent 4104b35 commit 28540f7
Show file tree
Hide file tree
Showing 32 changed files with 60 additions and 114 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using dotnetCampus.Ipc.DiagnosticAnalyzers.Compiling;
using dotnetCampus.Ipc.Analyzers.Compiling;

namespace dotnetCampus.Ipc.DiagnosticAnalyzers;
namespace dotnetCampus.Ipc.Analyzers;

[DiagnosticAnalyzer(LanguageNames.CSharp)]
public class AddIpcProxyConfigsAnalyzer : DiagnosticAnalyzer
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using dotnetCampus.Ipc.DiagnosticAnalyzers.Compiling;
using dotnetCampus.Ipc.Analyzers.Compiling;

namespace dotnetCampus.Ipc.DiagnosticAnalyzers;
namespace dotnetCampus.Ipc.Analyzers;

[DiagnosticAnalyzer(LanguageNames.CSharp)]
public class AddIpcShapeAnalyzer : DiagnosticAnalyzer
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using dotnetCampus.Ipc.CodeAnalysis.Models;
using dotnetCampus.Ipc.SourceGenerators.Compiling;
using dotnetCampus.Ipc.Generators.Compiling;

namespace dotnetCampus.Ipc.DiagnosticAnalyzers.Compiling;
namespace dotnetCampus.Ipc.Analyzers.Compiling;

internal static class IpcAttributeHelper
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace dotnetCampus.Ipc.DiagnosticAnalyzers.Compiling;
namespace dotnetCampus.Ipc.Analyzers.Compiling;

/// <summary>
/// 用语法节点和语义模型描述一次方法调用。
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using dotnetCampus.Ipc.DiagnosticAnalyzers.Compiling;
using dotnetCampus.Ipc.Analyzers.Compiling;

namespace dotnetCampus.Ipc.DiagnosticAnalyzers;
namespace dotnetCampus.Ipc.Analyzers;

[DiagnosticAnalyzer(LanguageNames.CSharp)]
internal class ContractTypeDismatchWithInterfaceAnalyzer : DiagnosticAnalyzer
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using dotnetCampus.Ipc.DiagnosticAnalyzers.Compiling;
using dotnetCampus.Ipc.Analyzers.Compiling;

namespace dotnetCampus.Ipc.DiagnosticAnalyzers;
namespace dotnetCampus.Ipc.Analyzers;

[DiagnosticAnalyzer(LanguageNames.CSharp)]
internal class ContractTypeMustBeAnInterfaceAnalyzer : DiagnosticAnalyzer
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using dotnetCampus.Ipc.DiagnosticAnalyzers.Compiling;
using dotnetCampus.Ipc.Analyzers.Compiling;

namespace dotnetCampus.Ipc.DiagnosticAnalyzers;
namespace dotnetCampus.Ipc.Analyzers;

[DiagnosticAnalyzer(LanguageNames.CSharp)]
public class DefaultReturnDependsOnIgnoresIpcExceptionAnalyzer : DiagnosticAnalyzer
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using dotnetCampus.Ipc.DiagnosticAnalyzers.Compiling;
using dotnetCampus.Ipc.Analyzers.Compiling;

namespace dotnetCampus.Ipc.DiagnosticAnalyzers;
namespace dotnetCampus.Ipc.Analyzers;

[DiagnosticAnalyzer(LanguageNames.CSharp)]
public class EmptyIpcMemberAttributeIsUnnecessaryAnalyzer : DiagnosticAnalyzer
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using dotnetCampus.Ipc.DiagnosticAnalyzers.Compiling;
using dotnetCampus.Ipc.Analyzers.Compiling;

namespace dotnetCampus.Ipc.DiagnosticAnalyzers;
namespace dotnetCampus.Ipc.Analyzers;

[DiagnosticAnalyzer(LanguageNames.CSharp)]
public class IgnoresIpcExceptionIsRecommendedAnalyzer : DiagnosticAnalyzer
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using dotnetCampus.Ipc.DiagnosticAnalyzers.Compiling;

using dotnetCampus.Ipc.Analyzers.Compiling;
using Microsoft.CodeAnalysis.CSharp.Syntax;

namespace dotnetCampus.Ipc.CodeAnalysis.Utils;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
using dotnetCampus.Ipc.DiagnosticAnalyzers.Compiling;
using dotnetCampus.Ipc.Analyzers.Compiling;
using dotnetCampus.Ipc.Generators.Compiling;
using dotnetCampus.Ipc.Properties;
using dotnetCampus.Ipc.SourceGenerators.Compiling;
using Microsoft.CodeAnalysis.CodeActions;
using Microsoft.CodeAnalysis.CodeFixes;
using Microsoft.CodeAnalysis.Text;
using static dotnetCampus.Ipc.SourceGenerators.Utils.GeneratorHelper;
using static dotnetCampus.Ipc.Generators.Utils.GeneratorHelper;
using SF = Microsoft.CodeAnalysis.CSharp.SyntaxFactory;

namespace dotnetCampus.Ipc.CodeFixeProviders;
namespace dotnetCampus.Ipc.CodeFixes;

[ExportCodeFixProvider(LanguageNames.CSharp, Name = nameof(IgnoresIpcExceptionIsRecommendedCodeFixProvider)), Shared]
public class AddIpcShapeCodeFixProvider : CodeFixProvider
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,10 @@
using System.Collections.Immutable;
using System.Composition;
using System.Threading;
using System.Threading.Tasks;

using dotnetCampus.Ipc.DiagnosticAnalyzers.Compiling;
using dotnetCampus.Ipc.Analyzers.Compiling;
using dotnetCampus.Ipc.Properties;

using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CodeActions;
using Microsoft.CodeAnalysis.CodeFixes;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;

using SF = Microsoft.CodeAnalysis.CSharp.SyntaxFactory;

namespace dotnetCampus.Ipc.CodeFixeProviders;
namespace dotnetCampus.Ipc.CodeFixes;

[ExportCodeFixProvider(LanguageNames.CSharp, Name = nameof(IgnoresIpcExceptionIsRecommendedCodeFixProvider)), Shared]
public class ChangeClassContractTypeCodeFixProvider : CodeFixProvider
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,9 @@
using System.Collections.Immutable;
using System.Composition;
using System.Threading;
using System.Threading.Tasks;

using dotnetCampus.Ipc.Properties;

using dotnetCampus.Ipc.Properties;
using Microsoft.CodeAnalysis.CodeActions;
using Microsoft.CodeAnalysis.CodeFixes;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;

using SF = Microsoft.CodeAnalysis.CSharp.SyntaxFactory;

namespace dotnetCampus.Ipc.CodeFixeProviders;
namespace dotnetCampus.Ipc.CodeFixes;

[ExportCodeFixProvider(LanguageNames.CSharp, Name = nameof(IgnoresIpcExceptionIsRecommendedCodeFixProvider)), Shared]
public class DefaultReturnDependsOnIgnoresIpcExceptionCodeFixProvider : CodeFixProvider
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,8 @@
using System.Collections.Immutable;
using System.Composition;
using System.Threading;
using System.Threading.Tasks;

using dotnetCampus.Ipc.Properties;

using dotnetCampus.Ipc.Properties;
using Microsoft.CodeAnalysis.CodeActions;
using Microsoft.CodeAnalysis.CodeFixes;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;

using SF = Microsoft.CodeAnalysis.CSharp.SyntaxFactory;

namespace dotnetCampus.Ipc.CodeFixeProviders;
namespace dotnetCampus.Ipc.CodeFixes;

[ExportCodeFixProvider(LanguageNames.CSharp, Name = nameof(IgnoresIpcExceptionIsRecommendedCodeFixProvider)), Shared]
public class EmptyIpcMemberAttributeIsUnnecessaryCodeFixProvider : CodeFixProvider
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
using dotnetCampus.Ipc.Properties;

using Microsoft.CodeAnalysis.CodeActions;
using Microsoft.CodeAnalysis.CodeFixes;

using SF = Microsoft.CodeAnalysis.CSharp.SyntaxFactory;

namespace dotnetCampus.Ipc.CodeFixeProviders;
namespace dotnetCampus.Ipc.CodeFixes;

[ExportCodeFixProvider(LanguageNames.CSharp, Name = nameof(IgnoresIpcExceptionIsRecommendedCodeFixProvider)), Shared]
public class IgnoresIpcExceptionIsRecommendedCodeFixProvider : CodeFixProvider
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,10 @@
using System.Collections.Immutable;
using System.Composition;
using System.Diagnostics;
using System.Threading;
using System.Threading.Tasks;

using dotnetCampus.Ipc.CodeAnalysis.Core;
using dotnetCampus.Ipc.DiagnosticAnalyzers.Compiling;
using dotnetCampus.Ipc.Analyzers.Compiling;
using dotnetCampus.Ipc.Properties;

using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CodeActions;
using Microsoft.CodeAnalysis.CodeFixes;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;

using SF = Microsoft.CodeAnalysis.CSharp.SyntaxFactory;

namespace dotnetCampus.Ipc.CodeFixeProviders;
namespace dotnetCampus.Ipc.CodeFixes;

[ExportCodeFixProvider(LanguageNames.CSharp, Name = nameof(IgnoresIpcExceptionIsRecommendedCodeFixProvider)), Shared]
public class LetClassImplementInterfaceCodeFixProvider : CodeFixProvider
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace dotnetCampus.Ipc.SourceGenerators.Compiling;
namespace dotnetCampus.Ipc.Generators.Compiling;
/// <summary>
/// 提供 IPC 对象(契约接口)的语法和语义分析。
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using dotnetCampus.Ipc.SourceGenerators.Models;
using dotnetCampus.Ipc.Generators.Compiling.Members;
using dotnetCampus.Ipc.Generators.Models;

namespace dotnetCampus.Ipc.SourceGenerators.Compiling;
namespace dotnetCampus.Ipc.Generators.Compiling;

/// <summary>
/// 辅助生成契约接口中每一个成员对应的 IPC 代理和对接。
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace dotnetCampus.Ipc.SourceGenerators.Compiling;
namespace dotnetCampus.Ipc.Generators.Compiling;
/// <summary>
/// 提供 IPC 对象(代理壳类)的语法和语义分析。
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using dotnetCampus.Ipc.SourceGenerators.Models;
using dotnetCampus.Ipc.Generators.Models;

namespace dotnetCampus.Ipc.SourceGenerators.Compiling.Members;
namespace dotnetCampus.Ipc.Generators.Compiling.Members;

internal interface IPublicIpcObjectProxyMemberGenerator
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using dotnetCampus.Ipc.SourceGenerators.Models;
using dotnetCampus.Ipc.Generators.Models;

namespace dotnetCampus.Ipc.SourceGenerators.Compiling.Members;
namespace dotnetCampus.Ipc.Generators.Compiling.Members;

internal class IpcPublicMethodInfo : IPublicIpcObjectProxyMemberGenerator, IPublicIpcObjectShapeMemberGenerator, IPublicIpcObjectJointMatchGenerator
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using dotnetCampus.Ipc.SourceGenerators.Models;
using dotnetCampus.Ipc.Generators.Models;

namespace dotnetCampus.Ipc.SourceGenerators.Compiling.Members;
namespace dotnetCampus.Ipc.Generators.Compiling.Members;

internal class IpcPublicPropertyInfo : IPublicIpcObjectProxyMemberGenerator, IPublicIpcObjectShapeMemberGenerator, IPublicIpcObjectJointMatchGenerator
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Security.Cryptography;

namespace dotnetCampus.Ipc.SourceGenerators.Compiling.Members;
namespace dotnetCampus.Ipc.Generators.Compiling.Members;
public static class MemberIdGenerator
{
public static string GeneratePropertyId(string getSet, string propertyName)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
using dotnetCampus.Ipc.SourceGenerators.Compiling;

using dotnetCampus.Ipc.Generators.Compiling;
using Microsoft.CodeAnalysis.Text;
using static dotnetCampus.Ipc.Generators.Utils.GeneratorHelper;

using static dotnetCampus.Ipc.SourceGenerators.Utils.GeneratorHelper;

namespace dotnetCampus.Ipc;
namespace dotnetCampus.Ipc.Generators;

/// <summary>
/// 为 IPC 接口生成对应的代理(Proxy)和对接(Joint)。
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
using dotnetCampus.Ipc.SourceGenerators.Compiling;

using dotnetCampus.Ipc.Generators.Compiling;
using Microsoft.CodeAnalysis.Text;
using static dotnetCampus.Ipc.Generators.Utils.GeneratorHelper;

using static dotnetCampus.Ipc.SourceGenerators.Utils.GeneratorHelper;

namespace dotnetCampus.Ipc;
namespace dotnetCampus.Ipc.Generators;

/// <summary>
/// 为 IPC 代理壳生成对应的代理(Proxy)。
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace dotnetCampus.Ipc.SourceGenerators.Models;
namespace dotnetCampus.Ipc.Generators.Models;

internal class ClassDeclarationSourceTextBuilder
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace dotnetCampus.Ipc.SourceGenerators.Models;
namespace dotnetCampus.Ipc.Generators.Models;

internal class MemberDeclarationSourceTextBuilder
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using dotnetCampus.Ipc.SourceGenerators.Utils;
using dotnetCampus.Ipc.Generators.Utils;

namespace dotnetCampus.Ipc.SourceGenerators.Models;
namespace dotnetCampus.Ipc.Generators.Models;

internal class SourceTextBuilder
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
using dotnetCampus.Ipc.Core;
using dotnetCampus.Ipc.SourceGenerators.Compiling;
using dotnetCampus.Ipc.SourceGenerators.Models;
using dotnetCampus.Ipc.Generators.Compiling;
using dotnetCampus.Ipc.Generators.Models;

using static dotnetCampus.Ipc.Core.GeneratorToolInfo;

namespace dotnetCampus.Ipc.SourceGenerators.Utils;
namespace dotnetCampus.Ipc.Generators.Utils;

internal static class GeneratorHelper
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
using System.Reflection;
using dotnetCampus.Ipc.Generators.Models;

using dotnetCampus.Ipc.SourceGenerators.Models;

namespace dotnetCampus.Ipc.Core;
namespace dotnetCampus.Ipc.Generators.Utils;

/// <summary>
/// 为代码生成器提供名称和版本信息。
Expand Down
2 changes: 0 additions & 2 deletions src/dotnetCampus.Ipc.Analyzers/Properties/GlobalUsings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
global using dotnetCampus.Ipc.CodeAnalysis.Utils;
global using dotnetCampus.Ipc.CompilerServices.Attributes;
global using dotnetCampus.Ipc.Core.ComponentModels;
global using dotnetCampus.Ipc.SourceGenerators.Compiling.Members;

global using Microsoft.CodeAnalysis;
global using Microsoft.CodeAnalysis.CSharp;
global using Microsoft.CodeAnalysis.CSharp.Syntax;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;

using VerifyCS = dotnetCampus.Ipc.Analyzers.Tests.CSharpCodeFixVerifier<
dotnetCampus.Ipc.DiagnosticAnalyzers.IgnoresIpcExceptionIsRecommendedAnalyzer,
dotnetCampus.Ipc.CodeFixeProviders.IgnoresIpcExceptionIsRecommendedCodeFixProvider>;
dotnetCampus.Ipc.Analyzers.IgnoresIpcExceptionIsRecommendedAnalyzer,
dotnetCampus.Ipc.CodeFixes.IgnoresIpcExceptionIsRecommendedCodeFixProvider>;

namespace dotnetCampus.Ipc.Analyzers.Tests;

Expand Down

0 comments on commit 28540f7

Please sign in to comment.