Skip to content

Commit

Permalink
Linter Introduction + Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Neerti authored and VirgoBot committed May 26, 2021
1 parent 6e257dc commit 767e655
Show file tree
Hide file tree
Showing 191 changed files with 3,753 additions and 609 deletions.
3 changes: 3 additions & 0 deletions SpacemanDMM.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@ macro_redefined = "off"
macro_undefined_no_definition = "off"
as_local_var = "off"
tmp_no_effect = "off"

[langserver]
dreamchecker = true
2 changes: 1 addition & 1 deletion code/ATMOSPHERICS/atmospherics.dm
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ Pipelines + Other Objects -> Pipe network
/obj/machinery/atmospherics/proc/reassign_network(datum/pipe_network/old_network, datum/pipe_network/new_network)
// Used when two pipe_networks are combining

/obj/machinery/atmospherics/proc/return_network_air(datum/network/reference)
/obj/machinery/atmospherics/proc/return_network_air(datum/pipe_network/reference)
// Return a list of gas_mixture(s) in the object
// associated with reference pipe_network for use in rebuilding the networks gases list
// Is permitted to return null
Expand Down
4 changes: 2 additions & 2 deletions code/ATMOSPHERICS/components/binary_devices/passive_gate.dm
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@
radio_controller.remove_object(src, frequency)
frequency = new_frequency
if(frequency)
radio_connection = radio_controller.add_object(src, frequency, filter = RADIO_ATMOSIA)
radio_connection = radio_controller.add_object(src, frequency, radio_filter = RADIO_ATMOSIA)

/obj/machinery/atmospherics/binary/passive_gate/proc/broadcast_status()
if(!radio_connection)
Expand All @@ -165,7 +165,7 @@
"sigtype" = "status"
)

radio_connection.post_signal(src, signal, filter = RADIO_ATMOSIA)
radio_connection.post_signal(src, signal, radio_filter = RADIO_ATMOSIA)

return 1

Expand Down
4 changes: 2 additions & 2 deletions code/ATMOSPHERICS/components/binary_devices/pump.dm
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ Thus, the two variables affect pump operation are set in New():
radio_controller.remove_object(src, frequency)
frequency = new_frequency
if(frequency)
radio_connection = radio_controller.add_object(src, frequency, filter = RADIO_ATMOSIA)
radio_connection = radio_controller.add_object(src, frequency, radio_filter = RADIO_ATMOSIA)

/obj/machinery/atmospherics/binary/pump/proc/broadcast_status()
if(!radio_connection)
Expand All @@ -139,7 +139,7 @@ Thus, the two variables affect pump operation are set in New():
"sigtype" = "status"
)

radio_connection.post_signal(src, signal, filter = RADIO_ATMOSIA)
radio_connection.post_signal(src, signal, radio_filter = RADIO_ATMOSIA)

return 1

Expand Down
2 changes: 1 addition & 1 deletion code/ATMOSPHERICS/components/shutoff.dm
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ GLOBAL_LIST_EMPTY(shutoff_valves)

// Breadth-first search for any leaking pipes that we can directly see
/obj/machinery/atmospherics/valve/shutoff/proc/find_leaks()
var/obj/machinery/atmospherics/list/search = list()
var/list/obj/machinery/atmospherics/search = list()

// We're the leak!
if(!node1 || !node2)
Expand Down
2 changes: 1 addition & 1 deletion code/ATMOSPHERICS/components/tvalve.dm
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@

return 1

/obj/machinery/atmospherics/tvalve/return_network_air(datum/network/reference)
/obj/machinery/atmospherics/tvalve/return_network_air(datum/pipe_network/reference)
return null

/obj/machinery/atmospherics/tvalve/disconnect(obj/machinery/atmospherics/reference)
Expand Down
2 changes: 1 addition & 1 deletion code/ATMOSPHERICS/components/valve.dm
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@

return 1

/obj/machinery/atmospherics/valve/return_network_air(datum/network/reference)
/obj/machinery/atmospherics/valve/return_network_air(datum/pipe_network/reference)
return null

