Initing empty lists with GLOBAL_LIST_INIT(X, list()) is now prohibited by CI (#23247)

* moreglobals

* comment
This commit is contained in:
Contrabang
2023-11-29 12:41:01 -05:00
committed by GitHub
parent a4c0c2f40d
commit b6601ebd29
10 changed files with 75 additions and 66 deletions
+1 -1
View File
@@ -470,7 +470,7 @@
return FALSE
#define DOAFTERONCE_MAGIC "Magic~~"
GLOBAL_LIST_INIT(do_after_once_tracker, list())
GLOBAL_LIST_EMPTY(do_after_once_tracker)
/proc/do_after_once(mob/user, delay, needhand = 1, atom/target = null, progress = 1, allow_moving, must_be_held, attempt_cancel_message = "Attempt cancelled.", special_identifier)
if(!user || !target)
return
+19 -19
View File
@@ -1,31 +1,31 @@
//Preferences stuff
//Head accessory styles
GLOBAL_LIST_INIT(head_accessory_styles_list, list()) //stores /datum/sprite_accessory/head_accessory indexed by name
GLOBAL_LIST_EMPTY(head_accessory_styles_list) //stores /datum/sprite_accessory/head_accessory indexed by name
//Marking styles
GLOBAL_LIST_INIT(marking_styles_list, list()) //stores /datum/sprite_accessory/body_markings indexed by name
GLOBAL_LIST_EMPTY(marking_styles_list) //stores /datum/sprite_accessory/body_markings indexed by name
//Hairstyles
GLOBAL_LIST_INIT(hair_styles_public_list, list()) //stores /datum/sprite_accessory/hair indexed by name
GLOBAL_LIST_INIT(hair_styles_male_list, list())
GLOBAL_LIST_INIT(hair_styles_female_list, list())
GLOBAL_LIST_INIT(hair_styles_full_list, list()) //fluff hair styles
GLOBAL_LIST_INIT(facial_hair_styles_list, list()) //stores /datum/sprite_accessory/facial_hair indexed by name
GLOBAL_LIST_INIT(facial_hair_styles_male_list, list())
GLOBAL_LIST_INIT(facial_hair_styles_female_list, list())
GLOBAL_LIST_EMPTY(hair_styles_public_list) //stores /datum/sprite_accessory/hair indexed by name
GLOBAL_LIST_EMPTY(hair_styles_male_list)
GLOBAL_LIST_EMPTY(hair_styles_female_list)
GLOBAL_LIST_EMPTY(hair_styles_full_list) //fluff hair styles
GLOBAL_LIST_EMPTY(facial_hair_styles_list) //stores /datum/sprite_accessory/facial_hair indexed by name
GLOBAL_LIST_EMPTY(facial_hair_styles_male_list)
GLOBAL_LIST_EMPTY(facial_hair_styles_female_list)
GLOBAL_LIST_EMPTY(hair_gradients_list) //stores /datum/sprite_accessory/hair_gradient indexed by name
//Underwear
GLOBAL_LIST_INIT(underwear_list, list()) //stores /datum/sprite_accessory/underwear indexed by name
GLOBAL_LIST_INIT(underwear_m, list()) //stores only underwear name
GLOBAL_LIST_INIT(underwear_f, list()) //stores only underwear name
GLOBAL_LIST_EMPTY(underwear_list) //stores /datum/sprite_accessory/underwear indexed by name
GLOBAL_LIST_EMPTY(underwear_m) //stores only underwear name
GLOBAL_LIST_EMPTY(underwear_f) //stores only underwear name
//Undershirts
GLOBAL_LIST_INIT(undershirt_list, list()) //stores /datum/sprite_accessory/undershirt indexed by name
GLOBAL_LIST_INIT(undershirt_m, list()) //stores only undershirt name
GLOBAL_LIST_INIT(undershirt_f, list()) //stores only undershirt name
GLOBAL_LIST_EMPTY(undershirt_list) //stores /datum/sprite_accessory/undershirt indexed by name
GLOBAL_LIST_EMPTY(undershirt_m) //stores only undershirt name
GLOBAL_LIST_EMPTY(undershirt_f) //stores only undershirt name
//Socks
GLOBAL_LIST_INIT(socks_list, list()) //stores /datum/sprite_accessory/socks indexed by name
GLOBAL_LIST_INIT(socks_m, list()) //stores only socks name
GLOBAL_LIST_INIT(socks_f, list()) //stores only socks name
GLOBAL_LIST_EMPTY(socks_list) //stores /datum/sprite_accessory/socks indexed by name
GLOBAL_LIST_EMPTY(socks_m) //stores only socks name
GLOBAL_LIST_EMPTY(socks_f) //stores only socks name
//Alt Heads
GLOBAL_LIST_INIT(alt_heads_list, list()) //stores /datum/sprite_accessory/alt_heads indexed by name
GLOBAL_LIST_EMPTY(alt_heads_list) //stores /datum/sprite_accessory/alt_heads indexed by name
GLOBAL_LIST_INIT(scarySounds, list('sound/weapons/thudswoosh.ogg','sound/weapons/taser.ogg','sound/weapons/armbomb.ogg','sound/voice/hiss1.ogg','sound/voice/hiss2.ogg', \
'sound/voice/hiss3.ogg','sound/voice/hiss4.ogg','sound/voice/hiss5.ogg','sound/voice/hiss6.ogg','sound/effects/glassbr1.ogg','sound/effects/glassbr2.ogg','sound/effects/glassbr3.ogg', \
+1 -1
View File
@@ -38,7 +38,7 @@ GLOBAL_LIST_INIT(restricted_camera_networks, list(
"SyndicateCaves"
)) //Those networks can only be accessed by preexisting terminals. AIs and new terminals can't use them.
GLOBAL_LIST_INIT(ruin_landmarks, list())
GLOBAL_LIST_EMPTY(ruin_landmarks)
GLOBAL_LIST_INIT(round_end_sounds, list(
'sound/AI/newroundsexy.ogg' = 2.3 SECONDS,
+38 -38
View File
@@ -1,53 +1,53 @@
GLOBAL_LIST_INIT(portals, list()) //for use by portals
GLOBAL_LIST_EMPTY(portals) //for use by portals
GLOBAL_LIST(cable_list) //Index for all cables, so that powernets don't have to look through the entire world all the time
GLOBAL_LIST(chemical_reactions_list) //list of all /datum/chemical_reaction datums. Used during chemical reactions
GLOBAL_LIST(chemical_reagents_list) //list of all /datum/reagent datums indexed by reagent id. Used by chemistry stuff
GLOBAL_LIST_INIT(landmarks_list, list()) //list of all landmarks created
GLOBAL_LIST_INIT(surgery_steps, list()) //list of all surgery steps |BS12
GLOBAL_LIST_INIT(side_effects, list()) //list of all medical sideeffects types by thier names |BS12
GLOBAL_LIST_INIT(mechas_list, list()) //list of all mechs. Used by hostile mobs target tracking.
GLOBAL_LIST_INIT(joblist, list()) //list of all jobstypes, minus borg and AI
GLOBAL_LIST_INIT(airlocks, list()) //list of all airlocks
GLOBAL_LIST_INIT(singularities, list()) //list of all singularities
GLOBAL_LIST_INIT(janitorial_equipment, list()) //list of janitorial equipment
GLOBAL_LIST_INIT(crafting_recipes, list()) //list of all crafting recipes
GLOBAL_LIST_INIT(prisoncomputer_list, list())
GLOBAL_LIST_INIT(celltimers_list, list()) // list of all cell timers
GLOBAL_LIST_INIT(cell_logs, list())
GLOBAL_LIST_INIT(navigation_computers, list())
GLOBAL_LIST_INIT(hierophant_walls, list())
GLOBAL_LIST_EMPTY(landmarks_list) //list of all landmarks created
GLOBAL_LIST_EMPTY(surgery_steps) //list of all surgery steps |BS12
GLOBAL_LIST_EMPTY(side_effects) //list of all medical sideeffects types by thier names |BS12
GLOBAL_LIST_EMPTY(mechas_list) //list of all mechs. Used by hostile mobs target tracking.
GLOBAL_LIST_EMPTY(joblist) //list of all jobstypes, minus borg and AI
GLOBAL_LIST_EMPTY(airlocks) //list of all airlocks
GLOBAL_LIST_EMPTY(singularities) //list of all singularities
GLOBAL_LIST_EMPTY(janitorial_equipment) //list of janitorial equipment
GLOBAL_LIST_EMPTY(crafting_recipes) //list of all crafting recipes
GLOBAL_LIST_EMPTY(prisoncomputer_list)
GLOBAL_LIST_EMPTY(celltimers_list) // list of all cell timers
GLOBAL_LIST_EMPTY(cell_logs)
GLOBAL_LIST_EMPTY(navigation_computers)
GLOBAL_LIST_EMPTY(hierophant_walls)
GLOBAL_LIST_INIT(all_areas, list())
GLOBAL_LIST_INIT(all_unique_areas, list()) // List of all unique areas. AKA areas with there_can_be_many = FALSE
GLOBAL_LIST_INIT(machines, list())
GLOBAL_LIST_INIT(rcd_list, list()) //list of Rapid Construction Devices.
GLOBAL_LIST_EMPTY(all_areas)
GLOBAL_LIST_EMPTY(all_unique_areas) // List of all unique areas. AKA areas with there_can_be_many = FALSE
GLOBAL_LIST_EMPTY(machines)
GLOBAL_LIST_EMPTY(rcd_list) //list of Rapid Construction Devices.
GLOBAL_LIST_INIT(apcs, list())
GLOBAL_LIST_INIT(air_alarms, list())
GLOBAL_LIST_INIT(power_monitors, list())
GLOBAL_LIST_INIT(all_vent_pumps, list())
GLOBAL_LIST_EMPTY(apcs)
GLOBAL_LIST_EMPTY(air_alarms)
GLOBAL_LIST_EMPTY(power_monitors)
GLOBAL_LIST_EMPTY(all_vent_pumps)
GLOBAL_LIST_INIT(navbeacons, list()) //list of all bot nagivation beacons, used for patrolling.
GLOBAL_LIST_INIT(deliverybeacons, list()) //list of all MULEbot delivery beacons.
GLOBAL_LIST_INIT(deliverybeacontags, list()) //list of all tags associated with delivery beacons.
GLOBAL_LIST_EMPTY(navbeacons) //list of all bot nagivation beacons, used for patrolling.
GLOBAL_LIST_EMPTY(deliverybeacons) //list of all MULEbot delivery beacons.
GLOBAL_LIST_EMPTY(deliverybeacontags) //list of all tags associated with delivery beacons.
GLOBAL_LIST_INIT(beacons, list())
GLOBAL_LIST_INIT(shuttle_caller_list, list()) //list of all communication consoles, comms consoles circuit and AIs, for automatic shuttle calls when there are none.
GLOBAL_LIST_INIT(tracked_implants, list()) //list of all current implants that are tracked to work out what sort of trek everyone is on. Sadly not on lavaworld not implemented...
GLOBAL_LIST_INIT(pinpointer_list, list()) //list of all pinpointers. Used to change stuff they are pointing to all at once.
GLOBAL_LIST_INIT(nuclear_uplink_list, list()) //list of all existing nuke ops uplinks
GLOBAL_LIST_INIT(abductor_equipment, list()) //list of all abductor equipment
GLOBAL_LIST_INIT(global_intercoms, list()) //list of all intercomms, across all z-levels
GLOBAL_LIST_INIT(global_radios, list()) //list of all radios, across all z-levels
GLOBAL_LIST_EMPTY(beacons)
GLOBAL_LIST_EMPTY(shuttle_caller_list) //list of all communication consoles, comms consoles circuit and AIs, for automatic shuttle calls when there are none.
GLOBAL_LIST_EMPTY(tracked_implants) //list of all current implants that are tracked to work out what sort of trek everyone is on. Sadly not on lavaworld not implemented...
GLOBAL_LIST_EMPTY(pinpointer_list) //list of all pinpointers. Used to change stuff they are pointing to all at once.
GLOBAL_LIST_EMPTY(nuclear_uplink_list) //list of all existing nuke ops uplinks
GLOBAL_LIST_EMPTY(abductor_equipment) //list of all abductor equipment
GLOBAL_LIST_EMPTY(global_intercoms) //list of all intercomms, across all z-levels
GLOBAL_LIST_EMPTY(global_radios) //list of all radios, across all z-levels
GLOBAL_LIST_INIT(meteor_list, list()) //list of all meteors
GLOBAL_LIST_INIT(poi_list, list()) //list of points of interest for observe/follow
GLOBAL_LIST_INIT(active_jammers, list()) // List of active radio jammers
GLOBAL_LIST_EMPTY(meteor_list) //list of all meteors
GLOBAL_LIST_EMPTY(poi_list) //list of points of interest for observe/follow
GLOBAL_LIST_EMPTY(active_jammers) // List of active radio jammers
GLOBAL_LIST_EMPTY(ladders)
GLOBAL_LIST_EMPTY(mirrors) //list of all mirrors and mirror shields.
GLOBAL_LIST_EMPTY(arc_emitters) //list of all arc emitters
GLOBAL_LIST_INIT(active_diseases, list()) //List of Active disease in all mobs; purely for quick referencing.
GLOBAL_LIST_EMPTY(active_diseases) //List of Active disease in all mobs; purely for quick referencing.
GLOBAL_LIST_EMPTY(mob_spawners) // All mob_spawn objects
GLOBAL_LIST_EMPTY(explosive_walls)
@@ -23,7 +23,7 @@
/obj/structure/spawner/lavaland/legion
mob_types = list(/mob/living/simple_animal/hostile/asteroid/hivelord/legion/tendril)
GLOBAL_LIST_INIT(tendrils, list())
GLOBAL_LIST_EMPTY(tendrils)
/obj/structure/spawner/lavaland/Initialize(mapload)
. = ..()
+2 -2
View File
@@ -1,4 +1,4 @@
GLOBAL_LIST_INIT(open_logging_views, list())
GLOBAL_LIST_EMPTY(open_logging_views)
/client/proc/cmd_admin_open_logging_view()
set category = "Admin"
@@ -18,4 +18,4 @@ GLOBAL_LIST_INIT(open_logging_views, list())
cur_view.add_mobs(mobs_to_add)
cur_view.show_ui(usr)
@@ -1,6 +1,6 @@
GLOBAL_LIST_INIT(body_accessory_by_name, list("None" = null))
GLOBAL_LIST_INIT(body_accessory_by_species, list())
GLOBAL_LIST_EMPTY(body_accessory_by_species)
/proc/initialize_body_accessory_by_species()
for(var/B in GLOB.body_accessory_by_name)
@@ -18,7 +18,7 @@ field_generator power level display
#define FG_CHARGING 1
#define FG_ONLINE 2
GLOBAL_LIST_INIT(field_generator_fields, list())
GLOBAL_LIST_EMPTY(field_generator_fields)
/obj/machinery/field/generator
name = "Field Generator"
+2 -2
View File
@@ -3,8 +3,8 @@
#define DIRECTION_REVERSED -1
#define IS_OPERATING (operating && can_conveyor_run())
GLOBAL_LIST_INIT(conveyor_belts, list()) //Saves us having to look through the entire machines list for our things
GLOBAL_LIST_INIT(conveyor_switches, list())
GLOBAL_LIST_EMPTY(conveyor_belts) //Saves us having to look through the entire machines list for our things
GLOBAL_LIST_EMPTY(conveyor_switches)
//conveyor2 is pretty much like the original, except it supports corners, but not diverters.
//Except this is pretty heavily modified so it's more like conveyor2.5
+9
View File
@@ -118,6 +118,15 @@ def check_conditional_spacing(lines):
if CONDITIONAL_INFIX_NOT_SPACE.search(line):
return Failure(idx + 1, "Found a conditional statement matching the format \"if(! thing)\", please use \"if(!thing)\" instead.")
# makes sure that no global list inits have an empty list in them without using the helper
GLOBAL_LIST_EMPTY = re.compile(r"(?<!#define GLOBAL_LIST_EMPTY\(X\) )GLOBAL_LIST_INIT([^,]+),.{0,5}list\(\)")
# This uses a negative look behind to make sure its not the global list definition
# An easy regex replacement for this is GLOBAL_LIST_EMPTY$1
def check_global_list_empty(lines):
for idx, line in enumerate(lines):
if GLOBAL_LIST_EMPTY.search(line):
return Failure(idx + 1, "Found a GLOBAL_LIST_INIT(_, list()), please use GLOBAL_LIST_EMPTY(_) instead.")
CODE_CHECKS = [
check_space_indentation,
check_mixed_indentation,