Skip to content

Commit 85fc55a

Browse files
authored
Merge pull request godotengine#8250 from rarysson/update-warning-system
Update GDScript warning system to use `@warning_ignore`
2 parents 455140b + 49133c0 commit 85fc55a

7 files changed

+11
-28
lines changed
Binary file not shown.
8.88 KB
Loading
Binary file not shown.
8.17 KB
Loading
Binary file not shown.
7.27 KB
Loading

tutorials/scripting/gdscript/warning_system.rst

Lines changed: 11 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -11,47 +11,30 @@ to runtime errors.
1111
You can configure warnings in the Project Settings under the section
1212
called **GDScript**:
1313

14-
.. figure:: img/typed_gdscript_warning_system_settings.webp
15-
:alt: Warning system project settings
16-
17-
Warning system project settings
14+
.. image:: img/typed_gdscript_warning_system_settings.webp
1815

1916
.. note::
20-
21-
You must enable **Advanced Settings** in order to see the
17+
You must enable **Advanced Settings** in order to see the
2218
GDScript section in the sidebar. You can also search for "GDScript" when
2319
Advanced Settings is off.
2420

2521
You can find a list of warnings for the active GDScript file in the
26-
script editor's status bar. The example below has 3 warnings:
27-
28-
.. figure:: img/typed_gdscript_warning_example.png
29-
:alt: Warning system example
22+
script editor's status bar. The example below has 2 warnings:
3023

31-
Warning system example
24+
.. image:: img/typed_gdscript_warning_example.webp
3225

33-
To ignore specific warnings in one file, insert a special comment of the
34-
form ``# warning-ignore:warning-id``, or click on the ignore link to the
35-
right of the warning's description. Godot will add a comment above the
26+
To ignore specific warnings in one file, insert an annotation of the
27+
form ``@warning_ignore("warning-id")``, or click on the ignore link to the
28+
left of the warning's description. Godot will add an annotation above the
3629
corresponding line and the code won't trigger the corresponding warning
3730
anymore:
3831

39-
.. figure:: img/typed_gdscript_warning_system_ignore.png
40-
:alt: Warning system ignore example
41-
42-
Warning system ignore example
43-
44-
You can also choose to ignore not just one but all warnings of a certain
45-
type in this file with ``# warning-ignore-all:warning-id``. To ignore all
46-
warnings of all types in a file add the comment ``# warnings-disable`` to it.
32+
.. image:: img/typed_gdscript_warning_system_ignore.webp
4733

4834
Warnings won't prevent the game from running, but you can turn them into
4935
errors if you'd like. This way your game won't compile unless you fix
5036
all warnings. Head to the ``GDScript`` section of the Project Settings to
51-
turn on this option. Here's the same file as the previous example with
52-
warnings as errors turned on:
53-
54-
.. figure:: img/typed_gdscript_warning_system_errors.png
55-
:alt: Warnings as errors
37+
turn on this option to the warning that you want. Here's the same file as
38+
the previous example with the warning ``unused_variable`` as an error turned on:
5639

57-
Warnings as errors
40+
.. image:: img/typed_gdscript_warning_system_errors.webp

0 commit comments

Comments
 (0)