Automattic / Automattic/VIP-Coding-Standards
File inclusion - check for constant defined in the current file
- 主要言語
- PHP
- スター
- 261
- フォーク
- 44
- 平均マージ
- 19分
- マージ済み PR(30日)
- 1
説明
## What problem would the enhancement address for VIP?
The frequency with which "Warning: File inclusion using custom constant (`PREFIX_PATH`). Probably needs manual inspection (WordPressVIPMinimum.Files.IncludingFile.UsingCustomConstant)." shows up just below a line that matches the pattern is high.
Perhaps we can reduce this noise.
## Describe the solution you'd like
See if we can improve the sniff, to see if the constant has been defined in the current file, and if so, skip the violation.
## What code should be reported as a violation?
```php
require PREFIX_PATH_UNDEFINED_IN_THIS_FILE . '/...';
```
## What code should *not* be reported as a violation?
```php
define( 'PREFIX_PATH_DEFINED_IN_THIS_FILE', '...' );
...other code...
require PREFIX_PATH_DEFINED_IN_THIS_FILE . '/...';
```
コントリビューションガイド
調査の方向性
まず、WordPressVIPMinimum.Files.IncludingFile.UsingCustomConstant を出力する sniff を見つけ、ファイルインクルード式で定数をどのように検出しているかを確認します。未定義の定数の例と、同じファイル内で前に定義された定数についてのカバレッジを追加します。完了条件は、未定義のケースだけが報告されることです。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- php
- 領域
- tooling
- issue の種類
- 機能追加
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 45/100