mirror of
https://github.com/github/codeql.git
synced 2026-05-05 21:55:19 +02:00
Ruby: Reduce FPs for rb/incomplete-hostname-regexp
Arguments in calls to `match[?]` should only be considered regular expression interpretations if the `match` refers to the standard library method, not a method in source code.
This commit is contained in:
@@ -122,7 +122,9 @@ class StdLibRegExpInterpretation extends RegExpInterpretation::Range {
|
||||
mce.getMethodName() = ["match", "match?"] and
|
||||
this = mce.getArgument(0) and
|
||||
// exclude https://ruby-doc.org/core-2.4.0/Regexp.html#method-i-match
|
||||
not mce.getReceiver() = RegExpTracking::trackRegexpType()
|
||||
not mce.getReceiver() = RegExpTracking::trackRegexpType() and
|
||||
// exclude non-stdlib methods
|
||||
not exists(mce.getATarget())
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user