woocommerce-code-review
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseWooCommerce Code Review
WooCommerce代码审查
Review code changes against WooCommerce coding standards and conventions.
检查代码变更是否符合WooCommerce编码标准和规范。
Critical Violations to Flag
需要标记的严重违规项
Backend PHP Code
后端PHP代码
Consult the skill for detailed standards. Using these standards as guidance, flag these violations and other similar ones:
woocommerce-backend-devArchitecture & Structure:
- Standalone functions - Must use class methods (file-entities.md)
- Using for DI-managed classes - Classes in
newmust usesrc/(dependency-injection.md)$container->get() - Classes outside - Default location unless explicitly public (file-entities.md)
src/Internal/
Naming & Conventions:
- camelCase naming - Must use snake_case for methods/variables/hooks (code-entities.md)
- Yoda condition violations - Must follow WordPress Coding Standards (coding-conventions.md)
Documentation:
- Missing annotations - Required for public/protected methods and hooks (code-entities.md)
@since - Missing docblocks - Required for all hooks and methods (code-entities.md)
- Verbose docblocks - Keep concise, one line is ideal (code-entities.md)
Data Integrity:
- Missing validation - Must verify state before deletion/modification (data-integrity.md)
Testing:
- Using in tests - Must use
$instancevariable name (unit-tests.md)$sut - Missing - Required in test method docblocks (unit-tests.md)
@testdox - Test file naming - Must follow convention for vs
includes/(unit-tests.md)src/
参考技能获取详细标准。以这些标准为指导,标记以下违规项及其他类似问题:
woocommerce-backend-dev架构与结构:
- 独立函数 - 必须使用类方法(file-entities.md)
- 对DI管理的类使用-
new目录下的类必须使用src/(dependency-injection.md)$container->get() - 类位于目录外 - 除非明确声明为公共类,否则默认应放在该目录下(file-entities.md)
src/Internal/
命名与规范:
- 使用camelCase命名 - 方法/变量/钩子必须使用snake_case(code-entities.md)
- 违反Yoda条件 - 必须遵循WordPress编码标准(coding-conventions.md)
文档:
- 缺少注解 - 公共/受保护方法和钩子必须添加该注解(code-entities.md)
@since - 缺少文档块 - 所有钩子和方法都必须添加文档块(code-entities.md)
- 冗长的文档块 - 保持简洁,理想状态为一行(code-entities.md)
数据完整性:
- 缺少验证 - 在删除/修改前必须验证状态(data-integrity.md)
测试:
- 在测试中使用- 必须使用
$instance变量名(unit-tests.md)$sut - 缺少- 测试方法的文档块中必须添加该注解(unit-tests.md)
@testdox - 测试文件命名 - 必须遵循与
includes/目录的命名约定(unit-tests.md)src/
UI Text & Copy
UI文本与文案
Consult the skill. Flag:
woocommerce-copy-guidelines- Title Case in UI - Must use sentence case (sentence-case.md)
- Wrong: "Save Changes", "Order Details", "Payment Options"
- Correct: "Save changes", "Order details", "Payment options"
- Exceptions: Proper nouns (WooPayments), acronyms (API), brand names
参考技能。标记以下问题:
woocommerce-copy-guidelines- UI中使用标题大小写 - 必须使用句子大小写(sentence-case.md)
- 错误示例:"Save Changes", "Order Details", "Payment Options"
- 正确示例:"Save changes", "Order details", "Payment options"
- 例外情况:专有名词(如WooPayments)、首字母缩写(如API)、品牌名称
Review Approach
审查方法
- Scan for critical violations listed above
- Cite specific skill files when flagging issues
- Provide correct examples from the skill documentation
- Group related issues for clarity
- Be constructive - explain why the standard exists when relevant
- 扫描上述严重违规项
- 标记问题时引用具体的技能文件
- 从技能文档中提供正确示例
- 将相关问题分组以提升清晰度
- 保持建设性 - 必要时解释该标准存在的原因
Output Format
输出格式
For each violation found:
text
[Issue Type]: [Specific problem]
Location: [File path and line number]
Standard: [Link to relevant skill file]
Fix: [Brief explanation or example]对于每个发现的违规项:
text
[问题类型]: [具体问题]
位置: [文件路径和行号]
标准: [相关技能文件链接]
修复方案: [简要说明或示例]Notes
注意事项
- All detailed standards are in the ,
woocommerce-backend-dev, andwoocommerce-dev-cycleskillswoocommerce-copy-guidelines - Consult those skills for complete context and examples
- When in doubt, refer to the specific skill documentation linked above
- 所有详细标准都在、
woocommerce-backend-dev和woocommerce-dev-cycle技能中woocommerce-copy-guidelines - 查阅这些技能获取完整背景和示例
- 如有疑问,请参考上述链接的具体技能文档