Update code order with static annotation on gdscript_styleguide.rst (#8920)

* Update code order with static annotation on gdscript_styleguide.rst

Update code order on gdscript_styleguide.rst
by inserting static variables and methods on the code order as a proposal
This commit is contained in:
Martin Beaussart
2025-01-25 18:06:20 +01:00
committed by GitHub
parent 1fe10df90d
commit d18c89ba71

View File

@@ -763,27 +763,38 @@ We suggest to organize GDScript code this way:
::
01. @tool
02. @icon
03. class_name
04. extends
05. ## docstring
01. @tool, @icon, @static_unload
02. class_name
03. extends
04. ## doc comment
06. signals
07. enums
08. constants
05. signals
06. enums
07. constants
08. static variables
09. @export variables
10. public variables
11. private variables
12. @onready variables
10. remaining regular variables
11. @onready variables
13. optional built-in virtual _init method
14. optional built-in virtual _enter_tree() method
15. built-in virtual _ready method
16. remaining built-in virtual methods
17. public methods
18. private methods
19. subclasses
12. _static_init()
13. remaining static methods
14. overridden built-in virtual methods:
1. _init()
2. _enter_tree()
3. _ready()
4. _process()
5. _physics_process()
6. remaining virtual methods
15. overridden custom methods
16. remaining methods
17. subclasses
And put the class methods and variables in the following order depending on their access modifiers:
::
1. public
2. private
We optimized the order to make it easy to read the code from top to bottom, to
help developers reading the code for the first time understand how it works, and