Mark GDScript and shader warnings for translation

This commit is contained in:
kobewi 2025-06-24 18:03:52 +02:00
parent 987832be46
commit 015cc38912
4 changed files with 60 additions and 63 deletions

View file

@ -527,9 +527,6 @@
<member name="debug/gdscript/warnings/confusable_local_usage" type="int" setter="" getter="" default="1">
When set to [code]warn[/code] or [code]error[/code], produces a warning or an error respectively when an identifier that will be shadowed below in the block is used.
</member>
<member name="debug/gdscript/warnings/constant_used_as_function" type="int" setter="" getter="" default="1" deprecated="This warning is never produced. Instead, an error is generated if the expression type is known at compile time.">
When set to [code]warn[/code] or [code]error[/code], produces a warning or an error respectively when a constant is used as a function.
</member>
<member name="debug/gdscript/warnings/deprecated_keyword" type="int" setter="" getter="" default="1">
When set to [code]warn[/code] or [code]error[/code], produces a warning or an error respectively when deprecated keywords are used.
[b]Note:[/b] There are currently no deprecated keywords, so this warning is never produced.
@ -546,9 +543,6 @@
<member name="debug/gdscript/warnings/exclude_addons" type="bool" setter="" getter="" default="true">
If [code]true[/code], scripts in the [code]res://addons[/code] folder will not generate warnings.
</member>
<member name="debug/gdscript/warnings/function_used_as_property" type="int" setter="" getter="" default="1" deprecated="This warning is never produced. When a function is used as a property, a [Callable] is returned.">
When set to [code]warn[/code] or [code]error[/code], produces a warning or an error respectively when using a function as if it is a property.
</member>
<member name="debug/gdscript/warnings/get_node_default_without_onready" type="int" setter="" getter="" default="2">
When set to [code]warn[/code] or [code]error[/code], produces a warning or an error respectively when [method Node.get_node] (or the shorthand [code]$[/code]) is used as default value of a class variable without the [code]@onready[/code] annotation.
</member>
@ -583,9 +577,6 @@
<member name="debug/gdscript/warnings/onready_with_export" type="int" setter="" getter="" default="2">
When set to [code]warn[/code] or [code]error[/code], produces a warning or an error respectively when the [code]@onready[/code] annotation is used together with the [code]@export[/code] annotation, since it may not behave as expected.
</member>
<member name="debug/gdscript/warnings/property_used_as_function" type="int" setter="" getter="" default="1" deprecated="This warning is never produced. Instead, an error is generated if the expression type is known at compile time.">
When set to [code]warn[/code] or [code]error[/code], produces a warning or an error respectively when using a property as if it is a function.
</member>
<member name="debug/gdscript/warnings/redundant_await" type="int" setter="" getter="" default="1">
When set to [code]warn[/code] or [code]error[/code], produces a warning or an error respectively when a function that is not a coroutine is called with await.
</member>

View file

@ -2964,6 +2964,12 @@ GDScriptLanguage::GDScriptLanguage() {
String path = GDScriptWarning::get_settings_path_from_code(code);
GLOBAL_DEF(GDScriptWarning::get_property_info(code), default_enabled);
}
#ifndef DISABLE_DEPRECATED
ProjectSettings::get_singleton()->set_as_internal("debug/gdscript/warnings/property_used_as_function", true);
ProjectSettings::get_singleton()->set_as_internal("debug/gdscript/warnings/constant_used_as_function", true);
ProjectSettings::get_singleton()->set_as_internal("debug/gdscript/warnings/function_used_as_property", true);
#endif
#endif // DEBUG_ENABLED
}

View file

