You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For a single file plugin with a text domain set, the WordPress.WP.I18n.TextDomainMismatch check relies on a plugin directory slug (non-existent in this context) and shows different results between the UI and CLI. It has been suggested that this check be bypassed for single-file plugins (hat tip @ernilambar).
To test this, I added the hello-dolly text domain to the hello.php plugin that ships with WP core (required to avoid an error with the WordPress.WP.I18n.MissingArgDomain check):
__( 'Quote from Hello Dolly song, by Jerry Herman:', 'hello-dolly' ),
Running PCP, the admin shows Mismatched text domain. Expected 'plugins' but got 'hello-dolly'.
whereas the CLI returns Mismatched text domain. Expected 'hello.php' but got 'hello-dolly'.
May be if we bail the runner in Abstract_PHP_CodeSniffer_Check if $this->get_args( $result ) is empty array. This way we can pass args based on single file plugin or multiple file plugin.
For check extended from Abstract_PHP_CodeSniffer_Check, only get_args() method is exposed. I could not find place to add is_single_file_plugin() conditional for such check like I18n_Usage_Check.
Trying to solve this in I18n_Usage_Check is the wrong place. The big issue is that admin & CLI expect a different plugin slug. And both of them are incorrect.
For a single file plugin with a text domain set, the
WordPress.WP.I18n.TextDomainMismatch
check relies on a plugin directory slug (non-existent in this context) and shows different results between the UI and CLI. It has been suggested that this check be bypassed for single-file plugins (hat tip @ernilambar).To test this, I added the
hello-dolly
text domain to thehello.php
plugin that ships with WP core (required to avoid an error with theWordPress.WP.I18n.MissingArgDomain
check):Running PCP, the admin shows
Mismatched text domain. Expected 'plugins' but got 'hello-dolly'.
whereas the CLI returns
Mismatched text domain. Expected 'hello.php' but got 'hello-dolly'.
Originally reported at #713 (comment).
The text was updated successfully, but these errors were encountered: