Skip to content

Commit

Permalink
GD-579: Part4: Minimize unsafe_method_access warnings (#584)
Browse files Browse the repository at this point in the history
# Why
If the default settings for warnings are changed to a more detailed
level, many warnings are displayed.

# What
- fix `debug/gdscript/warnings/unsafe_method_access` warnings
  • Loading branch information
MikeSchulze authored Sep 30, 2024
1 parent b80e1e0 commit b36296d
Show file tree
Hide file tree
Showing 83 changed files with 556 additions and 307 deletions.
4 changes: 2 additions & 2 deletions addons/gdUnit4/bin/GdUnitBuildTool.gd
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func _idle(_delta :float) -> void:
exit(RETURN_ERROR, result.error_message())
return
_console.prints_color("Added testcase: %s" % result.value(), Color.CORNFLOWER_BLUE)
print_json_result(result.value())
print_json_result(result.value() as Dictionary)
exit(RETURN_SUCCESS)


Expand All @@ -85,7 +85,7 @@ func exit(code :int, message :String = "") -> void:

func print_json_result(result :Dictionary) -> void:
# convert back to system path
var path := ProjectSettings.globalize_path(result["path"]);
var path := ProjectSettings.globalize_path(result["path"] as String)
var json := 'JSON_RESULT:{"TestCases" : [{"line":%d, "path": "%s"}]}' % [result["line"], path]
prints(json)

Expand Down
13 changes: 9 additions & 4 deletions addons/gdUnit4/bin/GdUnitCmdTool.gd
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ class CLIRunner:
func _ready() -> void:
_state = INIT
_report_dir = GdUnitFileAccess.current_dir() + "reports"
_executor = load("res://addons/gdUnit4/src/core/execution/GdUnitTestSuiteExecutor.gd").new()
_executor = GdUnitTestSuiteExecutor.new()
# stop checked first test failure to fail fast
_executor.fail_fast(true)
(_executor as GdUnitTestSuiteExecutor).fail_fast(true)
if GdUnit4CSharpApiLoader.is_mono_supported():
prints("GdUnit4Net version '%s' loaded." % GdUnit4CSharpApiLoader.version())
_cs_executor = GdUnit4CSharpApiLoader.create_executor(self)
Expand All @@ -124,6 +124,7 @@ class CLIRunner:
prints("Finallize .. done")


@warning_ignore("unsafe_method_access")
func _process(_delta :float) -> void:
match _state:
INIT:
Expand All @@ -137,6 +138,7 @@ class CLIRunner:
set_process(false)
# process next test suite
var test_suite := _test_suites_to_process.pop_front() as Node

if _cs_executor != null and _cs_executor.IsExecutable(test_suite):
_cs_executor.Execute(test_suite)
await _cs_executor.ExecutionCompleted
Expand Down Expand Up @@ -186,6 +188,7 @@ class CLIRunner:
"Disabled fail fast!",
Color.DEEP_SKY_BLUE
)
@warning_ignore("unsafe_method_access")
_executor.fail_fast(false)


Expand All @@ -200,13 +203,13 @@ class CLIRunner:

func show_version() -> void:
_console.prints_color(
"Godot %s" % Engine.get_version_info().get("string"),
"Godot %s" % Engine.get_version_info().get("string") as String,
Color.DARK_SALMON
)
var config := ConfigFile.new()
config.load("addons/gdUnit4/plugin.cfg")
_console.prints_color(
"GdUnit4 %s" % config.get_value("plugin", "version"),
"GdUnit4 %s" % config.get_value("plugin", "version") as String,
Color.DARK_SALMON
)
quit(RETURN_SUCCESS)
Expand Down Expand Up @@ -419,7 +422,9 @@ class CLIRunner:
# if no tests skipped test the complete suite is skipped
if skipped_tests.is_empty():
_console.prints_warning("Mark test suite '%s' as skipped!" % suite_to_skip)
@warning_ignore("unsafe_property_access")
test_suite.__is_skipped = true
@warning_ignore("unsafe_property_access")
test_suite.__skip_reason = skip_reason
else:
# skip tests
Expand Down
2 changes: 0 additions & 2 deletions addons/gdUnit4/src/GdUnitAwaiter.gd
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
class_name GdUnitAwaiter
extends RefCounted

const GdUnitAssertImpl = preload("res://addons/gdUnit4/src/asserts/GdUnitAssertImpl.gd")


# Waits for a specified signal in an interval of 50ms sent from the <source>, and terminates with an error after the specified timeout has elapsed.
# source: the object from which the signal is emitted
Expand Down
Loading

0 comments on commit b36296d

Please sign in to comment.