From b63001f753175f11e63d85395985e99f1053ae7b Mon Sep 17 00:00:00 2001 From: Raul Santos Date: Wed, 18 Oct 2023 14:05:14 +0200 Subject: [PATCH 1/2] Fix C# diagnostic messages to match 4.2 --- tutorials/scripting/c_sharp/diagnostics/GD0001.rst | 4 ++-- tutorials/scripting/c_sharp/diagnostics/GD0002.rst | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tutorials/scripting/c_sharp/diagnostics/GD0001.rst b/tutorials/scripting/c_sharp/diagnostics/GD0001.rst index d5f7bee33ae..116f1502a1b 100644 --- a/tutorials/scripting/c_sharp/diagnostics/GD0001.rst +++ b/tutorials/scripting/c_sharp/diagnostics/GD0001.rst @@ -1,5 +1,5 @@ -GD0001: Missing partial modifier on declaration of type which is a subclass of GodotObject -========================================================================================== +GD0001: Missing partial modifier on declaration of type that derives from GodotObject +===================================================================================== ==================================== ====================================== Value diff --git a/tutorials/scripting/c_sharp/diagnostics/GD0002.rst b/tutorials/scripting/c_sharp/diagnostics/GD0002.rst index 1826715fce6..672c1fbdc08 100644 --- a/tutorials/scripting/c_sharp/diagnostics/GD0002.rst +++ b/tutorials/scripting/c_sharp/diagnostics/GD0002.rst @@ -1,5 +1,5 @@ -GD0002: Missing partial modifier on declaration of type which contains one or more subclasses of GodotObject -============================================================================================================ +GD0002: Missing partial modifier on declaration of type which contains nested classes that derive from GodotObject +================================================================================================================== ==================================== ====================================== Value From 52ac48807986de596acb35f107531c6b4934c07f Mon Sep 17 00:00:00 2001 From: Raul Santos Date: Fri, 27 Oct 2023 16:32:21 +0200 Subject: [PATCH 2/2] C#: Add documentation for GD0107 --- .../scripting/c_sharp/diagnostics/GD0107.rst | 36 +++++++++++++++++++ .../scripting/c_sharp/diagnostics/index.rst | 1 + 2 files changed, 37 insertions(+) create mode 100644 tutorials/scripting/c_sharp/diagnostics/GD0107.rst diff --git a/tutorials/scripting/c_sharp/diagnostics/GD0107.rst b/tutorials/scripting/c_sharp/diagnostics/GD0107.rst new file mode 100644 index 00000000000..e33b10ef403 --- /dev/null +++ b/tutorials/scripting/c_sharp/diagnostics/GD0107.rst @@ -0,0 +1,36 @@ +GD0107: Types not derived from Node should not export Node members +================================================================== + +==================================== ====================================== + Value +==================================== ====================================== +**Rule ID** GD0107 +**Category** Usage +**Fix is breaking or non-breaking** Breaking +**Enabled by default** Yes +==================================== ====================================== + +Cause +----- + +A type that doesn't derive from ``Node`` contains an exported field or property +of a type that derives from ``Node``. + +Rule description +---------------- + +Exported nodes are serialized as ``NodePath``. Only types derived from ``Node`` +are able to get the node instance from the ``NodePath``. + +How to fix violations +--------------------- + +To fix a violation of this rule, avoid exporting ``Node`` members on a type that +doesn't derive from ``Node``, or consider exporting a ``NodePath``. + +When to suppress warnings +------------------------- + +Do not suppress a warning from this rule. Types that don't derive from ``Node`` +will be unable to retrieve the right node instance for exported ``Node`` members, +resulting in unexpected runtime errors. diff --git a/tutorials/scripting/c_sharp/diagnostics/index.rst b/tutorials/scripting/c_sharp/diagnostics/index.rst index 5a17bb8c00b..99825753185 100644 --- a/tutorials/scripting/c_sharp/diagnostics/index.rst +++ b/tutorials/scripting/c_sharp/diagnostics/index.rst @@ -19,6 +19,7 @@ Rules GD0104 GD0105 GD0106 + GD0107 GD0201 GD0202 GD0203