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

Analyze unused or undefined table fields #39

Open
arichard4 opened this issue Nov 23, 2021 · 1 comment
Open

Analyze unused or undefined table fields #39

arichard4 opened this issue Nov 23, 2021 · 1 comment
Labels
enhancement New feature or request

Comments

@arichard4
Copy link

arichard4 commented Nov 23, 2021

local x = {}
x.y = 1 -- Unused
x.y = 2
x[1] = x.z -- x.z is undefined

I can do this, any comments on the idea?

@alerque
Copy link
Member

alerque commented Mar 25, 2022

This would be an interesting feature to have it it really worked, but I am skeptical whether it can be implemented robustly enough to be anything more than a giant pile of false positives. Tables get passed around in all sorts of ways (as modules), passed to different scopes, copied to new structures, accessed by meta-methods and raw accessors, serialized, the number of keys in a table can be relevant without direct access to a specific key, etc. Understanding when a field was really used or unused might be hard to implement.

@alerque alerque added the enhancement New feature or request label Mar 25, 2022
arichard4 added a commit to arichard4/luacheck that referenced this issue Apr 29, 2022
arichard4 added a commit to arichard4/luacheck that referenced this issue Apr 29, 2022
arichard4 added a commit to arichard4/luacheck that referenced this issue Apr 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

No branches or pull requests

2 participants