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
Setting for target checks. Eg, ignoring detection in T_COMMENT
Use cases:
Detect string like WooCommerce, Github, etc
Detect #https?://(localhost|127.0.0.1)# regex
The text was updated successfully, but these errors were encountered:
ernilambar
changed the title
Feature suggestion: new sniff for detecting brand names or given string
Feature suggestion: new sniff for detecting brand name or text string
Dec 27, 2023
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 WordPress/WordPress-Coding-Standards#1945
T_COMMENT
Use cases:
WooCommerce
,Github
, etc#https?://(localhost|127.0.0.1)#
regexThe text was updated successfully, but these errors were encountered: