Make suggestion when autoload resolves to true
还没有人认领这个 Issue。
评估
调研方向
定位处理 add_option() 和 update_option() 的 PHPCS sniff 及测试;检查省略的参数、字面量 yes/no 值和布尔值是如何分类的。完成标准是:列出的 yes/true/implied 情况会产生警告,no/false 情况不会产生警告,并且该警告可以引用所提供的 autoloading 文档。
由索引模型根据 Issue 内容生成。
描述
What problem would the enhancement address for VIP?
Options get marked as autoload=yes when being added, unless there is an explicit setting to no.
For VIP clients, we should flag when it is yes, to remind and encourage developers to consider whether it should be autoload=no, which can help with performance.
Describe the solution you'd like
PHPCS Warning when 'yes' or true is supplied or implied when calling add_option() or update_option().
What code should be reported as a violation?
add_option( 'my_option', 'my_value', '', 'yes' );
add_option( 'my_option', 'my_value', '', true ); // Can be 'yes' string or boolean.
add_option( 'my_option', 'my_value', '' );
add_option( 'my_option', 'my_value' );
add_option( 'my_option' );
update_option( 'my_option', 'my_value', 'yes' );
update_option( 'my_option', 'my_value', true ); // Can be 'yes' string or boolean.
What code should not be reported as a violation?
add_option( 'my_option', 'my_value', '', 'no' );
add_option( 'my_option', 'my_value', '', false );
update_option( 'my_option', 'my_value', 'no' );
update_option( 'my_option', 'my_value', false );
Additional context
Some items may indeed be valid to be autoloaded, so it's not an Error in all cases.
This may seem like a bit of noise for some cases, but I think it counts as a good reminder. We can link the error message to our public docs about autoloading.
- 主要语言
- PHP
- 星标
- 261
- 派生
- 44
- 平均合并
- 3 天 17 小时
- 30 天内合并 PR
- 9
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
Automattic/VIP-Coding-Standards 的其他 Issue
-
难度 3/5 1-2 天 新手友好度 48/100
-
Breaking Change Type: Maintenance
难度 4/5 3-5 天 新手友好度 35/100
Automattic/VIP-Coding-Standards#849 · 1 条评论 ·
-
难度 3/5 1-2 天 新手友好度 45/100
-
难度 3/5 1-2 天 新手友好度 48/100
-
Status: Awaiting feedback
难度 2/5 1-3 小时 新手友好度 45/100
Automattic/VIP-Coding-Standards#754 · 3 条评论 ·
查看 Automattic/VIP-Coding-Standards 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 60/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
ProfessionalWiki/NeoWiki#1675 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 88/100
-
难度 2/5 1-3 小时 新手友好度 70/100
-
WhatsApp link preview crawler is not detected as a bot可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
matomo-org/device-detector#8405 ·
维护者通常 1 天内回复