mirror of
https://github.com/GeWuYou/GFramework.git
synced 2026-03-22 10:34:30 +08:00
refactor(core): 统一C#命名规范并添加校验脚本
- 将所有IoC相关命名空间从"IoC"重命名为"Ioc" - 将所有CQRS相关命名空间从"CQRS"重命名为"Cqrs" - 更新所有受影响的using语句以匹配新的命名空间 - 在CI工作流中添加C#命名规范校验步骤 - 修正了测试文件中的命名空间引用
This commit is contained in:
parent
8b5efc69ec
commit
cb0d0682b0
5
.github/workflows/ci.yml
vendored
5
.github/workflows/ci.yml
vendored
@ -23,6 +23,9 @@ jobs:
|
|||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v6
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
# 校验C#命名空间与源码目录是否符合命名规范
|
||||||
|
- name: Validate C# naming
|
||||||
|
run: bash scripts/validate-csharp-naming.sh
|
||||||
# 缓存MegaLinter
|
# 缓存MegaLinter
|
||||||
- name: Cache MegaLinter
|
- name: Cache MegaLinter
|
||||||
uses: actions/cache@v5
|
uses: actions/cache@v5
|
||||||
@ -173,4 +176,4 @@ jobs:
|
|||||||
fetch-previous-results: true
|
fetch-previous-results: true
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
if: always()
|
if: always()
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
using GFramework.Core.Abstractions.Command;
|
using GFramework.Core.Abstractions.Command;
|
||||||
using GFramework.Core.Abstractions.Events;
|
using GFramework.Core.Abstractions.Events;
|
||||||
using GFramework.Core.Abstractions.IoC;
|
using GFramework.Core.Abstractions.Ioc;
|
||||||
using GFramework.Core.Abstractions.Query;
|
using GFramework.Core.Abstractions.Query;
|
||||||
using GFramework.Core.Abstractions.Rule;
|
using GFramework.Core.Abstractions.Rule;
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
using GFramework.Core.Abstractions.IoC;
|
using GFramework.Core.Abstractions.Ioc;
|
||||||
using GFramework.Core.Abstractions.Lifecycle;
|
using GFramework.Core.Abstractions.Lifecycle;
|
||||||
|
|
||||||
namespace GFramework.Core.Abstractions.Architecture;
|
namespace GFramework.Core.Abstractions.Architecture;
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
using GFramework.Core.Abstractions.IoC;
|
using GFramework.Core.Abstractions.Ioc;
|
||||||
|
|
||||||
namespace GFramework.Core.Abstractions.Architecture;
|
namespace GFramework.Core.Abstractions.Architecture;
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
namespace GFramework.Core.Abstractions.CQRS.Command;
|
namespace GFramework.Core.Abstractions.Cqrs.Command;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 命令输入接口,定义命令模式中输入数据的契约
|
/// 命令输入接口,定义命令模式中输入数据的契约
|
||||||
@ -11,7 +11,7 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
namespace GFramework.Core.Abstractions.CQRS;
|
namespace GFramework.Core.Abstractions.Cqrs;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 表示输入数据的标记接口。
|
/// 表示输入数据的标记接口。
|
||||||
@ -11,7 +11,7 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
namespace GFramework.Core.Abstractions.CQRS.Notification;
|
namespace GFramework.Core.Abstractions.Cqrs.Notification;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 表示通知输入数据的标记接口。
|
/// 表示通知输入数据的标记接口。
|
||||||
@ -1,4 +1,4 @@
|
|||||||
namespace GFramework.Core.Abstractions.CQRS.Query;
|
namespace GFramework.Core.Abstractions.Cqrs.Query;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查询输入接口,定义了查询操作的输入规范
|
/// 查询输入接口,定义了查询操作的输入规范
|
||||||
@ -11,7 +11,7 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
namespace GFramework.Core.Abstractions.CQRS.Request;
|
namespace GFramework.Core.Abstractions.Cqrs.Request;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 表示请求输入数据的标记接口。
|
/// 表示请求输入数据的标记接口。
|
||||||
@ -2,7 +2,7 @@
|
|||||||
using GFramework.Core.Abstractions.Systems;
|
using GFramework.Core.Abstractions.Systems;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
|
||||||
namespace GFramework.Core.Abstractions.IoC;
|
namespace GFramework.Core.Abstractions.Ioc;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 依赖注入容器接口,定义了服务注册、解析和管理的基本操作
|
/// 依赖注入容器接口,定义了服务注册、解析和管理的基本操作
|
||||||
@ -11,7 +11,7 @@ using GFramework.Core.Architectures;
|
|||||||
using GFramework.Core.Command;
|
using GFramework.Core.Command;
|
||||||
using GFramework.Core.Environment;
|
using GFramework.Core.Environment;
|
||||||
using GFramework.Core.Events;
|
using GFramework.Core.Events;
|
||||||
using GFramework.Core.IoC;
|
using GFramework.Core.Ioc;
|
||||||
using GFramework.Core.Logging;
|
using GFramework.Core.Logging;
|
||||||
using GFramework.Core.Query;
|
using GFramework.Core.Query;
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@ using GFramework.Core.Abstractions.Architecture;
|
|||||||
using GFramework.Core.Abstractions.Command;
|
using GFramework.Core.Abstractions.Command;
|
||||||
using GFramework.Core.Abstractions.Environment;
|
using GFramework.Core.Abstractions.Environment;
|
||||||
using GFramework.Core.Abstractions.Events;
|
using GFramework.Core.Abstractions.Events;
|
||||||
using GFramework.Core.Abstractions.IoC;
|
using GFramework.Core.Abstractions.Ioc;
|
||||||
using GFramework.Core.Abstractions.Model;
|
using GFramework.Core.Abstractions.Model;
|
||||||
using GFramework.Core.Abstractions.Query;
|
using GFramework.Core.Abstractions.Query;
|
||||||
using GFramework.Core.Abstractions.Systems;
|
using GFramework.Core.Abstractions.Systems;
|
||||||
@ -11,7 +11,7 @@ using GFramework.Core.Architectures;
|
|||||||
using GFramework.Core.Command;
|
using GFramework.Core.Command;
|
||||||
using GFramework.Core.Environment;
|
using GFramework.Core.Environment;
|
||||||
using GFramework.Core.Events;
|
using GFramework.Core.Events;
|
||||||
using GFramework.Core.IoC;
|
using GFramework.Core.Ioc;
|
||||||
using GFramework.Core.Query;
|
using GFramework.Core.Query;
|
||||||
using Mediator;
|
using Mediator;
|
||||||
using ICommand = GFramework.Core.Abstractions.Command.ICommand;
|
using ICommand = GFramework.Core.Abstractions.Command.ICommand;
|
||||||
|
|||||||
@ -2,7 +2,7 @@ using GFramework.Core.Abstractions.Architecture;
|
|||||||
using GFramework.Core.Abstractions.Command;
|
using GFramework.Core.Abstractions.Command;
|
||||||
using GFramework.Core.Abstractions.Environment;
|
using GFramework.Core.Abstractions.Environment;
|
||||||
using GFramework.Core.Abstractions.Events;
|
using GFramework.Core.Abstractions.Events;
|
||||||
using GFramework.Core.Abstractions.IoC;
|
using GFramework.Core.Abstractions.Ioc;
|
||||||
using GFramework.Core.Abstractions.Model;
|
using GFramework.Core.Abstractions.Model;
|
||||||
using GFramework.Core.Abstractions.Query;
|
using GFramework.Core.Abstractions.Query;
|
||||||
using GFramework.Core.Abstractions.Systems;
|
using GFramework.Core.Abstractions.Systems;
|
||||||
@ -11,7 +11,7 @@ using GFramework.Core.Architectures;
|
|||||||
using GFramework.Core.Command;
|
using GFramework.Core.Command;
|
||||||
using GFramework.Core.Environment;
|
using GFramework.Core.Environment;
|
||||||
using GFramework.Core.Events;
|
using GFramework.Core.Events;
|
||||||
using GFramework.Core.IoC;
|
using GFramework.Core.Ioc;
|
||||||
using GFramework.Core.Query;
|
using GFramework.Core.Query;
|
||||||
using Mediator;
|
using Mediator;
|
||||||
using ICommand = GFramework.Core.Abstractions.Command.ICommand;
|
using ICommand = GFramework.Core.Abstractions.Command.ICommand;
|
||||||
|
|||||||
@ -3,7 +3,7 @@ using GFramework.Core.Abstractions.Bases;
|
|||||||
using GFramework.Core.Abstractions.Model;
|
using GFramework.Core.Abstractions.Model;
|
||||||
using GFramework.Core.Abstractions.Systems;
|
using GFramework.Core.Abstractions.Systems;
|
||||||
using GFramework.Core.Abstractions.Utility;
|
using GFramework.Core.Abstractions.Utility;
|
||||||
using GFramework.Core.IoC;
|
using GFramework.Core.Ioc;
|
||||||
using GFramework.Core.Logging;
|
using GFramework.Core.Logging;
|
||||||
using GFramework.Core.Model;
|
using GFramework.Core.Model;
|
||||||
|
|
||||||
|
|||||||
@ -1,11 +1,11 @@
|
|||||||
using GFramework.Core.Abstractions.Command;
|
using GFramework.Core.Abstractions.Command;
|
||||||
using GFramework.Core.Abstractions.CQRS.Command;
|
using GFramework.Core.Abstractions.Cqrs.Command;
|
||||||
using GFramework.Core.Abstractions.Rule;
|
using GFramework.Core.Abstractions.Rule;
|
||||||
using GFramework.Core.Architectures;
|
using GFramework.Core.Architectures;
|
||||||
using GFramework.Core.Command;
|
using GFramework.Core.Command;
|
||||||
using GFramework.Core.Environment;
|
using GFramework.Core.Environment;
|
||||||
using GFramework.Core.Events;
|
using GFramework.Core.Events;
|
||||||
using GFramework.Core.IoC;
|
using GFramework.Core.Ioc;
|
||||||
using GFramework.Core.Query;
|
using GFramework.Core.Query;
|
||||||
|
|
||||||
namespace GFramework.Core.Tests.Command;
|
namespace GFramework.Core.Tests.Command;
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
using GFramework.Core.Abstractions.CQRS.Command;
|
using GFramework.Core.Abstractions.Cqrs.Command;
|
||||||
using GFramework.Core.Command;
|
using GFramework.Core.Command;
|
||||||
using NUnit.Framework;
|
|
||||||
|
|
||||||
namespace GFramework.Core.Tests.Command;
|
namespace GFramework.Core.Tests.Command;
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,7 @@
|
|||||||
using GFramework.Core.IoC;
|
using GFramework.Core.Ioc;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using NUnit.Framework;
|
|
||||||
|
|
||||||
namespace GFramework.Core.Tests.IoC;
|
namespace GFramework.Core.Tests.Ioc;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 测试 IoC 容器生命周期功能
|
/// 测试 IoC 容器生命周期功能
|
||||||
@ -205,4 +204,4 @@ public class IocContainerLifetimeTests
|
|||||||
scope2.Dispose();
|
scope2.Dispose();
|
||||||
scope3.Dispose();
|
scope3.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,10 +1,10 @@
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using GFramework.Core.Abstractions.Bases;
|
using GFramework.Core.Abstractions.Bases;
|
||||||
using GFramework.Core.IoC;
|
using GFramework.Core.Ioc;
|
||||||
using GFramework.Core.Logging;
|
using GFramework.Core.Logging;
|
||||||
using GFramework.Core.Tests.Systems;
|
using GFramework.Core.Tests.Systems;
|
||||||
|
|
||||||
namespace GFramework.Core.Tests.IoC;
|
namespace GFramework.Core.Tests.Ioc;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 测试 IoC 容器功能的单元测试类
|
/// 测试 IoC 容器功能的单元测试类
|
||||||
@ -1,7 +1,7 @@
|
|||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using GFramework.Core.Architectures;
|
using GFramework.Core.Architectures;
|
||||||
using GFramework.Core.IoC;
|
using GFramework.Core.Ioc;
|
||||||
using GFramework.Core.Logging;
|
using GFramework.Core.Logging;
|
||||||
using Mediator;
|
using Mediator;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
|||||||
@ -3,7 +3,7 @@ using System.Reflection;
|
|||||||
using GFramework.Core.Abstractions.Architecture;
|
using GFramework.Core.Abstractions.Architecture;
|
||||||
using GFramework.Core.Architectures;
|
using GFramework.Core.Architectures;
|
||||||
using GFramework.Core.Command;
|
using GFramework.Core.Command;
|
||||||
using GFramework.Core.IoC;
|
using GFramework.Core.Ioc;
|
||||||
using GFramework.Core.Logging;
|
using GFramework.Core.Logging;
|
||||||
using Mediator;
|
using Mediator;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
|||||||
@ -7,7 +7,7 @@ using GFramework.Core.Architectures;
|
|||||||
using GFramework.Core.Command;
|
using GFramework.Core.Command;
|
||||||
using GFramework.Core.Environment;
|
using GFramework.Core.Environment;
|
||||||
using GFramework.Core.Events;
|
using GFramework.Core.Events;
|
||||||
using GFramework.Core.IoC;
|
using GFramework.Core.Ioc;
|
||||||
using GFramework.Core.Logging;
|
using GFramework.Core.Logging;
|
||||||
using GFramework.Core.Query;
|
using GFramework.Core.Query;
|
||||||
using Mediator;
|
using Mediator;
|
||||||
|
|||||||
@ -1,11 +1,11 @@
|
|||||||
using GFramework.Core.Abstractions.CQRS.Query;
|
using GFramework.Core.Abstractions.Cqrs.Query;
|
||||||
using GFramework.Core.Abstractions.Query;
|
using GFramework.Core.Abstractions.Query;
|
||||||
using GFramework.Core.Abstractions.Rule;
|
using GFramework.Core.Abstractions.Rule;
|
||||||
using GFramework.Core.Architectures;
|
using GFramework.Core.Architectures;
|
||||||
using GFramework.Core.Command;
|
using GFramework.Core.Command;
|
||||||
using GFramework.Core.Environment;
|
using GFramework.Core.Environment;
|
||||||
using GFramework.Core.Events;
|
using GFramework.Core.Events;
|
||||||
using GFramework.Core.IoC;
|
using GFramework.Core.Ioc;
|
||||||
using GFramework.Core.Query;
|
using GFramework.Core.Query;
|
||||||
|
|
||||||
namespace GFramework.Core.Tests.Query;
|
namespace GFramework.Core.Tests.Query;
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
using GFramework.Core.Abstractions.CQRS.Query;
|
using GFramework.Core.Abstractions.Cqrs.Query;
|
||||||
using GFramework.Core.Query;
|
using GFramework.Core.Query;
|
||||||
using NUnit.Framework;
|
|
||||||
|
|
||||||
namespace GFramework.Core.Tests.Query;
|
namespace GFramework.Core.Tests.Query;
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
using GFramework.Core.Abstractions.CQRS.Query;
|
using GFramework.Core.Abstractions.Cqrs.Query;
|
||||||
using GFramework.Core.Query;
|
using GFramework.Core.Query;
|
||||||
using NUnit.Framework;
|
|
||||||
|
|
||||||
namespace GFramework.Core.Tests.Query;
|
namespace GFramework.Core.Tests.Query;
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@ using GFramework.Core.Abstractions.Environment;
|
|||||||
using GFramework.Core.Abstractions.Rule;
|
using GFramework.Core.Abstractions.Rule;
|
||||||
using GFramework.Core.Architectures;
|
using GFramework.Core.Architectures;
|
||||||
using GFramework.Core.Extensions;
|
using GFramework.Core.Extensions;
|
||||||
using GFramework.Core.IoC;
|
using GFramework.Core.Ioc;
|
||||||
using GFramework.Core.Rule;
|
using GFramework.Core.Rule;
|
||||||
|
|
||||||
namespace GFramework.Core.Tests.Rule;
|
namespace GFramework.Core.Tests.Rule;
|
||||||
|
|||||||
@ -3,7 +3,7 @@ using GFramework.Core.Abstractions.Rule;
|
|||||||
using GFramework.Core.Architectures;
|
using GFramework.Core.Architectures;
|
||||||
using GFramework.Core.Events;
|
using GFramework.Core.Events;
|
||||||
using GFramework.Core.Extensions;
|
using GFramework.Core.Extensions;
|
||||||
using GFramework.Core.IoC;
|
using GFramework.Core.Ioc;
|
||||||
using GFramework.Core.Rule;
|
using GFramework.Core.Rule;
|
||||||
|
|
||||||
namespace GFramework.Core.Tests.Rule;
|
namespace GFramework.Core.Tests.Rule;
|
||||||
|
|||||||
@ -6,7 +6,7 @@ using GFramework.Core.Abstractions.Systems;
|
|||||||
using GFramework.Core.Abstractions.Utility;
|
using GFramework.Core.Abstractions.Utility;
|
||||||
using GFramework.Core.Architectures;
|
using GFramework.Core.Architectures;
|
||||||
using GFramework.Core.Extensions;
|
using GFramework.Core.Extensions;
|
||||||
using GFramework.Core.IoC;
|
using GFramework.Core.Ioc;
|
||||||
using GFramework.Core.Rule;
|
using GFramework.Core.Rule;
|
||||||
|
|
||||||
namespace GFramework.Core.Tests.Rule;
|
namespace GFramework.Core.Tests.Rule;
|
||||||
|
|||||||
@ -6,7 +6,7 @@ using GFramework.Core.Architectures;
|
|||||||
using GFramework.Core.Command;
|
using GFramework.Core.Command;
|
||||||
using GFramework.Core.Environment;
|
using GFramework.Core.Environment;
|
||||||
using GFramework.Core.Events;
|
using GFramework.Core.Events;
|
||||||
using GFramework.Core.IoC;
|
using GFramework.Core.Ioc;
|
||||||
using GFramework.Core.Logging;
|
using GFramework.Core.Logging;
|
||||||
using GFramework.Core.Query;
|
using GFramework.Core.Query;
|
||||||
using GFramework.Core.State;
|
using GFramework.Core.State;
|
||||||
|
|||||||
@ -5,7 +5,7 @@ using GFramework.Core.Architectures;
|
|||||||
using GFramework.Core.Command;
|
using GFramework.Core.Command;
|
||||||
using GFramework.Core.Environment;
|
using GFramework.Core.Environment;
|
||||||
using GFramework.Core.Events;
|
using GFramework.Core.Events;
|
||||||
using GFramework.Core.IoC;
|
using GFramework.Core.Ioc;
|
||||||
using GFramework.Core.Query;
|
using GFramework.Core.Query;
|
||||||
using GFramework.Core.Utility;
|
using GFramework.Core.Utility;
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
using GFramework.Core.Abstractions.Architecture;
|
using GFramework.Core.Abstractions.Architecture;
|
||||||
using GFramework.Core.Abstractions.Enums;
|
using GFramework.Core.Abstractions.Enums;
|
||||||
using GFramework.Core.Abstractions.Environment;
|
using GFramework.Core.Abstractions.Environment;
|
||||||
using GFramework.Core.Abstractions.IoC;
|
using GFramework.Core.Abstractions.Ioc;
|
||||||
using GFramework.Core.Abstractions.Lifecycle;
|
using GFramework.Core.Abstractions.Lifecycle;
|
||||||
using GFramework.Core.Abstractions.Logging;
|
using GFramework.Core.Abstractions.Logging;
|
||||||
using GFramework.Core.Abstractions.Model;
|
using GFramework.Core.Abstractions.Model;
|
||||||
|
|||||||
@ -3,7 +3,7 @@ using GFramework.Core.Abstractions.Architecture;
|
|||||||
using GFramework.Core.Abstractions.Command;
|
using GFramework.Core.Abstractions.Command;
|
||||||
using GFramework.Core.Abstractions.Environment;
|
using GFramework.Core.Abstractions.Environment;
|
||||||
using GFramework.Core.Abstractions.Events;
|
using GFramework.Core.Abstractions.Events;
|
||||||
using GFramework.Core.Abstractions.IoC;
|
using GFramework.Core.Abstractions.Ioc;
|
||||||
using GFramework.Core.Abstractions.Model;
|
using GFramework.Core.Abstractions.Model;
|
||||||
using GFramework.Core.Abstractions.Query;
|
using GFramework.Core.Abstractions.Query;
|
||||||
using GFramework.Core.Abstractions.Systems;
|
using GFramework.Core.Abstractions.Systems;
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
using GFramework.Core.Abstractions.Architecture;
|
using GFramework.Core.Abstractions.Architecture;
|
||||||
using GFramework.Core.Abstractions.Command;
|
using GFramework.Core.Abstractions.Command;
|
||||||
using GFramework.Core.Abstractions.Events;
|
using GFramework.Core.Abstractions.Events;
|
||||||
using GFramework.Core.Abstractions.IoC;
|
using GFramework.Core.Abstractions.Ioc;
|
||||||
using GFramework.Core.Abstractions.Query;
|
using GFramework.Core.Abstractions.Query;
|
||||||
using GFramework.Core.IoC;
|
using GFramework.Core.Ioc;
|
||||||
using GFramework.Core.Services;
|
using GFramework.Core.Services;
|
||||||
|
|
||||||
namespace GFramework.Core.Architectures;
|
namespace GFramework.Core.Architectures;
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
using GFramework.Core.Abstractions.Command;
|
using GFramework.Core.Abstractions.Command;
|
||||||
using GFramework.Core.Abstractions.CQRS.Command;
|
using GFramework.Core.Abstractions.Cqrs.Command;
|
||||||
using GFramework.Core.Rule;
|
using GFramework.Core.Rule;
|
||||||
|
|
||||||
namespace GFramework.Core.Command;
|
namespace GFramework.Core.Command;
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
using GFramework.Core.Abstractions.Command;
|
using GFramework.Core.Abstractions.Command;
|
||||||
using GFramework.Core.Abstractions.CQRS.Command;
|
using GFramework.Core.Abstractions.Cqrs.Command;
|
||||||
using GFramework.Core.Rule;
|
using GFramework.Core.Rule;
|
||||||
|
|
||||||
namespace GFramework.Core.Command;
|
namespace GFramework.Core.Command;
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
using GFramework.Core.Abstractions.Command;
|
using GFramework.Core.Abstractions.Command;
|
||||||
using GFramework.Core.Abstractions.CQRS.Command;
|
using GFramework.Core.Abstractions.Cqrs.Command;
|
||||||
using GFramework.Core.Rule;
|
using GFramework.Core.Rule;
|
||||||
|
|
||||||
namespace GFramework.Core.Command;
|
namespace GFramework.Core.Command;
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
using GFramework.Core.Abstractions.Command;
|
using GFramework.Core.Abstractions.Command;
|
||||||
using GFramework.Core.Abstractions.CQRS.Command;
|
using GFramework.Core.Abstractions.Cqrs.Command;
|
||||||
using GFramework.Core.Rule;
|
using GFramework.Core.Rule;
|
||||||
|
|
||||||
namespace GFramework.Core.Command;
|
namespace GFramework.Core.Command;
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
using GFramework.Core.Abstractions.CQRS.Command;
|
using GFramework.Core.Abstractions.Cqrs.Command;
|
||||||
|
|
||||||
namespace GFramework.Core.Command;
|
namespace GFramework.Core.Command;
|
||||||
|
|
||||||
|
|||||||
@ -16,7 +16,7 @@ using GFramework.Core.Abstractions.Logging;
|
|||||||
using GFramework.Core.Logging;
|
using GFramework.Core.Logging;
|
||||||
using Mediator;
|
using Mediator;
|
||||||
|
|
||||||
namespace GFramework.Core.CQRS.Behaviors;
|
namespace GFramework.Core.Cqrs.Behaviors;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 日志记录行为类,用于在CQRS管道中记录请求处理的日志信息
|
/// 日志记录行为类,用于在CQRS管道中记录请求处理的日志信息
|
||||||
@ -16,7 +16,7 @@ using GFramework.Core.Abstractions.Logging;
|
|||||||
using GFramework.Core.Logging;
|
using GFramework.Core.Logging;
|
||||||
using Mediator;
|
using Mediator;
|
||||||
|
|
||||||
namespace GFramework.Core.CQRS.Behaviors;
|
namespace GFramework.Core.Cqrs.Behaviors;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 性能监控行为类,用于监控CQRS请求的执行时间
|
/// 性能监控行为类,用于监控CQRS请求的执行时间
|
||||||
@ -14,7 +14,7 @@
|
|||||||
using GFramework.Core.Rule;
|
using GFramework.Core.Rule;
|
||||||
using Mediator;
|
using Mediator;
|
||||||
|
|
||||||
namespace GFramework.Core.CQRS.Command;
|
namespace GFramework.Core.Cqrs.Command;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 抽象命令处理器基类
|
/// 抽象命令处理器基类
|
||||||
@ -14,7 +14,7 @@
|
|||||||
using GFramework.Core.Rule;
|
using GFramework.Core.Rule;
|
||||||
using Mediator;
|
using Mediator;
|
||||||
|
|
||||||
namespace GFramework.Core.CQRS.Command;
|
namespace GFramework.Core.Cqrs.Command;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 抽象流式命令处理器基类
|
/// 抽象流式命令处理器基类
|
||||||
@ -11,10 +11,10 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
using GFramework.Core.Abstractions.CQRS.Command;
|
using GFramework.Core.Abstractions.Cqrs.Command;
|
||||||
using Mediator;
|
using Mediator;
|
||||||
|
|
||||||
namespace GFramework.Core.CQRS.Command;
|
namespace GFramework.Core.Cqrs.Command;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 表示一个基础命令类,用于处理带有输入和响应的命令模式实现。
|
/// 表示一个基础命令类,用于处理带有输入和响应的命令模式实现。
|
||||||
@ -14,7 +14,7 @@
|
|||||||
using GFramework.Core.Rule;
|
using GFramework.Core.Rule;
|
||||||
using Mediator;
|
using Mediator;
|
||||||
|
|
||||||
namespace GFramework.Core.CQRS.Notification;
|
namespace GFramework.Core.Cqrs.Notification;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 抽象通知处理器基类
|
/// 抽象通知处理器基类
|
||||||
@ -11,10 +11,10 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
using GFramework.Core.Abstractions.CQRS.Notification;
|
using GFramework.Core.Abstractions.Cqrs.Notification;
|
||||||
using Mediator;
|
using Mediator;
|
||||||
|
|
||||||
namespace GFramework.Core.CQRS.Notification;
|
namespace GFramework.Core.Cqrs.Notification;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 表示一个基础通知类,用于处理带有输入的通知模式实现。
|
/// 表示一个基础通知类,用于处理带有输入的通知模式实现。
|
||||||
@ -14,7 +14,7 @@
|
|||||||
using GFramework.Core.Rule;
|
using GFramework.Core.Rule;
|
||||||
using Mediator;
|
using Mediator;
|
||||||
|
|
||||||
namespace GFramework.Core.CQRS.Query;
|
namespace GFramework.Core.Cqrs.Query;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 抽象查询处理器基类
|
/// 抽象查询处理器基类
|
||||||
@ -14,7 +14,7 @@
|
|||||||
using GFramework.Core.Rule;
|
using GFramework.Core.Rule;
|
||||||
using Mediator;
|
using Mediator;
|
||||||
|
|
||||||
namespace GFramework.Core.CQRS.Query;
|
namespace GFramework.Core.Cqrs.Query;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 抽象流式查询处理器基类
|
/// 抽象流式查询处理器基类
|
||||||
@ -11,10 +11,10 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
using GFramework.Core.Abstractions.CQRS.Query;
|
using GFramework.Core.Abstractions.Cqrs.Query;
|
||||||
using Mediator;
|
using Mediator;
|
||||||
|
|
||||||
namespace GFramework.Core.CQRS.Query;
|
namespace GFramework.Core.Cqrs.Query;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 表示一个基础查询类,用于处理带有输入和响应的查询模式实现。
|
/// 表示一个基础查询类,用于处理带有输入和响应的查询模式实现。
|
||||||
@ -14,7 +14,7 @@
|
|||||||
using GFramework.Core.Rule;
|
using GFramework.Core.Rule;
|
||||||
using Mediator;
|
using Mediator;
|
||||||
|
|
||||||
namespace GFramework.Core.CQRS.Request;
|
namespace GFramework.Core.Cqrs.Request;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 抽象请求处理器基类,用于处理不返回具体响应的请求
|
/// 抽象请求处理器基类,用于处理不返回具体响应的请求
|
||||||
@ -14,7 +14,7 @@
|
|||||||
using GFramework.Core.Rule;
|
using GFramework.Core.Rule;
|
||||||
using Mediator;
|
using Mediator;
|
||||||
|
|
||||||
namespace GFramework.Core.CQRS.Request;
|
namespace GFramework.Core.Cqrs.Request;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 抽象流式请求处理器基类
|
/// 抽象流式请求处理器基类
|
||||||
@ -11,10 +11,10 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
using GFramework.Core.Abstractions.CQRS.Request;
|
using GFramework.Core.Abstractions.Cqrs.Request;
|
||||||
using Mediator;
|
using Mediator;
|
||||||
|
|
||||||
namespace GFramework.Core.CQRS.Request;
|
namespace GFramework.Core.Cqrs.Request;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 表示一个基础请求类,用于处理带有输入和响应的请求模式实现。
|
/// 表示一个基础请求类,用于处理带有输入和响应的请求模式实现。
|
||||||
@ -1,5 +1,5 @@
|
|||||||
using GFramework.Core.Abstractions.Bases;
|
using GFramework.Core.Abstractions.Bases;
|
||||||
using GFramework.Core.Abstractions.IoC;
|
using GFramework.Core.Abstractions.Ioc;
|
||||||
using GFramework.Core.Abstractions.Logging;
|
using GFramework.Core.Abstractions.Logging;
|
||||||
using GFramework.Core.Abstractions.Systems;
|
using GFramework.Core.Abstractions.Systems;
|
||||||
using GFramework.Core.Logging;
|
using GFramework.Core.Logging;
|
||||||
@ -7,7 +7,7 @@ using GFramework.Core.Rule;
|
|||||||
using Mediator;
|
using Mediator;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
|
||||||
namespace GFramework.Core.IoC;
|
namespace GFramework.Core.Ioc;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Microsoft.Extensions.DependencyInjection 适配器
|
/// Microsoft.Extensions.DependencyInjection 适配器
|
||||||
@ -1,4 +1,4 @@
|
|||||||
using GFramework.Core.Abstractions.CQRS.Query;
|
using GFramework.Core.Abstractions.Cqrs.Query;
|
||||||
using GFramework.Core.Abstractions.Query;
|
using GFramework.Core.Abstractions.Query;
|
||||||
using GFramework.Core.Rule;
|
using GFramework.Core.Rule;
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
using GFramework.Core.Abstractions.CQRS.Query;
|
using GFramework.Core.Abstractions.Cqrs.Query;
|
||||||
using GFramework.Core.Abstractions.Query;
|
using GFramework.Core.Abstractions.Query;
|
||||||
using GFramework.Core.Rule;
|
using GFramework.Core.Rule;
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
using GFramework.Core.Abstractions.CQRS.Query;
|
using GFramework.Core.Abstractions.Cqrs.Query;
|
||||||
|
|
||||||
namespace GFramework.Core.Query;
|
namespace GFramework.Core.Query;
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
using GFramework.Core.Abstractions.Architecture;
|
using GFramework.Core.Abstractions.Architecture;
|
||||||
using GFramework.Core.Abstractions.IoC;
|
using GFramework.Core.Abstractions.Ioc;
|
||||||
using GFramework.Core.Query;
|
using GFramework.Core.Query;
|
||||||
|
|
||||||
namespace GFramework.Core.Services.Modules;
|
namespace GFramework.Core.Services.Modules;
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
using GFramework.Core.Abstractions.Architecture;
|
using GFramework.Core.Abstractions.Architecture;
|
||||||
using GFramework.Core.Abstractions.IoC;
|
using GFramework.Core.Abstractions.Ioc;
|
||||||
using GFramework.Core.Command;
|
using GFramework.Core.Command;
|
||||||
|
|
||||||
namespace GFramework.Core.Services.Modules;
|
namespace GFramework.Core.Services.Modules;
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
using GFramework.Core.Abstractions.Architecture;
|
using GFramework.Core.Abstractions.Architecture;
|
||||||
using GFramework.Core.Abstractions.IoC;
|
using GFramework.Core.Abstractions.Ioc;
|
||||||
using GFramework.Core.Events;
|
using GFramework.Core.Events;
|
||||||
|
|
||||||
namespace GFramework.Core.Services.Modules;
|
namespace GFramework.Core.Services.Modules;
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
using GFramework.Core.Abstractions.Architecture;
|
using GFramework.Core.Abstractions.Architecture;
|
||||||
using GFramework.Core.Abstractions.IoC;
|
using GFramework.Core.Abstractions.Ioc;
|
||||||
using GFramework.Core.Query;
|
using GFramework.Core.Query;
|
||||||
|
|
||||||
namespace GFramework.Core.Services.Modules;
|
namespace GFramework.Core.Services.Modules;
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
using GFramework.Core.Abstractions.Architecture;
|
using GFramework.Core.Abstractions.Architecture;
|
||||||
using GFramework.Core.Abstractions.IoC;
|
using GFramework.Core.Abstractions.Ioc;
|
||||||
using GFramework.Core.Abstractions.Lifecycle;
|
using GFramework.Core.Abstractions.Lifecycle;
|
||||||
using GFramework.Core.Abstractions.Logging;
|
using GFramework.Core.Abstractions.Logging;
|
||||||
using GFramework.Core.Logging;
|
using GFramework.Core.Logging;
|
||||||
|
|||||||
@ -2,11 +2,11 @@ using System.Diagnostics.CodeAnalysis;
|
|||||||
using Arch.Core;
|
using Arch.Core;
|
||||||
using GFramework.Core.Abstractions.Rule;
|
using GFramework.Core.Abstractions.Rule;
|
||||||
using GFramework.Core.Architectures;
|
using GFramework.Core.Architectures;
|
||||||
using GFramework.Core.IoC;
|
using GFramework.Core.Ioc;
|
||||||
using GFramework.Ecs.Arch.Components;
|
using GFramework.Ecs.Arch.Components;
|
||||||
using GFramework.Ecs.Arch.Systems;
|
using GFramework.Ecs.Arch.Systems;
|
||||||
|
|
||||||
namespace GFramework.Ecs.Arch.Tests.ECS;
|
namespace GFramework.Ecs.Arch.Tests.Ecs;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ECS 高级功能测试类 - 使用 Arch 原生 API
|
/// ECS 高级功能测试类 - 使用 Arch 原生 API
|
||||||
|
|||||||
@ -2,11 +2,11 @@ using System.Diagnostics.CodeAnalysis;
|
|||||||
using Arch.Core;
|
using Arch.Core;
|
||||||
using GFramework.Core.Abstractions.Rule;
|
using GFramework.Core.Abstractions.Rule;
|
||||||
using GFramework.Core.Architectures;
|
using GFramework.Core.Architectures;
|
||||||
using GFramework.Core.IoC;
|
using GFramework.Core.Ioc;
|
||||||
using GFramework.Ecs.Arch.Components;
|
using GFramework.Ecs.Arch.Components;
|
||||||
using GFramework.Ecs.Arch.Systems;
|
using GFramework.Ecs.Arch.Systems;
|
||||||
|
|
||||||
namespace GFramework.Ecs.Arch.Tests.ECS;
|
namespace GFramework.Ecs.Arch.Tests.Ecs;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ECS 基础功能测试类 - 使用 Arch 原生 API
|
/// ECS 基础功能测试类 - 使用 Arch 原生 API
|
||||||
|
|||||||
@ -2,11 +2,11 @@ using System.Diagnostics.CodeAnalysis;
|
|||||||
using Arch.Core;
|
using Arch.Core;
|
||||||
using GFramework.Core.Abstractions.Rule;
|
using GFramework.Core.Abstractions.Rule;
|
||||||
using GFramework.Core.Architectures;
|
using GFramework.Core.Architectures;
|
||||||
using GFramework.Core.IoC;
|
using GFramework.Core.Ioc;
|
||||||
using GFramework.Ecs.Arch.Components;
|
using GFramework.Ecs.Arch.Components;
|
||||||
using GFramework.Ecs.Arch.Systems;
|
using GFramework.Ecs.Arch.Systems;
|
||||||
|
|
||||||
namespace GFramework.Ecs.Arch.Tests.ECS;
|
namespace GFramework.Ecs.Arch.Tests.Ecs;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ECS 集成测试类 - 使用 Arch 原生 API
|
/// ECS 集成测试类 - 使用 Arch 原生 API
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
using Arch.Core;
|
using Arch.Core;
|
||||||
using GFramework.Core.Abstractions.Architecture;
|
using GFramework.Core.Abstractions.Architecture;
|
||||||
using GFramework.Core.Architectures;
|
using GFramework.Core.Architectures;
|
||||||
using GFramework.Core.IoC;
|
using GFramework.Core.Ioc;
|
||||||
using GFramework.Ecs.Arch.Abstractions;
|
using GFramework.Ecs.Arch.Abstractions;
|
||||||
using GFramework.Ecs.Arch.Extensions;
|
using GFramework.Ecs.Arch.Extensions;
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
using Arch.Core;
|
using Arch.Core;
|
||||||
using GFramework.Core.Abstractions.IoC;
|
using GFramework.Core.Abstractions.Ioc;
|
||||||
|
|
||||||
namespace GFramework.Ecs.Arch;
|
namespace GFramework.Ecs.Arch;
|
||||||
|
|
||||||
|
|||||||
@ -36,7 +36,7 @@ public sealed class PriorityUsageAnalyzer : DiagnosticAnalyzer
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
var iocContainer = compilationContext.Compilation.GetTypeByMetadataName(
|
var iocContainer = compilationContext.Compilation.GetTypeByMetadataName(
|
||||||
"GFramework.Core.Abstractions.IoC.IIocContainer");
|
"GFramework.Core.Abstractions.Ioc.IIocContainer");
|
||||||
|
|
||||||
var architectureContext = compilationContext.Compilation.GetTypeByMetadataName(
|
var architectureContext = compilationContext.Compilation.GetTypeByMetadataName(
|
||||||
"GFramework.Core.Abstractions.Architecture.IArchitectureContext");
|
"GFramework.Core.Abstractions.Architecture.IArchitectureContext");
|
||||||
|
|||||||
142
scripts/validate-csharp-naming.sh
Normal file
142
scripts/validate-csharp-naming.sh
Normal file
@ -0,0 +1,142 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
if ! command -v git >/dev/null 2>&1; then
|
||||||
|
echo "git is required to enumerate tracked C# files." >&2
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! command -v python3 >/dev/null 2>&1; then
|
||||||
|
echo "python3 is required to validate C# naming conventions." >&2
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
|
||||||
|
repo_root="$(git rev-parse --show-toplevel)"
|
||||||
|
cd "$repo_root"
|
||||||
|
|
||||||
|
python3 - <<'PY'
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import re
|
||||||
|
import subprocess
|
||||||
|
import sys
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
ROOT = Path.cwd()
|
||||||
|
EXCLUDED_PREFIXES = (
|
||||||
|
"Godot/script_templates/",
|
||||||
|
)
|
||||||
|
|
||||||
|
NAMESPACE_PATTERN = re.compile(r"^\s*namespace\s+([A-Za-z][A-Za-z0-9_.]*)\s*(?:[;{]|$)")
|
||||||
|
SEGMENT_PATTERN = re.compile(r"^[A-Za-z][A-Za-z0-9]*$")
|
||||||
|
PASCAL_CASE_PATTERN = re.compile(
|
||||||
|
r"^(?:[A-Z](?=[A-Z][a-z0-9])|[A-Z]{2}(?=$|[A-Z][a-z0-9])|[A-Z][a-z0-9]+)+$"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def is_excluded(path: str) -> bool:
|
||||||
|
normalized = path.strip("./")
|
||||||
|
return any(
|
||||||
|
normalized == prefix.rstrip("/") or normalized.startswith(prefix)
|
||||||
|
for prefix in EXCLUDED_PREFIXES
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def validate_segment(segment: str) -> str | None:
|
||||||
|
if not SEGMENT_PATTERN.fullmatch(segment):
|
||||||
|
return "must start with a letter and contain only letters or digits"
|
||||||
|
|
||||||
|
if not segment[0].isupper():
|
||||||
|
return "must start with an uppercase letter"
|
||||||
|
|
||||||
|
if segment.isupper():
|
||||||
|
if len(segment) <= 2:
|
||||||
|
return None
|
||||||
|
return "acronyms longer than 2 letters must use PascalCase"
|
||||||
|
|
||||||
|
if not PASCAL_CASE_PATTERN.fullmatch(segment):
|
||||||
|
return "must use PascalCase; only 2-letter acronyms may stay fully uppercase"
|
||||||
|
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def tracked_csharp_files() -> list[str]:
|
||||||
|
result = subprocess.run(
|
||||||
|
["git", "ls-files", "--", "*.cs"],
|
||||||
|
check=True,
|
||||||
|
capture_output=True,
|
||||||
|
text=True,
|
||||||
|
)
|
||||||
|
return [
|
||||||
|
line
|
||||||
|
for line in result.stdout.splitlines()
|
||||||
|
if line and not is_excluded(line)
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
def read_text(path: Path) -> str:
|
||||||
|
try:
|
||||||
|
return path.read_text(encoding="utf-8-sig")
|
||||||
|
except UnicodeDecodeError:
|
||||||
|
return path.read_text(encoding="utf-8")
|
||||||
|
|
||||||
|
|
||||||
|
files = tracked_csharp_files()
|
||||||
|
namespace_violations: list[tuple[str, int, str, list[str]]] = []
|
||||||
|
directory_violations: list[tuple[str, str, str]] = []
|
||||||
|
seen_directories: set[str] = set()
|
||||||
|
|
||||||
|
for relative_file in files:
|
||||||
|
file_path = ROOT / relative_file
|
||||||
|
for line_number, line in enumerate(read_text(file_path).splitlines(), start=1):
|
||||||
|
match = NAMESPACE_PATTERN.match(line)
|
||||||
|
if not match:
|
||||||
|
continue
|
||||||
|
|
||||||
|
namespace = match.group(1)
|
||||||
|
segment_errors = []
|
||||||
|
for segment in namespace.split("."):
|
||||||
|
reason = validate_segment(segment)
|
||||||
|
if reason is not None:
|
||||||
|
segment_errors.append(f'{segment}: {reason}')
|
||||||
|
|
||||||
|
if segment_errors:
|
||||||
|
namespace_violations.append((relative_file, line_number, namespace, segment_errors))
|
||||||
|
|
||||||
|
parent = Path(relative_file).parent
|
||||||
|
while parent != Path("."):
|
||||||
|
relative_dir = parent.as_posix()
|
||||||
|
if relative_dir not in seen_directories:
|
||||||
|
seen_directories.add(relative_dir)
|
||||||
|
for raw_segment in relative_dir.split("/"):
|
||||||
|
segments = raw_segment.split(".")
|
||||||
|
for segment in segments:
|
||||||
|
reason = validate_segment(segment)
|
||||||
|
if reason is not None:
|
||||||
|
directory_violations.append((relative_dir, segment, reason))
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
continue
|
||||||
|
break
|
||||||
|
|
||||||
|
parent = parent.parent
|
||||||
|
|
||||||
|
if namespace_violations or directory_violations:
|
||||||
|
print("C# naming validation failed.")
|
||||||
|
|
||||||
|
if namespace_violations:
|
||||||
|
print("\nNamespace violations:")
|
||||||
|
for file_path, line_number, namespace, errors in namespace_violations:
|
||||||
|
print(f"- {file_path}:{line_number} -> {namespace}")
|
||||||
|
for error in errors:
|
||||||
|
print(f" * {error}")
|
||||||
|
|
||||||
|
if directory_violations:
|
||||||
|
print("\nDirectory violations:")
|
||||||
|
for directory_path, segment, reason in sorted(set(directory_violations)):
|
||||||
|
print(f'- {directory_path} -> "{segment}": {reason}')
|
||||||
|
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
print(f"C# naming validation passed for {len(files)} tracked C# files.")
|
||||||
|
PY
|
||||||
Loading…
x
Reference in New Issue
Block a user