From 77f90b0c7488e85832bb31fc9fe9da00766ced70 Mon Sep 17 00:00:00 2001 From: Nathan Lovato Date: Tue, 11 Feb 2020 13:15:29 -0600 Subject: [PATCH] Remove warnings in the DemoPicker scene Also turned off the setting for discarded return value warnings as it triggers for many calls, including to built-in functions. --- project/demos/DemoPickerUI.gd | 1 + project/demos/PopulateItemList.gd | 15 ++++++++------- project/project.godot | 4 ++++ 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/project/demos/DemoPickerUI.gd b/project/demos/DemoPickerUI.gd index 20bf0d4..1de7ac3 100644 --- a/project/demos/DemoPickerUI.gd +++ b/project/demos/DemoPickerUI.gd @@ -2,6 +2,7 @@ class_name DemoPickerUI extends Control +# warning-ignore:unused_signal signal demo_requested var demo_path := "" setget set_demo_path diff --git a/project/demos/PopulateItemList.gd b/project/demos/PopulateItemList.gd index b8f60e1..6029aa5 100644 --- a/project/demos/PopulateItemList.gd +++ b/project/demos/PopulateItemList.gd @@ -25,6 +25,7 @@ func populate(demos: PoolStringArray) -> void: func sentencify(line: String) -> String: var regex := RegEx.new() + # warning-ignore:return_value_discarded regex.compile("[A-Z]") line = line.split(".", true, 1)[0] @@ -33,31 +34,31 @@ func sentencify(line: String) -> String: func _find_files(dirpath := "", patterns := PoolStringArray(), is_recursive := false, do_skip_hidden := true) -> PoolStringArray: - var file_paths: = PoolStringArray() + var paths: = PoolStringArray() var directory: = Directory.new() if not directory.dir_exists(dirpath): printerr("The directory does not exist: %s" % dirpath) - return file_paths + return paths if not directory.open(dirpath) == OK: printerr("Could not open the following dirpath: %s" % dirpath) - return file_paths + return paths + # warning-ignore:return_value_discarded directory.list_dir_begin(true, do_skip_hidden) var file_name: = directory.get_next() - var subdirectories: = PoolStringArray() while file_name != "": if directory.current_is_dir() and is_recursive: var subdirectory: = dirpath.plus_file(file_name) - file_paths.append_array(_find_files(subdirectory, patterns, is_recursive)) + paths.append_array(_find_files(subdirectory, patterns, is_recursive)) else: for pattern in patterns: if file_name.match(pattern): - file_paths.append(dirpath.plus_file(file_name)) + paths.append(dirpath.plus_file(file_name)) file_name = directory.get_next() directory.list_dir_end() - return file_paths + return paths func _on_item_selected(index: int) -> void: diff --git a/project/project.godot b/project/project.godot index d8b307e..5c94b38 100644 --- a/project/project.godot +++ b/project/project.godot @@ -198,6 +198,10 @@ config/name="SteeringToolkit" run/main_scene="res://demos/DemoSelector.tscn" config/icon="res://icon.png" +[debug] + +gdscript/warnings/return_value_discarded=false + [display] window/size/width=1920