Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update C# diagnostic documentation #8341

Merged
merged 2 commits into from
Oct 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions tutorials/scripting/c_sharp/diagnostics/GD0001.rst
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions tutorials/scripting/c_sharp/diagnostics/GD0002.rst
Original file line number Diff line number Diff line change
@@ -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
Expand Down
36 changes: 36 additions & 0 deletions tutorials/scripting/c_sharp/diagnostics/GD0107.rst
Original file line number Diff line number Diff line change
@@ -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.
1 change: 1 addition & 0 deletions tutorials/scripting/c_sharp/diagnostics/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Rules
GD0104
GD0105
GD0106
GD0107
GD0201
GD0202
GD0203
Expand Down