WordPress / WordPress/plugin-check
Implement missing textdomain argument sniff
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 362
- Forks
- 126
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 22
Description
The WordPress.WP.I18n.MissingArgDomain sniff currently flags when a translation function is missing the text domain argument. However, its current severity level means it might not receive appropriate attention from plugin developers.
Background
- When the domain argument is missing in WordPress translation functions, the function will default to using core translations
- This behavior works technically but is discouraged in plugin or theme
- In 99.9% of cases, this occurs because plugin authors are unaware they need to specify their text domain, not because they intentionally want to use core translations
Proposal
Increase the severity level of this sniff from its current level to 7 (as a blocker in PCP).
Suggested improvement provided from Plugins Team meeting
Compare plugin strings with a map of WordPress core strings to reduce false positives when checking for missing text domains.
For example:
echo esc_html__( 'Submit' ): // WARNING: This string exists in WP core.
echo esc_html__( 'Example plugin specific string' ): // ERROR: This string is not in core.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the WordPress.WP.I18n.MissingArgDomain sniff and its existing tests, then inspect how severity levels are configured. Determine whether the change should only raise severity to 7 or also compare strings against a WordPress core-string map; done means the intended cases are reported with the correct severity without the proposed false positives.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100