Skip to content

Commit

Permalink
Fixes linters whining. (#549)
Browse files Browse the repository at this point in the history
* Update od_lints.dm

* Revert "Update od_lints.dm"

This reverts commit 21f8b64.

* Fixes removed pragma (#15722)

Co-authored-by: TiviPlus <[email protected]>

* 515.1640 compatibility fixes (#16346)

* Fixes some ambigious ins linter was complaining about (#16555)

* Update datumvars.dm

---------

Co-authored-by: TiviPlus <[email protected]>
Co-authored-by: TiviPlus <[email protected]>
Co-authored-by: Lumipharon <[email protected]>
Co-authored-by: ivanmixo <[email protected]>
  • Loading branch information
5 people authored Oct 18, 2024
1 parent e1cdfb9 commit a4cfd2e
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 32 deletions.
18 changes: 9 additions & 9 deletions code/datums/components/_component.dm
Original file line number Diff line number Diff line change
Expand Up @@ -242,17 +242,17 @@
*/
/datum/proc/GetExactComponent(datum/component/c_type)
RETURN_TYPE(c_type)
if(initial(c_type.dupe_mode) == COMPONENT_DUPE_ALLOWED || initial(c_type.dupe_mode) == COMPONENT_DUPE_SELECTIVE)
var/initial_type_mode = initial(c_type.dupe_mode)
if(initial_type_mode == COMPONENT_DUPE_ALLOWED || initial_type_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
if(!dc)
var/list/all_components = _datum_components
if(!all_components)
return null
var/datum/component/C = dc[c_type]
if(C)
if(length(C))
C = C[1]
if(C.type == c_type)
return C
var/datum/component/potential_component
if(length(all_components))
potential_component = all_components[c_type]
if(potential_component?.type == c_type)
return potential_component
return null

/**
Expand Down
3 changes: 2 additions & 1 deletion code/datums/greyscale/_greyscale_config.dm
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,9 @@
if(length(colors) < expected_colors)
CRASH("[DebugName()] expected [expected_colors] color arguments but only received [length(colors)]")
if(islist(layer))
var/list/layer_list = layer
layer_icon = GenerateLayerGroup(colors, layer, render_steps)
layer = layer[1] // When there are multiple layers in a group like this we use the first one's blend mode
layer = layer_list[1] // When there are multiple layers in a group like this we use the first one's blend mode
else
layer_icon = layer.Generate(colors, render_steps, src)
if(!new_icon)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/admin/panels/permission_panel.dm
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@
. = ckey(admin_key)
if(!.)
return FALSE
if(!admin_ckey && (. in GLOB.admin_datums+GLOB.deadmins))
if(!admin_ckey && (. in (GLOB.admin_datums+GLOB.deadmins)))
to_chat(usr, span_danger("[admin_key] is already an admin."))
return FALSE
if(use_db)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/admin/topic.dm
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ Status: [status ? status : "Unknown"] | Damage: [health ? health : "None"]
if(response.body == "[]")
dat += "<center><b>0 bans detected for [ckey]</b></center>"
else
bans = json_decode(response["body"])
bans = json_decode(response.body)
dat += "<center><b>[length(bans)] ban\s detected for [ckey]</b></center>"
for(var/list/ban in bans)
dat += "<b>Server: </b> [sanitize(ban["sourceName"])]<br>"
Expand Down
17 changes: 9 additions & 8 deletions code/modules/admin/verbs/datumvars.dm
Original file line number Diff line number Diff line change
Expand Up @@ -532,18 +532,19 @@

#define VV_HTML_ENCODE(thing) (sanitize ? html_encode(thing) : thing)

/proc/debug_variable(name, value, level, datum/DA = null, sanitize = TRUE)
/proc/debug_variable(name, value, level, datum/owner = null, sanitize = TRUE)
var/header
if(DA)
if(islist(DA))
if(owner)
if(islist(owner))
var/list/list_owner = owner
var/index = name
if(value)
name = DA[name] //name is really the index until this line
name = list_owner[name] //name is really the index until this line
else
value = DA[name]
header = "<li style='backgroundColor:white'>(<a href='?_src_=vars;[HrefToken()];listedit=[REF(DA)];index=[index]'>E</a>) (<a href='?_src_=vars;[HrefToken()];listchange=[REF(DA)];index=[index]'>C</a>) (<a href='?_src_=vars;[HrefToken()];listremove=[REF(DA)];index=[index]'>-</a>) "
value = list_owner[name]
header = "<li style='backgroundColor:white'>(<a href='?_src_=vars;[HrefToken()];listedit=[REF(owner)];index=[index]'>E</a>) (<a href='?_src_=vars;[HrefToken()];listchange=[REF(owner)];index=[index]'>C</a>) (<a href='?_src_=vars;[HrefToken()];listremove=[REF(owner)];index=[index]'>-</a>) "
else
header = "<li style='backgroundColor:white'>(<a href='?_src_=vars;[HrefToken()];datumedit=[REF(DA)];varnameedit=[name]'>E</a>) (<a href='?_src_=vars;[HrefToken()];datumchange=[REF(DA)];varnamechange=[name]'>C</a>) (<a href='?_src_=vars;[HrefToken()];datummass=[REF(DA)];varnamemass=[name]'>M</a>) "
header = "<li style='backgroundColor:white'>(<a href='?_src_=vars;[HrefToken()];datumedit=[REF(owner)];varnameedit=[name]'>E</a>) (<a href='?_src_=vars;[HrefToken()];datumchange=[REF(owner)];varnamechange=[name]'>C</a>) (<a href='?_src_=vars;[HrefToken()];datummass=[REF(owner)];varnamemass=[name]'>M</a>) "
else
header = "<li>"

Expand Down Expand Up @@ -571,7 +572,7 @@
var/list/L = value
var/list/items = list()

if(istype(DA, /datum/controller/global_vars) && !DA.vv_edit_var(name, L))
if(istype(owner, /datum/controller/global_vars) && !owner.vv_edit_var(name, L))
item = "[VV_HTML_ENCODE(name)] = /list ([length(L)])"
else if(length(L) > 0 && !(name == "underlays" || name == "overlays" || length(L) > (IS_NORMAL_LIST(L) ? 50 : 150)))
for(var/i in 1 to length(L))
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/mob.dm
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@
conga_line += S.buckled
while(!end_of_conga)
var/atom/movable/A = S.pulling
if(A in conga_line || A.anchored) //No loops, nor moving anchored things.
if((A in conga_line) || A.anchored) //No loops, nor moving anchored things.
end_of_conga = TRUE
break
conga_line += A
Expand Down
14 changes: 7 additions & 7 deletions code/modules/paperwork/paper_bundle.dm
Original file line number Diff line number Diff line change
Expand Up @@ -101,25 +101,25 @@
switch(screen)
if(0)
dat+= "<DIV STYLE='float:left; text-align:left; width:33.33333%'></DIV>"
dat+= "<DIV STYLE='float:left; text-align:center; width:33.33333%'><A href='?src=[text_ref(src)];remove=1'>Remove [(istype(src[page], /obj/item/paper)) ? "paper" : "photo"]</A></DIV>"
dat+= "<DIV STYLE='float:left; text-align:center; width:33.33333%'><A href='?src=[text_ref(src)];remove=1'>Remove [(istype(page, /obj/item/paper)) ? "paper" : "photo"]</A></DIV>"
dat+= "<DIV STYLE='float:left; text-align:right; width:33.33333%'><A href='?src=[text_ref(src)];next_page=1'>Next Page</A></DIV><BR><HR>"
if(1)
dat+= "<DIV STYLE='float:left; text-align:left; width:33.33333%'><A href='?src=[text_ref(src)];prev_page=1'>Previous Page</A></DIV>"
dat+= "<DIV STYLE='float:left; text-align:center; width:33.33333%'><A href='?src=[text_ref(src)];remove=1'>Remove [(istype(src[page], /obj/item/paper)) ? "paper" : "photo"]</A></DIV>"
dat+= "<DIV STYLE='float:left; text-align:center; width:33.33333%'><A href='?src=[text_ref(src)];remove=1'>Remove [(istype(page, /obj/item/paper)) ? "paper" : "photo"]</A></DIV>"
dat+= "<DIV STYLE='float:left; text-align:right; width:33.33333%'><A href='?src=[text_ref(src)];next_page=1'>Next Page</A></DIV><BR><HR>"
if(2)
dat+= "<DIV STYLE='float:left; text-align:left; width:33.33333%'><A href='?src=[text_ref(src)];prev_page=1'>Previous Page</A></DIV>"
dat+= "<DIV STYLE='float:left; text-align:center; width:33.33333%'><A href='?src=[text_ref(src)];remove=1'>Remove [(istype(src[page], /obj/item/paper)) ? "paper" : "photo"]</A></DIV><BR><HR>"
dat+= "<DIV STYLE='float:left; text-align:center; width:33.33333%'><A href='?src=[text_ref(src)];remove=1'>Remove [(istype(page, /obj/item/paper)) ? "paper" : "photo"]</A></DIV><BR><HR>"
dat+= "<DIV STYLE='float;left; text-align:right; with:33.33333%'></DIV>"
if(istype(src[page], /obj/item/paper))
var/obj/item/paper/P = src[page]
if(istype(page, /obj/item/paper))
var/obj/item/paper/P = page
if(!(ishuman(usr) || isobserver(usr) || issilicon(usr)))
dat+= "<html><meta charset='UTF-8'><HEAD><TITLE>[P.name]</TITLE></HEAD><BODY>[stars(P.info)][P.stamps]</BODY></HTML>"
else
dat+= "<html><meta charset='UTF-8'><HEAD><TITLE>[P.name]</TITLE></HEAD><BODY>[P.info][P.stamps]</BODY></HTML>"
human_user << browse(dat, "window=[name]")
else if(istype(src[page], /obj/item/photo))
var/obj/item/photo/P = src[page]
else if(istype(page, /obj/item/photo))
var/obj/item/photo/P = page
human_user << browse_rsc(P.picture.picture_icon, "tmp_photo.png")
human_user << browse(dat + "<html><meta charset='UTF-8'><head><title>[P.name]</title></head>" \
+ "<body style='overflow:hidden'>" \
Expand Down
4 changes: 2 additions & 2 deletions code/modules/power/power.dm
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@

for(var/obj/machinery/power/smes/S in GLOB.machines)
var/area/current_area = get_area(S)
if(current_area.type in skipped_areas || !is_mainship_level(S.z)) // Ship only
if((current_area.type in skipped_areas) || !is_mainship_level(S.z)) // Ship only
continue
S.charge = 0
S.output_level = 0
Expand All @@ -336,7 +336,7 @@

for(var/obj/machinery/power/smes/S in GLOB.machines)
var/area/current_area = get_area(S)
if(current_area.type in skipped_areas || !is_mainship_level(S.z))
if((current_area.type in skipped_areas) || !is_mainship_level(S.z))
continue
S.charge = S.capacity
S.output_level = S.output_level_max
Expand Down
2 changes: 1 addition & 1 deletion code/modules/security_levels/keycard_authentication.dm
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,6 @@
GLOB.marine_main_ship.revoke_maint_all_access()

/obj/machinery/door/airlock/allowed(mob/M)
if(is_mainship_level(z) && GLOB.marine_main_ship.maint_all_access && (ACCESS_MARINE_ENGINEERING in req_access+req_one_access))
if(is_mainship_level(z) && GLOB.marine_main_ship.maint_all_access && (ACCESS_MARINE_ENGINEERING in (req_access+req_one_access)))
return TRUE
return ..(M)
1 change: 0 additions & 1 deletion tools/ci/od_lints.dm
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#pragma SoftReservedKeyword error
#pragma DuplicateVariable error
#pragma DuplicateProcDefinition error
#pragma TooManyArguments error
#pragma PointlessParentCall error
#pragma PointlessBuiltinCall error
#pragma SuspiciousMatrixCall error
Expand Down

0 comments on commit a4cfd2e

Please sign in to comment.