Skip to content

Commit

Permalink
refactor: ♻️ doc comments for all function and class descriptions (#397)
Browse files Browse the repository at this point in the history
refactor: ♻️ updated all function and class descriptions to use doc comments
  • Loading branch information
KANAjetzt authored May 24, 2024
1 parent 67f87eb commit 3212f1a
Show file tree
Hide file tree
Showing 12 changed files with 541 additions and 513 deletions.
265 changes: 129 additions & 136 deletions addons/mod_loader/api/config.gd

Large diffs are not rendered by default.

71 changes: 38 additions & 33 deletions addons/mod_loader/api/deprecated.gd
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
# API methods for deprecating funcs. Can be used by mods with public APIs.
class_name ModLoaderDeprecated
extends Node
extends Object
##
## API methods for deprecating funcs. Can be used by mods with public APIs.


const LOG_NAME := "ModLoader:Deprecated"


# Marks a method that has changed its name or class.
#
# Parameters:
# - old_method (String): The name of the deprecated method.
# - new_method (String): The name of the new method to use.
# - since_version (String): The version number from which the method has been deprecated.
# - show_removal_note (bool): (optional) If true, includes a note about future removal of the old method. Default is true.
#
# Returns: void
## Marks a method that has changed its name or class.[br]
## [br]
## [b]Parameters:[/b][br]
## - [code]old_method[/code] ([String]): The name of the deprecated method.[br]
## - [code]new_method[/code] ([String]): The name of the new method to use.[br]
## - [code]since_version[/code] ([String]): The version number from which the method has been deprecated.[br]
## - [code]show_removal_note[/code] ([bool]): (optional) If true, includes a note about future removal of the old method. Default is true.[br]
## [br]
## [b]Returns:[/b][br]
## - [code]void[/code]
static func deprecated_changed(old_method: String, new_method: String, since_version: String, show_removal_note: bool = true) -> void:
_deprecated_log(str(
"DEPRECATED: ",
Expand All @@ -24,15 +26,16 @@ static func deprecated_changed(old_method: String, new_method: String, since_ver
))


# Marks a method that has been entirely removed, with no replacement.
# Note: This should rarely be needed but is included for completeness.
#
# Parameters:
# - old_method (String): The name of the removed method.
# - since_version (String): The version number from which the method has been deprecated.
# - show_removal_note (bool): (optional) If true, includes a note about future removal of the old method. Default is true.
#
# Returns: void
## Marks a method that has been entirely removed, with no replacement.[br]
## Note: This should rarely be needed but is included for completeness.[br]
## [br]
## [b]Parameters:[/b][br]
## - [code]old_method[/code] ([String]): The name of the removed method.[br]
## - [code]since_version[/code] ([String]): The version number from which the method has been deprecated.[br]
## - [code]show_removal_note[/code] ([bool]): (optional) If true, includes a note about future removal of the old method. Default is true.[br]
## [br]
## [b]Returns:[/b][br]
## - [code]void[/code]
static func deprecated_removed(old_method: String, since_version: String, show_removal_note: bool = true) -> void:
_deprecated_log(str(
"DEPRECATED: ",
Expand All @@ -42,24 +45,26 @@ static func deprecated_removed(old_method: String, since_version: String, show_r
))


# Marks a method with a freeform deprecation message.
#
# Parameters:
# - msg (String): The deprecation message.
# - since_version (String): (optional) The version number from which the deprecation applies.
#
# Returns: void
## Marks a method with a freeform deprecation message.[br]
## [br]
## [b]Parameters:[/b][br]
## - [code]msg[/code] ([String]): The deprecation message.[br]
## - [code]since_version[/code] ([String]): (optional) The version number from which the deprecation applies.[br]
## [br]
## [b]Returns:[/b][br]
## - [code]void[/code]
static func deprecated_message(msg: String, since_version: String = "") -> void:
var since_text := " (since version %s)" % since_version if since_version else ""
_deprecated_log(str("DEPRECATED: ", msg, since_text))


# Internal function for logging deprecation messages with support to trigger warnings instead of fatal errors.
#
# Parameters:
# - msg (String): The deprecation message.
#
# Returns: void
## Internal function for logging deprecation messages with support to trigger warnings instead of fatal errors.[br]
## [br]
## [b]Parameters:[/b][br]
## - [code]msg[/code] ([String]): The deprecation message.[br]
## [br]
## [b]Returns:[/b][br]
## - [code]void[/code]
static func _deprecated_log(msg: String) -> void:
if ModLoaderStore and ModLoaderStore.ml_options.ignore_deprecated_errors or OS.has_feature("standalone"):
ModLoaderLog.warning(msg, LOG_NAME)
Expand Down
Loading

0 comments on commit 3212f1a

Please sign in to comment.