godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.1k stars 69 forks source link

Scene files validation #10196

Open amg98 opened 1 month ago

amg98 commented 1 month ago

Describe the project you are working on

A medium sized godot project

Describe the problem or limitation you are having in your project

Once my project starts growing in size, I find It useful to have means of validating the project files (mainly TSCN scenes) so I dont have to constantly QA the whole Game or check every scene manually every time I want to launch a new version of the project

Describe the feature / enhancement and how it helps to overcome the problem or limitation

A simple approach to solving this limitation could be adding a CLI option to the godot executable to validate the project.godot file or a TSCN file. That way I can run this validation step whenever I need to make changes or launch a release, avoiding manual work.

As far as what to validate, for example checking that referenced scripts exist, checking export variables and node type would be really useful

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

I would be adding a CLI option like godot --validate-project and godot --validate-scene my-scene.tscn to perform this validation

If this enhancement will not be used often, can it be worked around with a few lines of script?

Yes, it is possible to write a separate script to handle this validation, however It may be cumbersome to do so because the developer must know godot internals and take care of updating the validation script with each new godot version

Is there a reason why this should be core and not an add-on in the asset library?

I think It should be added to the core so it is updated with each new godot version, especially if some internals are changed and migrations are needed in the project and scene formats. I consider a feature like this benefits greatly to developers of medium to large sized projects to help reduce bugs and QA cycles

AThousandShips commented 1 month ago

Please detail what the validation would involve, validation is far too vague a topic, so some kind of details on what it would validate and how it would do this is necessary

amg98 commented 1 month ago

@AThousandShips The validation would be for example checking that referenced scripts files exist, that each exported variable has a defined value or the node inheritance in the script matches the node in the editor