Closed ernilambar closed 10 months ago
Thank you for the suggestion, but I'm not inclined to accept this feature request.
To detect this, all tokens which can contain text should be examined. However, whether something should be flagged, or not, is highly dependent on the context. Think:
$array = [
'woocommerce' => 'array keys should not be flagged as changing those breaks other code',
];
// And what about callbacks ? Should not be flagged as function names have their own naming conventions.
array_map('github_callback', $array);
// But hey, we do want to flag this:
printf( 'sentence containing %s keyword', 'woocommerce');
// Now what about a comment containing github ?
// But we don't want to flag it in a URL: https://github.com/org/package/blob/master/woocommerce-interface.php
In other words, a "generic" sniff for such a feature would be a nightmare to maintain and support as code can be written in lots of different ways, so there will always be more exceptions to take into account and some codebases will want the exception, while others won't want it.
Is your feature request related to a problem?
This could be probably generalization of
WordPress.WP.CapitalPDangit
. Like we can use it for any brand name or string likeWooCommerce
,Github
, etcDescribe the solution you'd like
Inspired from https://github.com/WordPress/WordPress-Coding-Standards/issues/1945
T_COMMENT
Use cases:
WooCommerce
,Github
, etc#https?://(localhost|127.0.0.1)#
regex