From b5f52ccb4b465ea01232a16fd4255862f8a309f9 Mon Sep 17 00:00:00 2001 From: DamianX Date: Tue, 30 Jun 2020 21:13:50 +0200 Subject: [PATCH] fixed several linter warnings (#26977) --- __DEFINES/global.dm | 2 -- __DEFINES/profile.dm | 6 +++--- code/__HELPERS/text.dm | 11 ----------- code/libs/BSQL/core/library.dm | 2 +- code/modules/admin/verbs/debug.dm | 4 ++-- code/modules/clothing/masks/gasmask.dm | 4 ++-- code/modules/media/jukebox.dm | 3 +-- code/modules/projectiles/guns/projectile/revolver.dm | 2 +- code/modules/scripting/Parser/Expressions.dm | 6 +++--- code/modules/scripting/Parser/Keywords.dm | 2 +- code/modules/scripting/Parser/Parser.dm | 2 +- 11 files changed, 15 insertions(+), 29 deletions(-) diff --git a/__DEFINES/global.dm b/__DEFINES/global.dm index 50924b953cd..2d0d892b528 100644 --- a/__DEFINES/global.dm +++ b/__DEFINES/global.dm @@ -228,8 +228,6 @@ var/forum_authenticated_group = "10" var/fileaccess_timer = 0 var/custom_event_msg = null -#define MIDNIGHT_ROLLOVER 864000 //number of deciseconds in a day - //Recall time limit: 2 hours var/recall_time_limit = 72000 diff --git a/__DEFINES/profile.dm b/__DEFINES/profile.dm index 95e255432e9..aa9797ef563 100644 --- a/__DEFINES/profile.dm +++ b/__DEFINES/profile.dm @@ -1,5 +1,5 @@ -#define PROFILE_START ;PROFILE_STORE = list();PROFILE_SET; -#define PROFILE_STOP ;PROFILE_STORE = null; +#define LINE_PROFILE_START ;PROFILE_STORE = list();PROFILE_SET; +#define LINE_PROFILE_STOP ;PROFILE_STORE = null; #define PROFILE_SET ;PROFILE_TIME = world.tick_usage; PROFILE_LINE = __LINE__; PROFILE_FILE = __FILE__; PROFILE_SLEEPCHECK = world.time; @@ -26,4 +26,4 @@ #define PROFILE_ITEM_LEN 2 #define PROFILE_ITEM_TIME 1 -#define PROFILE_ITEM_COUNT 2 \ No newline at end of file +#define PROFILE_ITEM_COUNT 2 diff --git a/code/__HELPERS/text.dm b/code/__HELPERS/text.dm index a77f41211c1..a07b6cbf0d1 100644 --- a/code/__HELPERS/text.dm +++ b/code/__HELPERS/text.dm @@ -1,16 +1,5 @@ #define HTMLTAB "    " #define string2charlist(string) (splittext(string, regex("(.)")) - splittext(string, "")) -//Loops through every line in (text). The 'line' variable holds the current line -//Example use: -/* -var/text = {"Line 1 -Line 2 -Line 3 -"} -forLineInText(text) - world.log << line -*/ -#define forLineInText(text) for({var/__index=1;var/line=copytext(text, __index, findtext(text, "\n", __index))} ; {__index != 0} ; {__index = findtext(text, "\n", __index+1) ; line = copytext(text, __index+1, findtext(text, "\n", __index+1))}) /* * Holds procs designed to help with filtering text diff --git a/code/libs/BSQL/core/library.dm b/code/libs/BSQL/core/library.dm index 1b62cf3b6a5..79285be3d37 100644 --- a/code/libs/BSQL/core/library.dm +++ b/code/libs/BSQL/core/library.dm @@ -1,6 +1,6 @@ /world/proc/_BSQL_Internal_Call(func, ...) var/list/call_args = args.Copy(2) - BSQL_Debug("[.....]: [args[1]]([call_args.Join(", ")])") + BSQL_Debug("_BSQL_Internal_Call: [args[1]]([call_args.Join(", ")])") . = call(_BSQL_Library_Path(), func)(arglist(call_args)) BSQL_Debug("Result: [. == null ? "NULL" : "\"[.]\""]") diff --git a/code/modules/admin/verbs/debug.dm b/code/modules/admin/verbs/debug.dm index 8ffed484fa0..e2621c4d3f2 100644 --- a/code/modules/admin/verbs/debug.dm +++ b/code/modules/admin/verbs/debug.dm @@ -1377,7 +1377,7 @@ client/proc/check_convertables() set name = "Start line profiling" set desc = "Starts tracking line by line profiling for code lines that support it" - PROFILE_START + LINE_PROFILE_START message_admins("[key_name_admin(src)] started line by line profiling.") feedback_add_details("admin_verb","Start line profiling") @@ -1388,7 +1388,7 @@ client/proc/check_convertables() set name = "Stop line profiling" set desc = "Stops tracking line by line profiling for code lines that support it" - PROFILE_STOP + LINE_PROFILE_STOP message_admins("[key_name_admin(src)] stopped line by line profiling.") feedback_add_details("admin_verb","Stop line profiling") diff --git a/code/modules/clothing/masks/gasmask.dm b/code/modules/clothing/masks/gasmask.dm index fe2503b8db2..264d3308526 100644 --- a/code/modules/clothing/masks/gasmask.dm +++ b/code/modules/clothing/masks/gasmask.dm @@ -412,7 +412,7 @@ if(mask_charge >= word_cost) mask_charge -= word_cost playsound(src, "sound/vox_hecu/[words_to_say[i]]!.wav", 30) - sleep word_delay + sleep(word_delay) words_to_say.Cut() /obj/item/clothing/mask/gas/hecu/equipped(var/mob/user, var/slot) @@ -423,4 +423,4 @@ /obj/item/clothing/mask/gas/hecu/unequipped(var/mob/user, var/slot) if(slot == slot_wear_mask) on_face = 0 - ..() \ No newline at end of file + ..() diff --git a/code/modules/media/jukebox.dm b/code/modules/media/jukebox.dm index 503cd419216..a512a3c7e13 100644 --- a/code/modules/media/jukebox.dm +++ b/code/modules/media/jukebox.dm @@ -569,8 +569,7 @@ var/global/list/loopModeNames=list( var/success = 0 var/error = 0 - //Loop through each line - forLineInText(choice) + for(var/line in splittext(choice, "\n")) var/list/L = params2list(line) if(L.len >= 3) var/list/params = list() diff --git a/code/modules/projectiles/guns/projectile/revolver.dm b/code/modules/projectiles/guns/projectile/revolver.dm index 5f65c68d0de..cdcdd310da4 100644 --- a/code/modules/projectiles/guns/projectile/revolver.dm +++ b/code/modules/projectiles/guns/projectile/revolver.dm @@ -268,7 +268,7 @@ var/spin_delay = 1 SECONDS //let's not get crazy gun_flags = EMPTYCASINGS | CHAMBERSPENT -./obj/item/weapon/gun/projectile/colt/examine(mob/user) +/obj/item/weapon/gun/projectile/colt/examine(mob/user) ..() if(user.is_holding_item(src)) to_chat(user,"Alt-click to spin the gun.") diff --git a/code/modules/scripting/Parser/Expressions.dm b/code/modules/scripting/Parser/Expressions.dm index 2d4ca76adb7..dcf20eefcad 100644 --- a/code/modules/scripting/Parser/Expressions.dm +++ b/code/modules/scripting/Parser/Expressions.dm @@ -209,7 +209,7 @@ var/datum/stack/val = new src.expecting = VALUE var/loop = 0 - for() + while(TRUE) loop++ if(loop > 800) errors += new/datum/scriptError("Too many nested tokens.") @@ -327,7 +327,7 @@ NextToken() //skip open parenthesis, already found var/loops = 0 - for() + while(TRUE) loops++ if(loops >= 800) errors += new/datum/scriptError("Too many nested expressions.") @@ -368,4 +368,4 @@ */ /datum/n_Parser/nS_Parser/proc/ParseParamExpression(var/check_functions = 0) var/cf = check_functions - return ParseExpression(list(",", ")"), check_functions = cf) \ No newline at end of file + return ParseExpression(list(",", ")"), check_functions = cf) diff --git a/code/modules/scripting/Parser/Keywords.dm b/code/modules/scripting/Parser/Keywords.dm index 3054ef3ab2e..9c701236acf 100644 --- a/code/modules/scripting/Parser/Keywords.dm +++ b/code/modules/scripting/Parser/Keywords.dm @@ -174,7 +174,7 @@ var/const/Represents a special statement in the code triggered by a keyword. if(!parser.CheckToken("(", /datum/token/symbol)) return KW_FAIL - for() //for now parameters can be separated by whitespace - they don't need a comma in between + while(TRUE) //for now parameters can be separated by whitespace - they don't need a comma in between if(istype(parser.curToken, /datum/token/symbol)) switch(parser.curToken.value) if(",") diff --git a/code/modules/scripting/Parser/Parser.dm b/code/modules/scripting/Parser/Parser.dm index cdd7b647a6c..cdfe1affade 100644 --- a/code/modules/scripting/Parser/Parser.dm +++ b/code/modules/scripting/Parser/Parser.dm @@ -185,7 +185,7 @@ if(!CheckToken("(", /datum/token/symbol)) //Check for and skip open parenthesis return var/loops = 0 - for() + while(TRUE) loops++ if(loops >= 800) errors +=new/datum/scriptError("Cannot find ending params.")