Skip to content
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

gdlint: false positive on duplicated-load when preloading scripts inside inner classes #254

Open
jamie-pate opened this issue Nov 27, 2023 · 1 comment
Labels
bug Something isn't working cherrypick:3.x linter
Milestone

Comments

@jamie-pate
Copy link

jamie-pate commented Nov 27, 2023

In gdscript 3.5 you must to preload a class inside an inner class to get access to the class as the inner class has no access to the outer class's constants.

Unfortunately this needs a # gdlint: ignore=duplicated-load directive each time since gdlint doesn't understand that this is not actually a duplicated-load

# gdlint: ignore=duplicated-load
const LoadedClass = preload("res://LoadedClass.gd")


class InnerClass:
    extends Reference

    # gdlint: ignore=duplicated-load
    const LoadedClass = preload("res://LoadedClass.gd")
        
    var _value: LoadedClass
    func _init(value: LoadedClass):
        _value = value

var value := InnerClass.new(LoadedClass.new())
@jamie-pate jamie-pate changed the title gdlint: duplicated-load when preloading scripts inside inner classes gdlint: false positive on duplicated-load when preloading scripts inside inner classes Nov 27, 2023
@Scony Scony added bug Something isn't working linter cherrypick:3.x labels Nov 27, 2023
@Scony
Copy link
Owner

Scony commented Nov 27, 2023

Yes, that would make sense to make the check per-class

@Scony Scony added this to the 4.x milestone Mar 21, 2024
@Scony Scony added this to Roadmap Mar 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cherrypick:3.x linter
Projects
Status: No status
Development

No branches or pull requests

2 participants