-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
False negatives for BS1011 (same name as global function) #70
Comments
There was definitely a reason I created this rule, so I'm thinking it's just overreaching and applying to situations it was not intended. I need to create an exhaustive list of possible ways to override parent scope methods and narrow this checking to only the situations that apply. |
@georgejecook I ran a few tests, and here are the results:
sub main()
str = function(p)
return "override"
end function
print str(12345) 'prints "12345" (i.e. our local function is never used)
end sub
sub main()
str = 12345
print str ' prints "12345" (i.e. our local variable overrode the name)
end sub
sub main()
str = 6789
print str(12345) ' prints "12345" (i.e. our local variable did not override the callable global function)
end sub
sub main()
getHello = function()
return "override"
end function
print getHello() 'prints "hello" (i.e. our local variable is never used)
end sub
function getHello()
return "hello"
end function
sub main()
getHello = "override"
print getHello ' prints <Function: gethello> (i.e. local variable override does NOT work for same-scope-defined methods)
end sub
function getHello()
return "hello"
end function
Conclusion
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is false.
The text was updated successfully, but these errors were encountered: