godot-gdscript-toolkit
godot-gdscript-toolkit copied to clipboard
New Lint rule: prefer shorthand node paths
Name of rule open to be defined :)
I would like to get lint errors for
get_node("Area2D/CollisionShape2D")
get_node("Timer")
and it should be used like this
$Area2D/CollisionShape2D
$Timer
To me that idea sounds good, but I'm wondering if there are any potential corner-cases where this would be a false-positive... @Shinigami92 any ideas?
[...] but I'm wondering if there are any potential corner-cases where this would be a false-positive... @Shinigami92 any ideas?
Yes! I think it might not be possible if get_node is called on something else than self.
I'm currently in vacation, so will explore some more in detail later when I'm back
I've been thinking about it further and I think that check would be too pedantic. It would be a good candidate if gdlint would have remarks like in pylint, but it's not planned so IMO not worth implementing this one.