godot-gdscript-toolkit icon indicating copy to clipboard operation
godot-gdscript-toolkit copied to clipboard

`gdlint`: Calling `super._ready()` raises error

Open yeslayla opened this issue 1 year ago • 3 comments
trafficstars

Here's an example of the use-case implementation

class_name Parent
extends Node

func _ready() -> void:
    print("Hello from Parent")
extends Parent

func _ready() -> void:
    super._ready() # Private method "_ready" has been called (private-method-call)
    print("Hello from Child")

I was looking around to see if calling super._ready() or super._process(delta) was a bad practice, but from what I've read it seems to be a relatively common way of doing things. So ideally I think calling private methods on super should be fine.

Similar to #283

yeslayla avatar Jun 23 '24 18:06 yeslayla

I think this is a more general problem with this rule. In gdscript the styleguide says you should start the name of virtual methods with an _, even if the methods are intended to be public. Using the same character for two different meanings makes it pretty difficult to handle with a linter/formatter.

Maybe it is worth removing this rule from the linter?

Jack-023 avatar Jul 31 '24 07:07 Jack-023

I think this is a more general problem with this rule. In gdscript the styleguide says you should start the name of virtual methods with an _, even if the methods are intended to be public. Using the same character for two different meanings makes it pretty difficult to handle with a linter/formatter.

Maybe it is worth removing this rule from the linter?

Yes, I'll probably remove that rule as it makes very little sense in case of GDScript

Scony avatar Jul 31 '24 19:07 Scony

I made a proposal to update the style guide. Not sure if it will go anywhere yet but I figured it was worth sharing here as it is directly related to this issue.

Jack-023 avatar Aug 05 '24 05:08 Jack-023