Skip to content

Commit

Permalink
Merge pull request #69002 from akien-mga/gdscript-disable-warning-RET…
Browse files Browse the repository at this point in the history
…URN_VALUE_DISCARDED

GDScript: Don't warn about RETURN_VALUE_DISCARDED by default
  • Loading branch information
clayjohn authored Nov 22, 2022
2 parents 0aba659 + 4abbb2d commit 1285e0e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion doc/classes/ProjectSettings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@
<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>
<member name="debug/gdscript/warnings/return_value_discarded" type="int" setter="" getter="" default="1">
<member name="debug/gdscript/warnings/return_value_discarded" type="int" setter="" getter="" default="0">
When set to [code]warn[/code] or [code]error[/code], produces a warning or an error respectively when calling a function without using its return value (by assigning it to a variable or using it as a function argument). Such return values are sometimes used to denote possible errors using the [enum Error] enum.
</member>
<member name="debug/gdscript/warnings/shadowed_global_identifier" type="int" setter="" getter="" default="1">
Expand Down
4 changes: 4 additions & 0 deletions modules/gdscript/gdscript_warning.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,10 @@ int GDScriptWarning::get_default_value(Code p_code) {
if (get_name_from_code(p_code).to_lower().begins_with("unsafe_")) {
return WarnLevel::IGNORE;
}
// Too spammy by default on common cases (connect, Tween, etc.).
if (p_code == RETURN_VALUE_DISCARDED) {
return WarnLevel::IGNORE;
}
return WarnLevel::WARN;
}

Expand Down

0 comments on commit 1285e0e

Please sign in to comment.