Skip to content

Commit

Permalink
lint - fix not storing returned value in a variable for certain methods
Browse files Browse the repository at this point in the history
  • Loading branch information
ithinkandicode committed Jan 28, 2023
1 parent d6780da commit db85341
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion addons/mod_loader/mod_loader.gd
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ func append_node_in_scene(modified_scene: Node, node_name: String = "", node_par

func save_scene(modified_scene: Node, scene_path: String) -> void:
var packed_scene := PackedScene.new()
packed_scene.pack(modified_scene)
var _pack_error := packed_scene.pack(modified_scene)
ModLoaderUtils.log_debug("packing scene -> %s" % packed_scene, LOG_NAME)
packed_scene.take_over_path(scene_path)
ModLoaderUtils.log_debug("save_scene - taking over path - new path -> %s" % packed_scene.resource_path, LOG_NAME)
Expand Down
6 changes: 3 additions & 3 deletions addons/mod_loader/mod_loader_setup.gd
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ var modloaderutils: Node = load("res://addons/mod_loader/mod_loader_utils.gd").n

func _init() -> void:
try_setup_modloader()
change_scene(ProjectSettings.get_setting("application/run/main_scene"))
var _changescene_error: int = change_scene(ProjectSettings.get_setting("application/run/main_scene"))


# Set up the ModLoader, if it hasn't been set up yet
Expand All @@ -54,7 +54,7 @@ func try_setup_modloader() -> void:
modloaderutils.log_info("ModLoader is set up, but the game needs to be restarted", LOG_NAME)
OS.alert("The Godot ModLoader has been set up. Restart the game to apply the changes. Confirm to quit.")
ProjectSettings.set_setting(settings.IS_LOADER_SETUP_APPLIED, true)
ProjectSettings.save_custom(modloaderutils.get_override_path())
var _savecustom_error: int = ProjectSettings.save_custom(modloaderutils.get_override_path())
quit()


Expand All @@ -74,7 +74,7 @@ func setup_modloader() -> void:
# Set this here and check it elsewhere to prompt the user for a restart
ProjectSettings.set_setting(settings.IS_LOADER_SETUP_APPLIED, false)

ProjectSettings.save_custom(modloaderutils.get_override_path())
var _savecustom_error: int = ProjectSettings.save_custom(modloaderutils.get_override_path())
modloaderutils.log_info("ModLoader setup complete", LOG_NAME)


Expand Down
8 changes: 4 additions & 4 deletions addons/mod_loader/mod_loader_utils.gd
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ static func _write_to_log_file(log_entry: String) -> void:
var log_file := File.new()

if not log_file.file_exists(MOD_LOG_PATH):
log_file.open(MOD_LOG_PATH, File.WRITE)
var _fileopen_error: int = log_file.open(MOD_LOG_PATH, File.WRITE)
log_file.store_string('%s\t Created mod.log!' % get_date_time_string())
log_file.close()

Expand Down Expand Up @@ -266,7 +266,7 @@ static func register_global_classes_from_array(new_global_classes: Array) -> voi

ProjectSettings.set_setting("_global_script_classes", registered_classes)
ProjectSettings.set_setting("_global_script_class_icons", registered_class_icons)
ProjectSettings.save_custom(get_override_path())
var _savecustom_error: int = ProjectSettings.save_custom(get_override_path())


# Checks if all required fields are in the given [Dictionary]
Expand Down Expand Up @@ -295,7 +295,7 @@ static func get_flat_view_dict(p_dir := "res://", p_match := "", p_match_is_rege
var regex: RegEx
if p_match_is_regex:
regex = RegEx.new()
regex.compile(p_match)
var _compile_error: int = regex.compile(p_match)
if not regex.is_valid():
return data

Expand All @@ -307,7 +307,7 @@ static func get_flat_view_dict(p_dir := "res://", p_match := "", p_match_is_rege
dirs.pop_back()

if dir.open(dir_name) == OK:
dir.list_dir_begin()
var _dirlist_error: int = dir.list_dir_begin()
var file_name := dir.get_next()
while file_name != "":
if not dir_name == "res://":
Expand Down
6 changes: 3 additions & 3 deletions addons/mod_loader/mod_manifest.gd
Original file line number Diff line number Diff line change
Expand Up @@ -99,15 +99,15 @@ func get_package_id() -> String:
# a-z A-Z 0-9 _ (longer than 3 characters)
static func is_name_or_namespace_valid(name: String) -> bool:
var re := RegEx.new()
re.compile("^[a-zA-Z0-9_]*$") # alphanumeric and _
var _compile_error_1 = re.compile("^[a-zA-Z0-9_]*$") # alphanumeric and _

if re.search(name) == null:
ModLoaderUtils.log_fatal('Invalid name or namespace: "%s". You may only use letters, numbers and underscores.' % name, LOG_NAME)
return false

re.compile("^[a-zA-Z0-9_]{3,}$") # at least 3 long
if re.search(name) == null:
ModLoaderUtils.log_fatal('Invalid name or namespace: "%s". Must be longer than 3 characters.' % name, LOG_NAME)
var _compile_error_2 = re.compile("^[a-zA-Z0-9_]{3,}$") # at least 3 long
return false

return true
Expand All @@ -118,7 +118,7 @@ static func is_name_or_namespace_valid(name: String) -> bool:
# {0-9}.{0-9}.{0-9} (no leading 0, shorter than 16 characters total)
static func is_semver_valid(version_number: String) -> bool:
var re := RegEx.new()
re.compile("^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)$")
var _compile_error = re.compile("^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)$")

if re.search(version_number) == null:
ModLoaderUtils.log_fatal('Invalid semantic version: "%s". ' +
Expand Down

0 comments on commit db85341

Please sign in to comment.