Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Make suggestion when autoload resolves to true

オープン
#497 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
48/100
issue の種類
機能追加
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
php
領域
tooling

調査の方向性

add_option() と update_option() を扱う PHPCS sniff とテストを見つけ、省略された引数、リテラルの yes/no 値、ブール値がどのように分類されるかを調べる。完了の条件は、一覧にある yes/true/implied のケースでは警告が生成され、no/false のケースでは生成されず、警告から提供された autoloading ドキュメントを参照できること。

索引モデルが issue の本文から書いたものです。

説明

Standard: VIP-Go Type: Enhancement

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
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

Automattic/VIP-Coding-Standards のほかの issue

Automattic/VIP-Coding-Standards の issue をすべて見る

似ている issue

PHP の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。