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

Warn on accessing undefined globals/names #7

Open
SquidDev opened this issue Feb 4, 2020 · 1 comment
Open

Warn on accessing undefined globals/names #7

SquidDev opened this issue Feb 4, 2020 · 1 comment
Labels
area-linters Issues relating to linters and code fixers enhancement New feature or request

Comments

@SquidDev
Copy link
Owner

SquidDev commented Feb 4, 2020

Now that #6 is merged, we have a decent way of determining what globals and modules are available in the current context. This should allow us to monitor global and require usages, and ensure they are consistent with what one might expect.

I'm probably envisaging two warnings here, though they can probably be done with the same linter:

  • Accessing unknown global: just check that we have a global (either documented within this unit or external) with this name.
  • Compatible usage: if we have such a global, ensure that our usage is compatible. For now, this can probably boil down to:
    • If this is a table, ensure we're using it as so and the key exists (if it's a string literal).
    • If this is a function, ensure we're passing in sufficient arguments.

However, it's not clear how to handle external names. We can definitely bake the standard library into illuaminate, but it might be nice to find a better way.

@SquidDev SquidDev added documentation Improvements or additions to documentation enhancement New feature or request labels Feb 4, 2020
SquidDev added a commit that referenced this issue Feb 22, 2020
@SquidDev SquidDev added area-linters Issues relating to linters and code fixers and removed documentation Improvements or additions to documentation labels Mar 18, 2020
@SquidDev
Copy link
Owner Author

SquidDev commented Apr 28, 2020

I've done some further work in b092e0e and 8cc5000. However, the two systems really need to be merged and allow defining arbitrarily complex globals.

Currently we don't warn that string.subs is invalid, as string is simply registered as a global, rather than anything more complex.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-linters Issues relating to linters and code fixers enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant