GD0001.rst 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. GD0001: Missing partial modifier on declaration of type that derives from GodotObject
  2. =====================================================================================
  3. ==================================== ======================================
  4. Value
  5. ==================================== ======================================
  6. **Rule ID** GD0001
  7. **Category** Usage
  8. **Fix is breaking or non-breaking** Non-breaking
  9. **Enabled by default** Yes
  10. ==================================== ======================================
  11. Cause
  12. -----
  13. A type that derives from ``GodotObject`` is not declared partial.
  14. Rule description
  15. ----------------
  16. Godot source generators add generated code to user-defined types to implement
  17. the integration with the engine. Source generators can't add generated code to
  18. types that aren't declared partial.
  19. .. code-block:: csharp
  20. // The source generators can't enhance this type to work with Godot.
  21. public class InvalidNode : Node { }
  22. // The source generators can enhance this type to work with Godot.
  23. public partial class ValidNode { }
  24. How to fix violations
  25. ---------------------
  26. To fix a violation of this rule, add the ``partial`` keyword to the type
  27. declaration.
  28. When to suppress warnings
  29. -------------------------
  30. Do not suppress a warning from this rule. Types that derive from ``GodotObject``
  31. but aren't partial can't be enhanced by the source generators, resulting in
  32. unexpected runtime errors.