Enhanced datapack configuration validation#120
Merged
WhiteElephant-abc merged 1 commit intomainfrom Jan 24, 2026
Merged
Conversation
添加 pack_id 命名空间格式验证,并提供更全面的配置检查: - 新增 validate_pack_id 函数验证 Minecraft 命名空间 ID 格式 - 验证 version_type 必须是 'release', 'beta' 或 'alpha' - 验证 target_name 格式(如果提供) - 验证 game_versions 列表的有效性 - 验证 modrinth_project_id 格式(如果提供) 这些验证帮助在构建早期捕获配置错误,提高开发体验。
Closed
Member
|
/oc 审查此pr并提供完整报告 |
Contributor
Author
PR 评审:Enhanced datapack configuration validation本次评审针对 PR #114 中对数据包配置验证功能的增强。以下是对代码修改的详细分析和建议: ✅ 优点与亮点
🔍 潜在问题与改进建议
🧪 兼容性验证检查了所有现有数据包的
📋 建议的后续优化
🎯 总体评价这是一个高质量的增强,显著提升了数据包配置的健壮性。验证逻辑合理,错误信息清晰,保持了向后兼容性。建议 批准合并。 推荐的操作:
PR 代码质量良好,符合项目编码规范,为构建系统提供了重要的防御性检查机制。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

工作摘要
本次任务对 Bazel 构建系统的数据包配置验证功能进行了全面增强,主要实现了以下改进:
1. 新增 pack_id 命名空间格式验证
rule/datapack.bzl:209-262新增validate_pack_id()函数和_is_valid_pack_id()辅助函数2. 增强 complete_datapack_config 宏的配置检查
在
rule/datapack.bzl:618-650的complete_datapack_config宏中新增多项验证:version_type只能是"release"、"beta"或"alpha"target_name格式(如果提供),只允许字母、数字、下划线、连字符和点game_versions列表的有效性,检查每个版本是否在支持的版本列表中modrinth_project_id格式(如果提供),确保符合 Modrinth 平台规范3. 维护现有兼容性
stone-disappearance、auto-lucky-block等)的构建均不受影响4. 错误处理改进
fail()提供清晰的错误信息技术实现特点
本次增强显著提高了数据包配置的健壮性,帮助开发者在构建早期发现配置错误,减少因格式问题导致的构建失败,提升整体开发体验。
Closes #114
opencode session | github run