Rails/DynamicFindBy
false-positives on Gem::Specification.find_by_name
#4967
Labels
Rails/DynamicFindBy
false-positives on Gem::Specification.find_by_name
#4967
Gem::Specification.find_by_name
clearly looks likeActiveRecord
to this cop but isn't.False positives are inevitable and whitelist functionality has been explained before, but given this class is in rubygems itself it would feel prudent to add
Gem::Specification#find_by_name
andGem::Specification#find_by_path
to a default or even hardcoded whitelist inside the cop, as I cannot think of any scenario other than a namespace collision where detecting these as activerecord is expected behaviour.Expected behavior
No offences found.
Actual behavior
Rails/DynamicFindBy: Use 'find_by' instead of dynamic 'find_by_name'. (Rails/DynamicFindBy)
Steps to reproduce the problem
RuboCop version
The text was updated successfully, but these errors were encountered: