yoastcs icon indicating copy to clipboard operation
yoastcs copied to clipboard

ValidHookName: make the `NotString` warning more actionable

Open jrfnl opened this issue 4 years ago • 2 comments

The ValidHookName sniff contains a warning when dynamic hook names are encountered to manually examine those for hook name length. The maximum word count is configurable, not fixed.

Hook name could not reliably be examined for maximum word count. Please verify this hook name manually. Found: %s

Note: this warning is at severity 3 and will not show by default so as to not be CI blocking. It will be shown only when the minimum severity for a run is explicitly lowered to 3 or lower.

When looking at this message, it is not directly actionable as it doesn't mention what the maximum word count is.

By the looks of it, the sniff can possibly also be improved further to throw this warning less often.

If the non-dynamic part of a dynamic hook name contains text which would already create a violation against the maximum word count, the TooLong or MaxExceeded warning/error should be thrown instead - in so far as this is determinable, of course.

jrfnl avatar Jun 16 '21 12:06 jrfnl

Let's do a check what the impact would be if this would become severity 5 and then discuss further.

jrfnl avatar Sep 22 '23 09:09 jrfnl

An initial improvement to the message is included in #335. The impact analysis of raising the severity to 5 still needs to be assessed.

jrfnl avatar Nov 04 '23 11:11 jrfnl