SuperAPI AI 工具集

typo3-conformance

测试与质量

查看项目

更新于 10-15 21:10

技能介绍

用途:评估 TYPO3 扩展是否符合 TYPO3 编码标准、架构模式与最佳实践,适用于扩展质量检查、TER 上架准备、评分式符合性报告,以及向 v12/v13/v14 的现代化改造(v14.3 LTS 为默认/黄金标准)。仅覆盖扩展;站点/项目仓库(type: project + Compose)应使用 typo3-14-gold/tools/conformance 评分。测试、文档、OpenSSF 相关任务分别委派给 typo3-testing、typo3-docs、enterprise-readiness。

主要能力:工作流先读取 ext_emconf.php 与 composer.json 确认版本、类型与范围,随后执行 11 类检查:元数据(key、TYPO3 版本、类型);结构(composer.json、ext_emconf.php、Classes/、Configuration/、Resources/);编码(strict_types、PSR-12、PHP 8.4 显式可空、PHP 8.5 float-to-int);禁用项(不得使用 $GLOBALS、不得用 GeneralUtility::makeInstance() 获取服务);架构(构造器依赖注入、Services.yaml、PSR-14 事件含 try/catch、PSR-3 日志 LoggerAware+NullLogger、工厂回退);后端(ES6、Modal API、CSRF、v13+ 的 CSP);测试(PHPUnit、Playwright E2E、覆盖率 >70%);实践(DDEV、runTests.sh、CI/CD);TER(发布流程、上传注释);审计(PHPStan baseline、TCA searchFields、XLIFF、缓存 has()+get()、查询属性、多版本适配器);v14 就绪(无 ext_tables.php/HashService/魔法查找器、Fluid VH 严格、XLF 两空格缩进,详见 references/v14-deprecations.md)。修复后需重跑并记录分数变化。

使用方式:提供若干 grep 快速检查命令,例如 grep -rL 'strict_types' Classes/ --include='.php'、grep -rn '$GLOBALS' Classes/ --include='.php'、grep -rn 'GeneralUtility::makeInstance' Classes/ --include='.php'、grep -rn '->has(' Classes/ --include='.php'、grep -l 'strict_types' ext_emconf.php、grep -rn '(int)\s*$' Classes/ --include='.php'、grep -rn 'data-toggle|data-dismiss|data-ride' Resources/ --include='.html'、grep -rn 'HashService|GeneralUtility::hmac(|->findBy[A-Z]|->findOneBy[A-Z]|->countBy[A-Z]' Classes/ --include='*.php',以及 [ -f ext_tables.php ] && echo "WARN: ext_tables.php deprecated (#109438)"。

评分:基础分 0-100,由架构(20)+指南(20)+PHP(20)+测试(20)+实践(20)构成,卓越加分最多 22;严重问题无论分数一律阻断。区间:90+ 优秀(可生产/TER 就绪)、80-89 良好(小幅修复)、70-79 可接受(发布前修复)、50-69 需改进(较大工作量)、<50 严重(阻止部署)。

限制:仅针对扩展,不评估站点/项目仓库;具体命令输出与评分细节以实际仓库为准。参考资料见 references/ 下架构与代码、验证、多版本兼容、实践与后端等文档,assets/Build/ 提供 PHPStan、PHP-CS-Fixer、Rector、ESLint、Stylelint、TypoScript lint 模板。该技能基于 Netresearch DTT GmbH 的工作(原仓库 https://github.com/netresearch/typo3-conformance-skill,MIT / CC-BY-SA-4.0),由 webconsulting.at 适配。