/obj/machinery/atmospherics/valve/disconnect(obj/machinery/atmospherics/reference)
Expand Down
1 change: 0 additions & 1 deletion code/ATMOSPHERICS/mainspipe.dm
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ obj/machinery/atmospherics/mains_pipe
update_icon()

proc/burst()
..()
for(var/obj/machinery/atmospherics/pipe/mains_component/pipe in contents)
burst()

Expand Down
31 changes: 31 additions & 0 deletions code/__defines/spaceman_dmm.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// 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)
#define SHOULD_NOT_OVERRIDE(X) set SpacemanDMM_should_not_override = X
#define SHOULD_NOT_SLEEP(X) set SpacemanDMM_should_not_sleep = X
#define SHOULD_BE_PURE(X) set SpacemanDMM_should_be_pure = X
#define PRIVATE_PROC(X) set SpacemanDMM_private_proc = X
#define PROTECTED_PROC(X) set SpacemanDMM_protected_proc = X
#define CAN_BE_REDEFINED(X) set SpacemanDMM_can_be_redefined = X
#define VAR_FINAL var/SpacemanDMM_final
#define VAR_PRIVATE var/SpacemanDMM_private
#define VAR_PROTECTED var/SpacemanDMM_protected
#else
#define RETURN_TYPE(X)
#define SHOULD_CALL_PARENT(X)
#define UNLINT(X) X
#define SHOULD_NOT_OVERRIDE(X)
#define SHOULD_NOT_SLEEP(X)
#define SHOULD_BE_PURE(X)
#define PRIVATE_PROC(X)
#define PROTECTED_PROC(X)
#define CAN_BE_REDEFINED(X)
#define VAR_FINAL var
#define VAR_PRIVATE var
#define VAR_PROTECTED var
#endif
4 changes: 2 additions & 2 deletions code/__defines/subsystems.dm
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ var/global/list/runlevel_flags = list(RUNLEVEL_LOBBY, RUNLEVEL_SETUP, RUNLEVEL_G
// Macro defining the actual code applying our overlays lists to the BYOND overlays list. (I guess a macro for speed)
// TODO - I don't really like the location of this macro define. Consider it. ~Leshana
#define COMPILE_OVERLAYS(A)\
if (TRUE) {\
do {\
var/list/oo = A.our_overlays;\
var/list/po = A.priority_overlays;\
if(LAZYLEN(po)){\
Expand All @@ -129,4 +129,4 @@ var/global/list/runlevel_flags = list(RUNLEVEL_LOBBY, RUNLEVEL_SETUP, RUNLEVEL_G
A.overlays.Cut();\
}\
A.flags &= ~OVERLAY_QUEUED;\
}
} while (FALSE)
4 changes: 2 additions & 2 deletions code/_global_vars/lists/species.dm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//Languages/species/whitelist.
GLOBAL_LIST_INIT(all_species, list())
GLOBAL_LIST_INIT(all_languages, list())
GLOBAL_LIST_EMPTY_TYPED(all_species, /datum/species)
GLOBAL_LIST_EMPTY_TYPED(all_languages, /datum/language)
GLOBAL_LIST_INIT(language_name_conflicts, list())
GLOBAL_LIST_INIT(language_keys, list()) // Table of say codes for all languages
GLOBAL_LIST_INIT(language_key_conflicts, list())
Expand Down
2 changes: 1 addition & 1 deletion code/_helpers/events.dm
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
// Otherwise add it and all subtypes that exist on the map to our grand list
for(var/areapath in typesof(parentpath))
var/area/A = locate(areapath) // Check if it actually exists
if(istype(A) && A.z in using_map.player_levels)
if(istype(A) && (A.z in using_map.player_levels))
grand_list_of_areas += A
return grand_list_of_areas

Expand Down
1 change: 1 addition & 0 deletions code/_helpers/game.dm
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
return max_z

/proc/get_area(atom/A)
RETURN_TYPE(/area)
if(isarea(A))
return A
var/turf/T = get_turf(A)
Expand Down
2 changes: 1 addition & 1 deletion code/_helpers/logging.dm
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
WRITE_LOG(diary, "DEADCHAT: [speaker.simple_info_line()]: [html_decode(text)]")

speaker.dialogue_log += "<b>([time_stamp()])</b> (<b>[speaker]/[speaker.client]</b>) <u>DEADSAY:</u> - <span style=\"color:green\">[text]</span>"
GLOB.round_text_log += "<font size=1><span style=\"color:#7e668c\"><b>([time_stamp()])</b> (<b>[src]/[speaker.client]</b>) <u>DEADSAY:</u> - [text]</span></font>"
GLOB.round_text_log += "<font size=1><span style=\"color:#7e668c\"><b>([time_stamp()])</b> (<b>[speaker]/[speaker.client]</b>) <u>DEADSAY:</u> - [text]</span></font>"


/proc/log_ghostemote(text, mob/speaker)
Expand Down
5 changes: 0 additions & 5 deletions code/_helpers/unsorted.dm
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,9 @@

if (!( istext(HTMLstring) ))
CRASH("Given non-text argument!")
return
else
if (length(HTMLstring) != 7)
CRASH("Given non-HTML argument!")
return
var/textr = copytext(HTMLstring, 2, 4)
var/textg = copytext(HTMLstring, 4, 6)
var/textb = copytext(HTMLstring, 6, 8)
Expand All @@ -40,7 +38,6 @@
if (length(textb) < 2)
textr = text("0[]", textb)
return text("#[][][]", textr, textg, textb)
return

//Returns the middle-most value
/proc/dd_range(var/low, var/high, var/num)
Expand Down Expand Up @@ -1130,8 +1127,6 @@ proc/is_hot(obj/item/W as obj)
else
return 0

return 0

//Whether or not the given item counts as sharp in terms of dealing damage
/proc/is_sharp(obj/O as obj)
if(!O)
Expand Down
3 changes: 2 additions & 1 deletion code/_macros.dm
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
#define RANDOM_BLOOD_TYPE pick(4;"O-", 36;"O+", 3;"A-", 28;"A+", 1;"B-", 20;"B+", 1;"AB-", 5;"AB+")

// #define to_chat(target, message) target << message Not anymore!
#define to_chat to_chat_filename=__FILE__;to_chat_line=__LINE__;to_chat_src=src;__to_chat
//#define to_chat to_chat_filename=__FILE__;to_chat_line=__LINE__;to_chat_src=src;__to_chat
#define to_chat __to_chat
#define to_world(message) to_chat(world, message)
#define to_world_log(message) world.log << message
// TODO - Baystation has this log to crazy places. For now lets just world.log, but maybe look into it later.
Expand Down
2 changes: 1 addition & 1 deletion code/controllers/subsystems/chat.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ SUBSYSTEM_DEF(chat)
priority = FIRE_PRIORITY_CHAT
init_order = INIT_ORDER_CHAT

var/list/msg_queue = list()
var/list/list/msg_queue = list() //List of lists

/datum/controller/subsystem/chat/Initialize(timeofday)
init_vchat()
Expand Down
2 changes: 1 addition & 1 deletion code/controllers/subsystems/events.dm
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ SUBSYSTEM_DEF(events)
return

for(var/i = EVENT_LEVEL_MUNDANE to EVENT_LEVEL_MAJOR)
var/list/datum/event_container/EC = event_containers[i]
var/datum/event_container/EC = event_containers[i]
EC.process()

/datum/controller/subsystem/events/stat_entry()
Expand Down
6 changes: 5 additions & 1 deletion code/controllers/subsystems/persistence.dm
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ SUBSYSTEM_DEF(persistence)
if(!A || (A.flags & AREA_FLAG_IS_NOT_PERSISTENT))
return

// if((!T.z in GLOB.using_map.station_levels) || !initialized)
if(!(T.z in using_map.station_levels))
return

if(!(T.z in using_map.persist_levels))
return

Expand All @@ -57,4 +61,4 @@ SUBSYSTEM_DEF(persistence)
dat += "</table>"
var/datum/browser/popup = new(user, "admin_persistence", "Persistence Data")
popup.set_content(jointext(dat, null))
popup.open()
popup.open()
2 changes: 1 addition & 1 deletion code/controllers/subsystems/planets.dm
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ SUBSYSTEM_DEF(planets)
z_to_planet[Z] = NP

// DO NOT CALL THIS DIRECTLY UNLESS IT'S IN INITIALIZE,
// USE turf/simulated/proc/make_indoors() and\
// USE turf/simulated/proc/make_indoors() and
// tyrf/simulated/proc/make_outdoors()
/datum/controller/subsystem/planets/proc/addTurf(var/turf/T)
if(z_to_planet.len >= T.z && z_to_planet[T.z])
Expand Down
2 changes: 1 addition & 1 deletion code/controllers/subsystems/ticker.dm
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ var/global/datum/controller/subsystem/ticker/ticker
switch(M.z)
if(0) //inside a crate or something
var/turf/T = get_turf(M)
if(T && T.z in using_map.station_levels) //we don't use M.death(0) because it calls a for(/mob) loop and
if(T && (T.z in using_map.station_levels)) //we don't use M.death(0) because it calls a for(/mob) loop and
M.health = 0
M.set_stat(DEAD)
if(1) //on a z-level 1 turf.
Expand Down
5 changes: 2 additions & 3 deletions code/controllers/subsystems/timer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,7 @@ SUBSYSTEM_DEF(timer)

if (timer.timeToRun < head_offset)
bucket_resolution = null //force bucket recreation
CRASH("[i] Invalid timer state: Timer in long run queue with a time to run less then head_offset. [get_timer_debug_string(timer)] world.time: [world.time], head_offset: [head_offset], practical_offset: [practical_offset]")

crash_with("[i] Invalid timer state: Timer in long run queue with a time to run less then head_offset. [get_timer_debug_string(timer)] world.time: [world.time], head_offset: [head_offset], practical_offset: [practical_offset]")
if (timer.callBack && !timer.spent)
timer.callBack.InvokeAsync()
spent += timer
Expand All @@ -171,7 +170,7 @@ SUBSYSTEM_DEF(timer)

if (timer.timeToRun < head_offset + TICKS2DS(practical_offset-1))
bucket_resolution = null //force bucket recreation
CRASH("[i] Invalid timer state: Timer in long run queue that would require a backtrack to transfer to short run queue. [get_timer_debug_string(timer)] world.time: [world.time], head_offset: [head_offset], practical_offset: [practical_offset]")
crash_with("[i] Invalid timer state: Timer in long run queue that would require a backtrack to transfer to short run queue. [get_timer_debug_string(timer)] world.time: [world.time], head_offset: [head_offset], practical_offset: [practical_offset]")
if (timer.callBack && !timer.spent)
timer.callBack.InvokeAsync()
spent += timer
Expand Down
2 changes: 1 addition & 1 deletion code/controllers/subsystems/xenoarch.dm
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ SUBSYSTEM_DEF(xenoarch)

/datum/controller/subsystem/xenoarch/proc/SetupXenoarch()
for(var/turf/simulated/mineral/M in world)
if(!M.density || M.z in using_map.xenoarch_exempt_levels)
if(!M.density || (M.z in using_map.xenoarch_exempt_levels))
continue

if(isnull(M.geologic_data))
Expand Down
2 changes: 1 addition & 1 deletion code/datums/beam.dm
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@



/atom/proc/Beam(atom/BeamTarget,icon_state="b_beam",icon='icons/effects/beam.dmi',time=50, maxdistance=10,beam_type=/obj/effect/ebeam,beam_sleep_time=3,beam_color = null)
/atom/proc/Beam(atom/BeamTarget, icon_state="b_beam", icon='icons/effects/beam.dmi', time=50, maxdistance=10, beam_type=/obj/effect/ebeam, beam_sleep_time=3, beam_color = null)
var/datum/beam/newbeam = new(src,BeamTarget,icon,icon_state,time,maxdistance,beam_type,beam_sleep_time,beam_color)
spawn(0)
newbeam.Start()
Expand Down
2 changes: 1 addition & 1 deletion code/datums/category.dm
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ datum/category_group/dd_SortValue()
*****************/
/datum/category_item
var/name = ""
var/list/datum/category_group/category // The group this item belongs to
var/datum/category_group/category // The group this item belongs to

/datum/category_item/New(var/datum/category_group/cg)
..()
Expand Down
4 changes: 2 additions & 2 deletions code/datums/components/_component.dm
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@
* * datum/component/c_type The typepath of the component you want to get a reference to
*/
/datum/proc/GetComponent(datum/component/c_type)
// RETURN_TYPE(c_type)
RETURN_TYPE(c_type)
if(initial(c_type.dupe_mode) == COMPONENT_DUPE_ALLOWED || initial(c_type.dupe_mode) == COMPONENT_DUPE_SELECTIVE)
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
Expand All @@ -353,7 +353,7 @@
* * datum/component/c_type The typepath of the component you want to get a reference to
*/
/datum/proc/GetExactComponent(datum/component/c_type)
// RETURN_TYPE(c_type)
RETURN_TYPE(c_type)
if(initial(c_type.dupe_mode) == COMPONENT_DUPE_ALLOWED || initial(c_type.dupe_mode) == COMPONENT_DUPE_SELECTIVE)
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
Expand Down
2 changes: 1 addition & 1 deletion code/datums/components/crafting/crafting.dm
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@
container.close_all()
qdel(DL)

/datum/component/personal_crafting/proc/component_ui_interact(atom/movable/screen/craft/image, location, control, params, user)
/datum/component/personal_crafting/proc/component_ui_interact(/obj/screen/craft/image, location, control, params, user)
// SIGNAL_HANDLER

if(user == parent)
Expand Down
2 changes: 1 addition & 1 deletion code/datums/datum.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
var/list/active_timers //for SStimer
var/list/datum_components //for /datum/components
var/list/comp_lookup
var/list/signal_procs
var/list/list/signal_procs // List of lists
var/signal_enabled = FALSE
var/weakref/weakref // Holder of weakref instance pointing to this datum
var/datum_flags = NONE
Expand Down
2 changes: 1 addition & 1 deletion code/datums/datumvars.dm
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
if(!usr || !result || result == "---Components---" || result == "---Elements---")
return
if(QDELETED(src))
to_chat(usr, "That thing doesn't exist anymore!", confidential = TRUE)
to_chat(usr, "That thing doesn't exist anymore!")
return
var/list/lst = usr.client.get_callproc_args()
if(!lst)
Expand Down
4 changes: 2 additions & 2 deletions code/datums/elements/_element.dm
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

/// Activates the functionality defined by the element on the given target datum
/datum/element/proc/Attach(datum/target)
// SHOULD_CALL_PARENT(1)
SHOULD_CALL_PARENT(1)
if(type == /datum/element)
return ELEMENT_INCOMPATIBLE
SEND_SIGNAL(target, COMSIG_ELEMENT_ATTACH, src)
Expand All @@ -28,7 +28,7 @@
/// Deactivates the functionality defines by the element on the given datum
/datum/element/proc/Detach(datum/source, force)
SEND_SIGNAL(source, COMSIG_ELEMENT_DETACH, src)
// SHOULD_CALL_PARENT(1)
SHOULD_CALL_PARENT(1)
UnregisterSignal(source, COMSIG_PARENT_QDELETING)

/datum/element/Destroy(force)
Expand Down
1 change: 0 additions & 1 deletion code/datums/looping_sounds/sequence.dm
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@

if(!(letter in morse_alphabet))
CRASH("Encountered invalid character in morse sequence \"[letter]\".")
return

// So I heard you like sequences...
// Play a sequence of sounds while inside the current iteration of the outer sequence.
Expand Down
4 changes: 2 additions & 2 deletions code/datums/mind.dm
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,8 @@

var/mob/def_target = null
var/objective_list[] = list(/datum/objective/assassinate, /datum/objective/protect, /datum/objective/debrain)
if (objective&&(objective.type in objective_list) && objective:target)
def_target = objective:target.current
if (objective&&(objective.type in objective_list) && objective.target)
def_target = objective.target.current

var/new_target = input("Select target:", "Objective target", def_target) as null|anything in possible_targets
if (!new_target) return
Expand Down
Loading

0 comments on commit 767e655

Please sign in to comment.