mirror of
https://gitea.invidious.io/iv-org/shard-ameba.git
synced 2024-08-15 00:53:29 +00:00
Avoid exponential recursion while finding variable references in scopes (#203)
* Avoid exponential recursion while finding variable references in scopes * Adjust source example in test
This commit is contained in:
parent
d28f9f756e
commit
51b0a07e81
5 changed files with 109 additions and 5 deletions
|
@ -1006,6 +1006,48 @@ module Ameba::Rule::Lint
|
|||
end
|
||||
end
|
||||
|
||||
it "does not report if variable is referenced and there is a deep level scope" do
|
||||
s = Source.new %(
|
||||
response = JSON.build do |json|
|
||||
json.object do
|
||||
json.object do
|
||||
json.object do
|
||||
json.object do
|
||||
json.object do
|
||||
json.object do
|
||||
json.object do
|
||||
json.object do
|
||||
json.object do
|
||||
json.object do
|
||||
json.object do
|
||||
json.object do
|
||||
json.object do
|
||||
json.object do
|
||||
json.object do
|
||||
anything
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
response = JSON.parse(response)
|
||||
response
|
||||
)
|
||||
subject.catch(s).should be_valid
|
||||
end
|
||||
|
||||
context "uninitialized" do
|
||||
it "reports if uninitialized assignment is not referenced at a top level" do
|
||||
s = Source.new %(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue