Add return type annotations to some procs, other lint fixes

This commit is contained in:
oranges
2019-07-03 19:31:11 +12:00
committed by Ling
parent 3e8de658a4
commit 56e5dbb7b1
20 changed files with 51 additions and 23 deletions

View File

@@ -41,6 +41,12 @@
//Create a list global that is initialized as an empty list //Create a list global that is initialized as an empty list
#define GLOBAL_LIST_EMPTY(X) GLOBAL_LIST_INIT(X, list()) #define GLOBAL_LIST_EMPTY(X) GLOBAL_LIST_INIT(X, list())
// Create a typed list global with an initializer expression
#define GLOBAL_LIST_INIT_TYPED(X, Typepath, InitValue) GLOBAL_RAW(/list##Typepath/X); GLOBAL_MANAGED(X, InitValue)
// Create a typed list global that is initialized as an empty list
#define GLOBAL_LIST_EMPTY_TYPED(X, Typepath) GLOBAL_LIST_INIT_TYPED(X, Typepath, list())
//Create a typed global with an initializer expression //Create a typed global with an initializer expression
#define GLOBAL_DATUM_INIT(X, Typepath, InitValue) GLOBAL_RAW(Typepath/##X); GLOBAL_MANAGED(X, InitValue) #define GLOBAL_DATUM_INIT(X, Typepath, InitValue) GLOBAL_RAW(Typepath/##X); GLOBAL_MANAGED(X, InitValue)

View File

@@ -0,0 +1,13 @@
// Interfaces for the SpacemanDMM linter, define'd to nothing when the linter
// is not in use.
// The SPACEMAN_DMM define is set by the linter and other tooling when it runs.
#ifdef SPACEMAN_DMM
#define RETURN_TYPE(X) set SpacemanDMM_return_type = X
#define SHOULD_CALL_PARENT(X) set SpacemanDMM_should_call_parent = X
#define UNLINT(X) SpacemanDMM_unlint(X)
#else
#define RETURN_TYPE(X)
#define SHOULD_CALL_PARENT(X)
#define UNLINT(X) X
#endif

View File

@@ -124,6 +124,7 @@
//returns a new list with only atoms that are in typecache L //returns a new list with only atoms that are in typecache L
/proc/typecache_filter_list(list/atoms, list/typecache) /proc/typecache_filter_list(list/atoms, list/typecache)
RETURN_TYPE(/list)
. = list() . = list()
for(var/thing in atoms) for(var/thing in atoms)
var/atom/A = thing var/atom/A = thing
@@ -131,6 +132,7 @@
. += A . += A
/proc/typecache_filter_list_reverse(list/atoms, list/typecache) /proc/typecache_filter_list_reverse(list/atoms, list/typecache)
RETURN_TYPE(/list)
. = list() . = list()
for(var/thing in atoms) for(var/thing in atoms)
var/atom/A = thing var/atom/A = thing
@@ -257,6 +259,7 @@
//Pick a random element from the list and remove it from the list. //Pick a random element from the list and remove it from the list.
/proc/pick_n_take(list/L) /proc/pick_n_take(list/L)
RETURN_TYPE(L[_].type)
if(L.len) if(L.len)
var/picked = rand(1,L.len) var/picked = rand(1,L.len)
. = L[picked] . = L[picked]

View File

@@ -7,7 +7,7 @@
#define WRITE_LOG(log, text) rustg_log_write(log, text) #define WRITE_LOG(log, text) rustg_log_write(log, text)
//print a warning message to world.log //print a warning message to world.log
#define WARNING(MSG) warning("[MSG] in [__FILE__] at line [__LINE__] src: [src] usr: [usr].") #define WARNING(MSG) warning("[MSG] in [__FILE__] at line [__LINE__] src: [UNLINT(src)] usr: [usr].")
/proc/warning(msg) /proc/warning(msg)
msg = "## WARNING: [msg]" msg = "## WARNING: [msg]"
log_world(msg) log_world(msg)

View File

@@ -1,5 +1,5 @@
//faster than having to constantly loop for them //faster than having to constantly loop for them
GLOBAL_LIST_EMPTY(all_mutations) //type = initialized mutation GLOBAL_LIST_EMPTY_TYPED(all_mutations, /datum/mutation/human) //type = initialized mutation
GLOBAL_LIST_EMPTY(full_sequences) //type = correct sequence GLOBAL_LIST_EMPTY(full_sequences) //type = correct sequence
GLOBAL_LIST_EMPTY(bad_mutations) //bad initialized mutations GLOBAL_LIST_EMPTY(bad_mutations) //bad initialized mutations
GLOBAL_LIST_EMPTY(good_mutations) //good initialized mutations GLOBAL_LIST_EMPTY(good_mutations) //good initialized mutations

View File

@@ -47,6 +47,6 @@ GLOBAL_LIST_EMPTY(vr_spawnpoints)
//used by jump-to-area etc. Updated by area/updateName() //used by jump-to-area etc. Updated by area/updateName()
GLOBAL_LIST_EMPTY(sortedAreas) GLOBAL_LIST_EMPTY(sortedAreas)
/// An association from typepath to area instance. Only includes areas with `unique` set. /// An association from typepath to area instance. Only includes areas with `unique` set.
GLOBAL_LIST_EMPTY(areas_by_type) GLOBAL_LIST_EMPTY_TYPED(areas_by_type, /area)
GLOBAL_LIST_EMPTY(all_abstract_markers) GLOBAL_LIST_EMPTY(all_abstract_markers)

View File

@@ -4,7 +4,7 @@ SUBSYSTEM_DEF(job)
flags = SS_NO_FIRE flags = SS_NO_FIRE
var/list/occupations = list() //List of all jobs var/list/occupations = list() //List of all jobs
var/list/name_occupations = list() //Dict of all jobs, keys are titles var/list/datum/job/name_occupations = list() //Dict of all jobs, keys are titles
var/list/type_occupations = list() //Dict of all jobs, keys are types var/list/type_occupations = list() //Dict of all jobs, keys are types
var/list/unassigned = list() //Players who need jobs var/list/unassigned = list() //Players who need jobs
var/initial_players_to_assign = 0 //used for checking against population caps var/initial_players_to_assign = 0 //used for checking against population caps

View File

@@ -184,6 +184,7 @@
// The type arg is casted so initial works, you shouldn't be passing a real instance into this // The type arg is casted so initial works, you shouldn't be passing a real instance into this
/datum/proc/GetComponent(datum/component/c_type) /datum/proc/GetComponent(datum/component/c_type)
RETURN_TYPE(c_type)
if(initial(c_type.dupe_mode) == COMPONENT_DUPE_ALLOWED) if(initial(c_type.dupe_mode) == COMPONENT_DUPE_ALLOWED)
stack_trace("GetComponent was called to get a component of which multiple copies could be on an object. This can easily break and should be changed. Type: \[[c_type]\]") stack_trace("GetComponent was called to get a component of which multiple copies could be on an object. This can easily break and should be changed. Type: \[[c_type]\]")
var/list/dc = datum_components var/list/dc = datum_components

View File

@@ -299,7 +299,7 @@
Deletion.Cut(Deletion.len) Deletion.Cut(Deletion.len)
qdel(DL) qdel(DL)
/datum/component/personal_crafting/proc/component_ui_interact(obj/screen/crafting/image, location, control, params, user) /datum/component/personal_crafting/proc/component_ui_interact(obj/screen/craft/image, location, control, params, user)
if(user == parent) if(user == parent)
ui_interact(user) ui_interact(user)

View File

@@ -657,14 +657,14 @@ Code:
if("botlist") if("botlist")
active_bot = null active_bot = null
if("summon") //Args are in the correct order, they are stated here just as an easy reminder. if("summon") //Args are in the correct order, they are stated here just as an easy reminder.
active_bot.bot_control(command= "summon", user_turf= get_turf(usr), user_access= host_pda.GetAccess()) active_bot.bot_control("summon", usr, host_pda.GetAccess())
else //Forward all other bot commands to the bot itself! else //Forward all other bot commands to the bot itself!
active_bot.bot_control(command= href_list["op"], user= usr) active_bot.bot_control(href_list["op"], usr)
if(href_list["mule"]) //MULEbots are special snowflakes, and need different args due to how they work. if(href_list["mule"]) //MULEbots are special snowflakes, and need different args due to how they work.
var/mob/living/simple_animal/bot/mulebot/mule = active_bot var/mob/living/simple_animal/bot/mulebot/mule = active_bot
if (istype(mule)) if (istype(mule))
mule.bot_control(command=href_list["mule"], user=usr, pda=TRUE) mule.bot_control(href_list["mule"], usr, pda=TRUE)
if(!host_pda) if(!host_pda)
return return

View File

@@ -238,6 +238,7 @@
return ..() return ..()
/obj/structure/blob/proc/chemeffectreport(mob/user) /obj/structure/blob/proc/chemeffectreport(mob/user)
RETURN_TYPE(/list)
. = list() . = list()
if(overmind) if(overmind)
. += list("<b>Material: <font color=\"[overmind.blobstrain.color]\">[overmind.blobstrain.name]</font><span class='notice'>.</span></b>", . += list("<b>Material: <font color=\"[overmind.blobstrain.color]\">[overmind.blobstrain.name]</font><span class='notice'>.</span></b>",
@@ -247,11 +248,11 @@
. += "<b>No Material Detected!</b>" . += "<b>No Material Detected!</b>"
/obj/structure/blob/proc/typereport(mob/user) /obj/structure/blob/proc/typereport(mob/user)
RETURN_TYPE(/list)
return list("<b>Blob Type:</b> <span class='notice'>[uppertext(initial(name))]</span>", return list("<b>Blob Type:</b> <span class='notice'>[uppertext(initial(name))]</span>",
"<b>Health:</b> <span class='notice'>[obj_integrity]/[max_integrity]</span>", "<b>Health:</b> <span class='notice'>[obj_integrity]/[max_integrity]</span>",
"<b>Effects:</b> <span class='notice'>[scannerreport()]</span>") "<b>Effects:</b> <span class='notice'>[scannerreport()]</span>")
/obj/structure/blob/attack_animal(mob/living/simple_animal/M) /obj/structure/blob/attack_animal(mob/living/simple_animal/M)
if(ROLE_BLOB in M.faction) //sorry, but you can't kill the blob as a blobbernaut if(ROLE_BLOB in M.faction) //sorry, but you can't kill the blob as a blobbernaut
return return

View File

@@ -14,7 +14,7 @@
var/should_equip = TRUE var/should_equip = TRUE
var/traitor_kind = TRAITOR_HUMAN //Set on initial assignment var/traitor_kind = TRAITOR_HUMAN //Set on initial assignment
var/datum/syndicate_contract/current_contract var/datum/syndicate_contract/current_contract
var/list/assigned_contracts = list() var/list/datum/syndicate_contract/assigned_contracts = list()
var/contract_TC_payed_out = 0 var/contract_TC_payed_out = 0
var/contract_TC_to_redeem = 0 var/contract_TC_to_redeem = 0
can_hijack = HIJACK_HIJACKER can_hijack = HIJACK_HIJACKER

View File

@@ -72,11 +72,13 @@
air.copy_from(copy) air.copy_from(copy)
/turf/return_air() /turf/return_air()
RETURN_TYPE(/datum/gas_mixture)
var/datum/gas_mixture/GM = new var/datum/gas_mixture/GM = new
GM.copy_from_turf(src) GM.copy_from_turf(src)
return GM return GM
/turf/open/return_air() /turf/open/return_air()
RETURN_TYPE(/datum/gas_mixture)
return air return air
/turf/temperature_expose() /turf/temperature_expose()

View File

@@ -5,6 +5,7 @@ GLOBAL_LIST_INIT(duplicate_forbidden_vars,list(
)) ))
/proc/DuplicateObject(atom/original, perfectcopy = TRUE, sameloc, atom/newloc = null, nerf, holoitem) /proc/DuplicateObject(atom/original, perfectcopy = TRUE, sameloc, atom/newloc = null, nerf, holoitem)
RETURN_TYPE(original.type)
if(!original) if(!original)
return return
var/atom/O var/atom/O

View File

@@ -152,6 +152,7 @@
return . return .
/mob/living/carbon/human/proc/get_bank_account() /mob/living/carbon/human/proc/get_bank_account()
RETURN_TYPE(/datum/bank_account)
var/datum/bank_account/account var/datum/bank_account/account
var/obj/item/card/id/I = get_idcard() var/obj/item/card/id/I = get_idcard()

View File

@@ -833,7 +833,7 @@
/mob/living/silicon/ai/can_buckle() /mob/living/silicon/ai/can_buckle()
return 0 return 0
/mob/living/silicon/ai/incapacitated(ignore_restraints = FALSE, ignore_grab = FALSE, check_immobilized = FALSE) /mob/living/silicon/ai/incapacitated(ignore_restraints = FALSE, ignore_grab = FALSE, check_immobilized = FALSE, ignore_stasis = FALSE)
if(aiRestorePowerRoutine) if(aiRestorePowerRoutine)
return TRUE return TRUE
return ..() return ..()

View File

