Module:Sandbox/Aidan9382/CodeAnalysis/doc
Appearance
![]() | This is a documentation subpage for Module:Sandbox/Aidan9382/CodeAnalysis. It may contain usage information, categories and other content that is not part of the original module page. |
Usage
This module is to be required and used from the Debug console, like the following: require("Module:Sandbox/Aidan9382/CodeAnalysis").run()
. The module will then note any unused locals or any global references.
The function can be provided an argument to specify a target page other than the current page. Valid inputs are the name of the wanted page as a string, or the mw.title object of the wanted page.
The code of this is mostly lifted from https://github.com/9382/Dump/tree/main/LuaObfuscator, which in turn lifts a lot of code from https://github.com/stravant/LuaMinify.
Examples
Basic code analysis for Module:Sandbox/Aidan9382/CodeAnalysis | |
---|---|
Scope | Message |
Scope starting line 124 | i is defined but never referenced
|
Entire script | 9 local variables called _ were defined but never referenced, likely intentionally
|
Entire script | Global variable print was referenced or defined, yet isn't a standard global
|
Basic code analysis for Module:Wikitext Parsing | |
---|---|
Scope | Message |
Main scope | startswith is defined but never referenced
|
Scope starting line 404 | Variable _ is referenced, despite the name implying it is unused
|
Entire script | 3 local variables called _ were defined but never referenced, likely intentionally
|