Module:Sandbox/Aidan9382/CodeAnalysis/doc

This function provides basic analysis of module code, pointing out any unused variables or unexpected globals. Note that just because this module points out cer

Module:Sandbox/Aidan9382/CodeAnalysis/doc

This function provides basic analysis of module code, pointing out any unused variables or unexpected globals. Note that just because this module points out certain behaviour does not neccessarily mean the behaviour is wrong nor needs correcting, but is rather a guide.

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.

Usage

This module can be required and used from the Debug console, like the following: require("Module:Sandbox/Aidan9382/CodeAnalysis").run(). The module will then log any behaviour it notices. The function can be provided a string argument to specify a target page other than the current page.

This module can also be used via templates using #invoke:, like the following: {{#invoke:Sandbox/Aidan9382/CodeAnalysis|main}}. The module will then produce a wikitable of anything it notes within the code. An argument can be provided to the first positional parameter to specify a certain page to analyse.

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
No issues found
Basic code analysis for Module:Banner shell
Scope Message
Entire script 1 local variable called _ was defined but never referenced, likely intentionally


Content Disclaimer

Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.

  1. The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
  2. There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
  3. It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
  4. Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
  5. Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.