-
-
Notifications
You must be signed in to change notification settings - Fork 495
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow translators:
comments.
#562
Allow translators:
comments.
#562
Conversation
@jrfnl I'm surprised that PHPCS is reporting an error for this since such translators comments aren't in phpdoc block comments ( |
That seems to me a discussion to take upstream. If and when upstream would decide to change this, we can always reverse the exclusion. |
@jrfnl I cannot reproduce the issue, however. If I do: phpcs --standard=WordPress-Docs --sniffs=Generic.Commenting.DocComment It only complains about the second instance, not the first: /* translators: 1: the id argument, 2: sidebar name, 3: recommended id value */
_doing_it_wrong( __FUNCTION__, sprintf( __( 'No %1$s was set in the arguments array for the "%2$s" sidebar. Defaulting to "%3$s". Manually set the %1$s to "%3$s" to silence this notice and keep existing sidebar content.' ), '<code>id</code>', $sidebar['name'], $sidebar['id'] ), '4.2.0' );
/** translators: 1: the id argument, 2: sidebar name, 3: recommended id value */
_doing_it_wrong( __FUNCTION__, sprintf( __( 'No %1$s was set in the arguments array for the "%2$s" sidebar. Defaulting to "%3$s". Manually set the %1$s to "%3$s" to silence this notice and keep existing sidebar content.' ), '<code>id</code>', $sidebar['name'], $sidebar['id'] ), '4.2.0' ); |
@westonruter You can see the issue with /* translators: %s is number of seconds. */ But yes, there is something funky going on with the sniff as it seems to only pick up the second instance. |
I can't reproduce the issue on that line either. Try this: $ curl -sG https://raw.githubusercontent.com/tollmanz/debug-bar-cron/2f4173b043c1b04b64ad199d768c4294b9f75288/class-debug-bar-cron.php | phpcs --standard=WordPress-Docs -v --sniffs=Generic.Commenting.DocComment
Registering sniffs in the WordPress Docs standard... DONE (1 sniffs registered)
Creating file list... DONE (0 files in queue)
Processing STDIN [PHP => 4436 tokens in 638 lines]... DONE in 82ms (0 errors, 0 warnings)
Time: 961ms; Memory: 9Mb |
Actually, the error being reported is a different issue than
|
A bugfix upstream now causes `Doc comment short description must start with a capital letter` errors for `/* translators: ... */` comments. Excluding the offending rule to continue to allow these type of comments.
Even weirder as I'm pretty sure I copied & pasted it from my locally run log which would indicate two different sniffs being potentially buggy for the translators comments.... or did I ? Where's my head ? Anyone seen it ? If you find it, give me a shout will ya ? In the mean time: adjusted the PR to address the right sniff. |
5223ed4
to
0eabc71
Compare
A bugfix upstream now causes
Doc comment short description must start with a capital letter
errors for/* translators: ... */
comments.Excluding the offending rule to continue to allow these type of comments.
Ref: squizlabs/PHP_CodeSniffer#855