Code
The code that I have written can be found here [it's in the form of a comparison with the original repository]. Most of the work is done on the files static_analyzer.cpp and static_analyzer.h https://github.com/godotengine/godot/compare/master...psuhas77:gsoc
Background
While making medium to large scale games in Godot, many small bugs start to creep in that cannot be caught by the compiler. These can only be dealt with manually while debugging. This project will build a tool to be used semi-regularly to highlight these problematic pieces of code in an automated fashion. This essentially extends the scope of static checks , currently just being within each script, to operate across scripts and scenes.
Work Done
Foundations:
- Scene traversal mechanism.
- Script traversal mechanism
Static Checks that are complete:
- Script inherits the Object type that it is attached to.
Static checks that work for general use cases:
- Node referenced in a
get_node()
call exists. - Function connected to a signal has arguments of correct arity.
Future Work
Work needs to be done on extending the project to as many static checks as possible. I will continue working on ensuring that the tool is as useful to as many people as it can be.