@@ -672,11 +672,11 @@ Pass a positive integer as an argument to override a bot's default speed.
destination = nearest_beacon destination = nearest_beacon
//PDA control. Some bots, especially MULEs, may have more parameters. //PDA control. Some bots, especially MULEs, may have more parameters.
/mob/living/simple_animal/bot/proc/bot_control(command, mob/user, turf/user_turf, list/user_access = list()) /mob/living/simple_animal/bot/proc/bot_control(command, mob/user, list/user_access = list())
if(!on || emagged == 2 || remote_disabled) //Emagged bots do not respect anyone's authority! Bots with their remote controls off cannot get commands. if(!on || emagged == 2 || remote_disabled) //Emagged bots do not respect anyone's authority! Bots with their remote controls off cannot get commands.
return TRUE //ACCESS DENIED return TRUE //ACCESS DENIED
if(client) if(client)
bot_control_message(command,user,user_turf,user_access) bot_control_message(command, user)
// process control input // process control input
switch(command) switch(command)
if("patroloff") if("patroloff")
@@ -688,7 +688,7 @@ Pass a positive integer as an argument to override a bot's default speed.
if("summon") if("summon")
bot_reset() bot_reset()
summon_target = user_turf summon_target = get_turf(user)
if(user_access.len != 0) if(user_access.len != 0)
access_card.access = user_access + prev_access //Adds the user's access, if any. access_card.access = user_access + prev_access //Adds the user's access, if any.
mode = BOT_SUMMON mode = BOT_SUMMON
@@ -700,15 +700,14 @@ Pass a positive integer as an argument to override a bot's default speed.
return return
// //
/mob/living/simple_animal/bot/proc/bot_control_message(command,user,user_turf,user_access) /mob/living/simple_animal/bot/proc/bot_control_message(command, user)
switch(command) switch(command)
if("patroloff") if("patroloff")
to_chat(src, "<span class='warning big'>STOP PATROL</span>") to_chat(src, "<span class='warning big'>STOP PATROL</span>")
if("patrolon") if("patrolon")
to_chat(src, "<span class='warning big'>START PATROL</span>") to_chat(src, "<span class='warning big'>START PATROL</span>")
if("summon") if("summon")
var/area/a = get_area(user_turf) to_chat(src, "<span class='warning big'>PRIORITY ALERT:[user] in [get_area_name(user)]!</span>")
to_chat(src, "<span class='warning big'>PRIORITY ALERT:[user] in [a.name]!</span>")
if("stop") if("stop")
to_chat(src, "<span class='warning big'>STOP!</span>") to_chat(src, "<span class='warning big'>STOP!</span>")

View File

@@ -15,7 +15,7 @@
var/setting = 1 // displayed range is 3 * setting var/setting = 1 // displayed range is 3 * setting
var/max_range = 3 // displayed max range is 3 * max range var/max_range = 3 // displayed max range is 3 * max range
/datum/effect_system/smoke_spread/chem/smoke_machine/set_up(datum/reagents/carry, setting=1, efficiency=10, loc) /datum/effect_system/smoke_spread/chem/smoke_machine/set_up(datum/reagents/carry, setting=1, efficiency=10, loc, silent=FALSE)
amount = setting amount = setting
carry.copy_to(chemholder, 20) carry.copy_to(chemholder, 20)
carry.remove_any(amount * 16 / efficiency) carry.remove_any(amount * 16 / efficiency)

View File

@@ -79,7 +79,7 @@ GLOBAL_LIST_INIT(blacklisted_cargo_types, typecacheof(list(
sell() sell()
/obj/docking_port/mobile/supply/proc/buy() /obj/docking_port/mobile/supply/proc/buy()
var/list/miscboxes = list() //miscboxes are combo boxes that contain all small_item orders grouped var/list/obj/miscboxes = list() //miscboxes are combo boxes that contain all small_item orders grouped
var/list/misc_order_num = list() //list of strings of order numbers, so that the manifest can show all orders in a box var/list/misc_order_num = list() //list of strings of order numbers, so that the manifest can show all orders in a box
var/list/misc_contents = list() //list of lists of items that each box will contain var/list/misc_contents = list() //list of lists of items that each box will contain
if(!SSshuttle.shoppinglist.len) if(!SSshuttle.shoppinglist.len)

View File

@@ -61,6 +61,7 @@
.++ .++
/obj/vehicle/proc/return_controllers_with_flag(flag) /obj/vehicle/proc/return_controllers_with_flag(flag)
RETURN_TYPE(/list/mob)
. = list() . = list()
for(var/i in occupants) for(var/i in occupants)
if(occupants[i] & flag) if(occupants[i] & flag)