Validate code tags for class and member references

This commit also adds means to manually disable warnings
in `code` tags where it's a false positive with the new
`skip-lint` attribute.

Warnings are now enabled on CI to prevent future errors.
This commit is contained in:
Yuri Sizov
2023-10-02 20:11:43 +02:00
parent a2f90d565a
commit cc0eebd9d8
89 changed files with 514 additions and 359 deletions
+29 -29
View File
@@ -6,9 +6,9 @@
<description>
A control for displaying text that can contain custom fonts, images, and basic formatting. [RichTextLabel] manages these as an internal tag stack. It also adapts itself to given width/heights.
[b]Note:[/b] Assignments to [member text] clear the tag stack and reconstruct it from the property's contents. Any edits made to [member text] will erase previous edits made from other manual sources such as [method append_text] and the [code]push_*[/code] / [method pop] methods.
[b]Note:[/b] RichTextLabel doesn't support entangled BBCode tags. For example, instead of using [code][b]bold[i]bold italic[/b]italic[/i][/code], use [code][b]bold[i]bold italic[/i][/b][i]italic[/i][/code].
[b]Note:[/b] RichTextLabel doesn't support entangled BBCode tags. For example, instead of using [code skip-lint][b]bold[i]bold italic[/b]italic[/i][/code], use [code skip-lint][b]bold[i]bold italic[/i][/b][i]italic[/i][/code].
[b]Note:[/b] [code]push_*/pop_*[/code] functions won't affect BBCode.
[b]Note:[/b] Unlike [Label], [RichTextLabel] doesn't have a [i]property[/i] to horizontally align text to the center. Instead, enable [member bbcode_enabled] and surround the text in a [code][center][/code] tag as follows: [code][center]Example[/center][/code]. There is currently no built-in way to vertically align text either, but this can be emulated by relying on anchors/containers and the [member fit_content] property.
[b]Note:[/b] Unlike [Label], [RichTextLabel] doesn't have a [i]property[/i] to horizontally align text to the center. Instead, enable [member bbcode_enabled] and surround the text in a [code skip-lint][center][/code] tag as follows: [code skip-lint][center]Example[/center][/code]. There is currently no built-in way to vertically align text either, but this can be emulated by relying on anchors/containers and the [member fit_content] property.
</description>
<tutorials>
<link title="BBCode in RichTextLabel">$DOCS_URL/tutorials/ui/bbcode_in_richtextlabel.html</link>
@@ -289,32 +289,32 @@
<return type="void" />
<param index="0" name="bgcolor" type="Color" />
<description>
Adds a [code][bgcolor][/code] tag to the tag stack.
Adds a [code skip-lint][bgcolor][/code] tag to the tag stack.
</description>
</method>
<method name="push_bold">
<return type="void" />
<description>
Adds a [code][font][/code] tag with a bold font to the tag stack. This is the same as adding a [code][b][/code] tag if not currently in a [code][i][/code] tag.
Adds a [code skip-lint][font][/code] tag with a bold font to the tag stack. This is the same as adding a [code skip-lint][b][/code] tag if not currently in a [code skip-lint][i][/code] tag.
</description>
</method>
<method name="push_bold_italics">
<return type="void" />
<description>
Adds a [code][font][/code] tag with a bold italics font to the tag stack.
Adds a [code skip-lint][font][/code] tag with a bold italics font to the tag stack.
</description>
</method>
<method name="push_cell">
<return type="void" />
<description>
Adds a [code][cell][/code] tag to the tag stack. Must be inside a [code][table][/code] tag. See [method push_table] for details.
Adds a [code skip-lint][cell][/code] tag to the tag stack. Must be inside a [code skip-lint][table][/code] tag. See [method push_table] for details.
</description>
</method>
<method name="push_color">
<return type="void" />
<param index="0" name="color" type="Color" />
<description>
Adds a [code][color][/code] tag to the tag stack.
Adds a [code skip-lint][color][/code] tag to the tag stack.
</description>
</method>
<method name="push_context">
@@ -341,14 +341,14 @@
<param index="5" name="outline_size" type="int" default="0" />
<param index="6" name="outline_color" type="Color" default="Color(0, 0, 0, 0)" />
<description>
Adds a [code][dropcap][/code] tag to the tag stack. Drop cap (dropped capital) is a decorative element at the beginning of a paragraph that is larger than the rest of the text.
Adds a [code skip-lint][dropcap][/code] tag to the tag stack. Drop cap (dropped capital) is a decorative element at the beginning of a paragraph that is larger than the rest of the text.
</description>
</method>
<method name="push_fgcolor">
<return type="void" />
<param index="0" name="fgcolor" type="Color" />
<description>
Adds a [code][fgcolor][/code] tag to the tag stack.
Adds a [code skip-lint][fgcolor][/code] tag to the tag stack.
</description>
</method>
<method name="push_font">
@@ -356,7 +356,7 @@
<param index="0" name="font" type="Font" />
<param index="1" name="font_size" type="int" default="0" />
<description>
Adds a [code][font][/code] tag to the tag stack. Overrides default fonts for its duration.
Adds a [code skip-lint][font][/code] tag to the tag stack. Overrides default fonts for its duration.
Passing [code]0[/code] to [param font_size] will use the existing default font size.
</description>
</method>
@@ -364,27 +364,27 @@
<return type="void" />
<param index="0" name="font_size" type="int" />
<description>
Adds a [code][font_size][/code] tag to the tag stack. Overrides default font size for its duration.
Adds a [code skip-lint][font_size][/code] tag to the tag stack. Overrides default font size for its duration.
</description>
</method>
<method name="push_hint">
<return type="void" />
<param index="0" name="description" type="String" />
<description>
Adds a [code][hint][/code] tag to the tag stack. Same as BBCode [code][hint=something]{text}[/hint][/code].
Adds a [code skip-lint][hint][/code] tag to the tag stack. Same as BBCode [code skip-lint][hint=something]{text}[/hint][/code].
</description>
</method>
<method name="push_indent">
<return type="void" />
<param index="0" name="level" type="int" />
<description>
Adds an [code][indent][/code] tag to the tag stack. Multiplies [param level] by current [member tab_size] to determine new margin length.
Adds an [code skip-lint][indent][/code] tag to the tag stack. Multiplies [param level] by current [member tab_size] to determine new margin length.
</description>
</method>
<method name="push_italics">
<return type="void" />
<description>
Adds a [code][font][/code] tag with an italics font to the tag stack. This is the same as adding an [code][i][/code] tag if not currently in a [code][b][/code] tag.
Adds a [code skip-lint][font][/code] tag with an italics font to the tag stack. This is the same as adding an [code skip-lint][i][/code] tag if not currently in a [code skip-lint][b][/code] tag.
</description>
</method>
<method name="push_language">
@@ -401,40 +401,40 @@
<param index="2" name="capitalize" type="bool" />
<param index="3" name="bullet" type="String" default="&quot;•&quot;" />
<description>
Adds [code][ol][/code] or [code][ul][/code] tag to the tag stack. Multiplies [param level] by current [member tab_size] to determine new margin length.
Adds [code skip-lint][ol][/code] or [code skip-lint][ul][/code] tag to the tag stack. Multiplies [param level] by current [member tab_size] to determine new margin length.
</description>
</method>
<method name="push_meta">
<return type="void" />
<param index="0" name="data" type="Variant" />
<description>
Adds a meta tag to the tag stack. Similar to the BBCode [code][url=something]{text}[/url][/code], but supports non-[String] metadata types.
Adds a meta tag to the tag stack. Similar to the BBCode [code skip-lint][url=something]{text}[/url][/code], but supports non-[String] metadata types.
</description>
</method>
<method name="push_mono">
<return type="void" />
<description>
Adds a [code][font][/code] tag with a monospace font to the tag stack.
Adds a [code skip-lint][font][/code] tag with a monospace font to the tag stack.
</description>
</method>
<method name="push_normal">
<return type="void" />
<description>
Adds a [code][font][/code] tag with a normal font to the tag stack.
Adds a [code skip-lint][font][/code] tag with a normal font to the tag stack.
</description>
</method>
<method name="push_outline_color">
<return type="void" />
<param index="0" name="color" type="Color" />
<description>
Adds a [code][outline_color][/code] tag to the tag stack. Adds text outline for its duration.
Adds a [code skip-lint][outline_color][/code] tag to the tag stack. Adds text outline for its duration.
</description>
</method>
<method name="push_outline_size">
<return type="void" />
<param index="0" name="outline_size" type="int" />
<description>
Adds a [code][outline_size][/code] tag to the tag stack. Overrides default text outline size for its duration.
Adds a [code skip-lint][outline_size][/code] tag to the tag stack. Overrides default text outline size for its duration.
</description>
</method>
<method name="push_paragraph">
@@ -446,13 +446,13 @@
<param index="4" name="justification_flags" type="int" enum="TextServer.JustificationFlag" is_bitfield="true" default="163" />
<param index="5" name="tab_stops" type="PackedFloat32Array" default="PackedFloat32Array()" />
<description>
Adds a [code][p][/code] tag to the tag stack.
Adds a [code skip-lint][p][/code] tag to the tag stack.
</description>
</method>
<method name="push_strikethrough">
<return type="void" />
<description>
Adds a [code][s][/code] tag to the tag stack.
Adds a [code skip-lint][s][/code] tag to the tag stack.
</description>
</method>
<method name="push_table">
@@ -461,13 +461,13 @@
<param index="1" name="inline_align" type="int" enum="InlineAlignment" default="0" />
<param index="2" name="align_to_row" type="int" default="-1" />
<description>
Adds a [code][table=columns,inline_align][/code] tag to the tag stack.
Adds a [code skip-lint][table=columns,inline_align][/code] tag to the tag stack.
</description>
</method>
<method name="push_underline">
<return type="void" />
<description>
Adds a [code][u][/code] tag to the tag stack.
Adds a [code skip-lint][u][/code] tag to the tag stack.
</description>
</method>
<method name="remove_paragraph">
@@ -589,13 +589,13 @@
If [code]true[/code], the label's minimum size will be automatically updated to fit its content, matching the behavior of [Label].
</member>
<member name="hint_underlined" type="bool" setter="set_hint_underline" getter="is_hint_underlined" default="true">
If [code]true[/code], the label underlines hint tags such as [code][hint=description]{text}[/hint][/code].
If [code]true[/code], the label underlines hint tags such as [code skip-lint][hint=description]{text}[/hint][/code].
</member>
<member name="language" type="String" setter="set_language" getter="get_language" default="&quot;&quot;">
Language code used for line-breaking and text shaping algorithms, if left empty current locale is used instead.
</member>
<member name="meta_underlined" type="bool" setter="set_meta_underline" getter="is_meta_underlined" default="true">
If [code]true[/code], the label underlines meta tags such as [code][url]{text}[/url][/code].
If [code]true[/code], the label underlines meta tags such as [code skip-lint][url]{text}[/url][/code].
</member>
<member name="progress_bar_delay" type="int" setter="set_progress_bar_delay" getter="get_progress_bar_delay" default="1000">
The delay after which the loading progress bar is displayed, in milliseconds. Set to [code]-1[/code] to disable progress bar entirely.
@@ -624,7 +624,7 @@
</member>
<member name="text" type="String" setter="set_text" getter="get_text" default="&quot;&quot;">
The label's text in BBCode format. Is not representative of manual modifications to the internal tag stack. Erases changes made by other methods when edited.
[b]Note:[/b] If [member bbcode_enabled] is [code]true[/code], it is unadvised to use the [code]+=[/code] operator with [code]text[/code] (e.g. [code]text += "some string"[/code]) as it replaces the whole text and can cause slowdowns. It will also erase all BBCode that was added to stack using [code]push_*[/code] methods. Use [method append_text] for adding text instead, unless you absolutely need to close a tag that was opened in an earlier method call.
[b]Note:[/b] If [member bbcode_enabled] is [code]true[/code], it is unadvised to use the [code]+=[/code] operator with [member text] (e.g. [code]text += "some string"[/code]) as it replaces the whole text and can cause slowdowns. It will also erase all BBCode that was added to stack using [code]push_*[/code] methods. Use [method append_text] for adding text instead, unless you absolutely need to close a tag that was opened in an earlier method call.
</member>
<member name="text_direction" type="int" setter="set_text_direction" getter="get_text_direction" enum="Control.TextDirection" default="0">
Base text writing direction.
@@ -653,7 +653,7 @@
<signal name="meta_clicked">
<param index="0" name="meta" type="Variant" />
<description>
Triggered when the user clicks on content between meta tags. If the meta is defined in text, e.g. [code][url={"data"="hi"}]hi[/url][/code], then the parameter for this signal will be a [String] type. If a particular type or an object is desired, the [method push_meta] method must be used to manually insert the data into the tag stack.
Triggered when the user clicks on content between meta tags. If the meta is defined in text, e.g. [code skip-lint][url={"data"="hi"}]hi[/url][/code], then the parameter for this signal will be a [String] type. If a particular type or an object is desired, the [method push_meta] method must be used to manually insert the data into the tag stack.
</description>
</signal>
<signal name="meta_hover_ended">
@@ -800,7 +800,7 @@
The default text font size.
</theme_item>
<theme_item name="focus" data_type="style" type="StyleBox">
The background used when the [RichTextLabel] is focused. The [code]focus[/code] [StyleBox] is displayed [i]over[/i] the base [StyleBox], so a partially transparent [StyleBox] should be used to ensure the base [StyleBox] remains visible. A [StyleBox] that represents an outline or an underline works well for this purpose. To disable the focus visual effect, assign a [StyleBoxEmpty] resource. Note that disabling the focus visual effect will harm keyboard/controller navigation usability, so this is not recommended for accessibility reasons.
The background used when the [RichTextLabel] is focused. The [theme_item focus] [StyleBox] is displayed [i]over[/i] the base [StyleBox], so a partially transparent [StyleBox] should be used to ensure the base [StyleBox] remains visible. A [StyleBox] that represents an outline or an underline works well for this purpose. To disable the focus visual effect, assign a [StyleBoxEmpty] resource. Note that disabling the focus visual effect will harm keyboard/controller navigation usability, so this is not recommended for accessibility reasons.
</theme_item>
<theme_item name="normal" data_type="style" type="StyleBox">
The normal background for the [RichTextLabel].