LuaEcoSearch - fighting global namespace pollution
I wrote a script that looks for global symbols used in add-ons. It's far from perfect, yet its output might already prove useful, so here you are ;)
http://ge.tt/3zjp9QK2 luaEcoSearch.sh is a Unix shell script, it requires perl, luac5.1 (Lua 5.1 compiler) and optionally 7-zip. You give it a bunch of directories and/or zip files and it prints globals it finds to stdout. Code:
$ sh luaEcoSearch.sh SomeAddonFolder AnotherAddon.zip ... Sample output: Code:
cache/AddonProfiles+1416618983.zip The remaining lines begin with FLAGS: + marks a symbol that the add-on SETS ? marks a symbol that the add-on GETS The second column is the symbol name, and the third column (if present) is the location of the start of the function in which the symbol is SET (luac doesn't tell the line number of the actual assignment). If there is a + but no ? in front of a symbol, it may mean that it is unused, but not always. AddonProfiles_SwitchToProfile in the above sample is actually used from XML, which the script doesn't check. Like I said, it's far from perfect, and here is why - it only finds simple, unqualified accesses/assigments. For example, when run on this code: Lua Code:
The output would be: Code:
/tmp/foo/ |
Ah. It's great. :)
Typos and missing declaration happens very easy without a compiler warning you. What about passing the manifest file to get the list of Lua files? This way wrong paths can be found quicker. And an extra loop filling $(language) with all (unoffical) supported languages to find syntax errors in language files one normally does not use. (Already happend) The list was very useful. Thanks! |
Quote:
As for finding missing/misspelled files, here you go: bash Code:
|
Would love to see you filter out the reads (?) of the LUA system functions and ZOS API Functions.
|
To update the wiki I'm writing some kind of similar script (but in lua). I'll try to update it aswell next zos patches come.
|
And thanks! You found me two bugs in my current addon.
|
Quote:
|
Added a filtered list. Shouldn't contain read-only globals available ingame without add-ons (functions, tables, controls, enums).
|
Will there be a new luaEcoSearch.sh released that does the filter? The link is still to the old one.
|
This was kinda an afternoon fun demo, but if I return to it, I'll put it up on github with all the parts. I did the filtering with another script, which extracts a list of names from a dumper add-on (which will need to be included) and then essentially does grep -xf
|
Thanks again for another pre-reason bug found...
|
Updated dump as of 3 Sep 2015 http://ge.tt/3zjp9QK2/v/7
|
All times are GMT -6. The time now is 09:27 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI