Similarly as the nice ProhibitGrepToGetFirstFoundElement, it would be nice to have a check that looks for use of grep to check if an element exists, i.e. in boolean context.
When found, it would advise to use List::Util::any() (or ::none() when inverted) instead, mainly for performance but arguably for semantic reasons, too.
Perhaps call it ProhibitGrepToCheckIfElementExists or ProhibitGrepInBooleanContext.
Similarly as the nice
ProhibitGrepToGetFirstFoundElement, it would be nice to have a check that looks for use ofgrepto check if an element exists, i.e. in boolean context.When found, it would advise to use
List::Util::any()(or::none()when inverted) instead, mainly for performance but arguably for semantic reasons, too.Perhaps call it
ProhibitGrepToCheckIfElementExistsorProhibitGrepInBooleanContext.