@ -194,50 +194,50 @@ String GDScriptWarning::get_name_from_code(Code p_code) {
ERR_FAIL_COND_V(p_code < 0 || p_code >= WARNING_MAX, String());
static const char *names[] = {
"UNASSIGNED_VARIABLE",
"UNASSIGNED_VARIABLE_OP_ASSIGN",
"UNUSED_VARIABLE",
"UNUSED_LOCAL_CONSTANT",
"UNUSED_PRIVATE_CLASS_VARIABLE",
"UNUSED_PARAMETER",
"UNUSED_SIGNAL",
"SHADOWED_VARIABLE",
"SHADOWED_VARIABLE_BASE_CLASS",
"SHADOWED_GLOBAL_IDENTIFIER",
"UNREACHABLE_CODE",
"UNREACHABLE_PATTERN",
"STANDALONE_EXPRESSION",
"STANDALONE_TERNARY",
"INCOMPATIBLE_TERNARY",
"UNTYPED_DECLARATION",
"INFERRED_DECLARATION",
"UNSAFE_PROPERTY_ACCESS",
"UNSAFE_METHOD_ACCESS",
"UNSAFE_CAST",
"UNSAFE_CALL_ARGUMENT",
"UNSAFE_VOID_RETURN",
"RETURN_VALUE_DISCARDED",
"STATIC_CALLED_ON_INSTANCE",
"MISSING_TOOL",
"REDUNDANT_STATIC_UNLOAD",
"REDUNDANT_AWAIT",
"ASSERT_ALWAYS_TRUE",
"ASSERT_ALWAYS_FALSE",
"INTEGER_DIVISION",
"NARROWING_CONVERSION",
"INT_AS_ENUM_WITHOUT_CAST",
"INT_AS_ENUM_WITHOUT_MATCH",
"ENUM_VARIABLE_WITHOUT_DEFAULT",
"EMPTY_FILE",
"DEPRECATED_KEYWORD",
"CONFUSABLE_IDENTIFIER",
"CONFUSABLE_LOCAL_DECLARATION",
"CONFUSABLE_LOCAL_USAGE",
"CONFUSABLE_CAPTURE_REASSIGNMENT",
"INFERENCE_ON_VARIANT",
"NATIVE_METHOD_OVERRIDE",
"GET_NODE_DEFAULT_WITHOUT_ONREADY",
"ONREADY_WITH_EXPORT",
PNAME("UNASSIGNED_VARIABLE"),
PNAME("UNASSIGNED_VARIABLE_OP_ASSIGN"),
PNAME("UNUSED_VARIABLE"),
PNAME("UNUSED_LOCAL_CONSTANT"),
PNAME("UNUSED_PRIVATE_CLASS_VARIABLE"),
PNAME("UNUSED_PARAMETER"),
PNAME("UNUSED_SIGNAL"),
PNAME("SHADOWED_VARIABLE"),
PNAME("SHADOWED_VARIABLE_BASE_CLASS"),
PNAME("SHADOWED_GLOBAL_IDENTIFIER"),
PNAME("UNREACHABLE_CODE"),
PNAME("UNREACHABLE_PATTERN"),
PNAME("STANDALONE_EXPRESSION"),
PNAME("STANDALONE_TERNARY"),
PNAME("INCOMPATIBLE_TERNARY"),
PNAME("UNTYPED_DECLARATION"),
PNAME("INFERRED_DECLARATION"),
PNAME("UNSAFE_PROPERTY_ACCESS"),
PNAME("UNSAFE_METHOD_ACCESS"),
PNAME("UNSAFE_CAST"),
PNAME("UNSAFE_CALL_ARGUMENT"),
PNAME("UNSAFE_VOID_RETURN"),
PNAME("RETURN_VALUE_DISCARDED"),
PNAME("STATIC_CALLED_ON_INSTANCE"),
PNAME("MISSING_TOOL"),
PNAME("REDUNDANT_STATIC_UNLOAD"),
PNAME("REDUNDANT_AWAIT"),
PNAME("ASSERT_ALWAYS_TRUE"),
PNAME("ASSERT_ALWAYS_FALSE"),
PNAME("INTEGER_DIVISION"),
PNAME("NARROWING_CONVERSION"),
PNAME("INT_AS_ENUM_WITHOUT_CAST"),
PNAME("INT_AS_ENUM_WITHOUT_MATCH"),
PNAME("ENUM_VARIABLE_WITHOUT_DEFAULT"),
PNAME("EMPTY_FILE"),
PNAME("DEPRECATED_KEYWORD"),
PNAME("CONFUSABLE_IDENTIFIER"),
PNAME("CONFUSABLE_LOCAL_DECLARATION"),
PNAME("CONFUSABLE_LOCAL_USAGE"),
PNAME("CONFUSABLE_CAPTURE_REASSIGNMENT"),
PNAME("INFERENCE_ON_VARIANT"),
PNAME("NATIVE_METHOD_OVERRIDE"),
PNAME("GET_NODE_DEFAULT_WITHOUT_ONREADY"),
PNAME("ONREADY_WITH_EXPORT"),
#ifndef DISABLE_DEPRECATED
"PROPERTY_USED_AS_FUNCTION",
"CONSTANT_USED_AS_FUNCTION",

View file

@ -85,16 +85,16 @@ String ShaderWarning::get_name_from_code(Code p_code) {
ERR_FAIL_INDEX_V(p_code, WARNING_MAX, String());
static const char *names[] = {
"FLOAT_COMPARISON",
"UNUSED_CONSTANT",
"UNUSED_FUNCTION",
"UNUSED_STRUCT",
"UNUSED_UNIFORM",
"UNUSED_VARYING",
"UNUSED_LOCAL_VARIABLE",
"FORMATTING_ERROR",
"DEVICE_LIMIT_EXCEEDED",
"MAGIC_POSITION_WRITE",
PNAME("FLOAT_COMPARISON"),
PNAME("UNUSED_CONSTANT"),
PNAME("UNUSED_FUNCTION"),
PNAME("UNUSED_STRUCT"),
PNAME("UNUSED_UNIFORM"),
PNAME("UNUSED_VARYING"),
PNAME("UNUSED_LOCAL_VARIABLE"),
PNAME("FORMATTING_ERROR"),
PNAME("DEVICE_LIMIT_EXCEEDED"),
PNAME("MAGIC_POSITION_WRITE"),
};
static_assert(std::size(names) == WARNING_MAX, "Amount of warning types don't match the amount of warning names.");