mirror of
https://github.com/github/codeql.git
synced 2026-04-28 18:25:24 +02:00
Ruby: Test local data flow
This commit is contained in:
@@ -4,3 +4,4 @@
|
||||
| UseDetect.rb:8:9:8:34 | ...[...] | Replace this call and $@ with 'reverse_detect'. | UseDetect.rb:8:9:8:30 | call to select | 'select' call |
|
||||
| UseDetect.rb:9:9:9:36 | call to first | Replace this call and $@ with 'detect'. | UseDetect.rb:9:9:9:30 | call to filter | 'select' call |
|
||||
| UseDetect.rb:10:9:10:37 | call to last | Replace this call and $@ with 'reverse_detect'. | UseDetect.rb:10:9:10:32 | call to find_all | 'select' call |
|
||||
| UseDetect.rb:12:9:12:24 | call to first | Replace this call and $@ with 'detect'. | UseDetect.rb:11:22:11:43 | call to select | 'select' call |
|
||||
|
||||
@@ -8,9 +8,14 @@ class DetectTest
|
||||
[].select { |i| true }[-1]
|
||||
[].filter { |i| true }.first
|
||||
[].find_all { |i| true }.last
|
||||
selection1 = [].select { |i| true }
|
||||
selection1.first
|
||||
|
||||
# These are good
|
||||
[].select("").first
|
||||
[].select { |i| true }[1]
|
||||
[].select("").first # Selecting a string
|
||||
[].select { |i| true }[1] # Selecting the second element
|
||||
selection2 = [].select { |i| true }
|
||||
selection2.first # Selection used elsewhere
|
||||
selection3 = selection2
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user