diff --git a/code/__HELPERS/icon_smoothing.dm b/code/__HELPERS/icon_smoothing.dm index 2caf0883727..b6a7a52b5a5 100644 --- a/code/__HELPERS/icon_smoothing.dm +++ b/code/__HELPERS/icon_smoothing.dm @@ -103,7 +103,7 @@ DEFINE_BITFIELD(smoothing_junction, list( for(var/direction in GLOB.cardinal) switch(find_type_in_direction(direction)) if(NULLTURF_BORDER) - if((smoothing_flags & SMOOTH_BORDER)) + if(smoothing_flags & SMOOTH_BORDER) . |= direction //BYOND and smooth dirs are the same for cardinals if(ADJ_FOUND) . |= direction //BYOND and smooth dirs are the same for cardinals @@ -112,7 +112,7 @@ DEFINE_BITFIELD(smoothing_junction, list( if(. & WEST_JUNCTION) switch(find_type_in_direction(NORTHWEST)) if(NULLTURF_BORDER) - if((smoothing_flags & SMOOTH_BORDER)) + if(smoothing_flags & SMOOTH_BORDER) . |= NORTHWEST_JUNCTION if(ADJ_FOUND) . |= NORTHWEST_JUNCTION @@ -120,7 +120,7 @@ DEFINE_BITFIELD(smoothing_junction, list( if(. & EAST_JUNCTION) switch(find_type_in_direction(NORTHEAST)) if(NULLTURF_BORDER) - if((smoothing_flags & SMOOTH_BORDER)) + if(smoothing_flags & SMOOTH_BORDER) . |= NORTHEAST_JUNCTION if(ADJ_FOUND) . |= NORTHEAST_JUNCTION @@ -129,7 +129,7 @@ DEFINE_BITFIELD(smoothing_junction, list( if(. & WEST_JUNCTION) switch(find_type_in_direction(SOUTHWEST)) if(NULLTURF_BORDER) - if((smoothing_flags & SMOOTH_BORDER)) + if(smoothing_flags & SMOOTH_BORDER) . |= SOUTHWEST_JUNCTION if(ADJ_FOUND) . |= SOUTHWEST_JUNCTION @@ -137,7 +137,7 @@ DEFINE_BITFIELD(smoothing_junction, list( if(. & EAST_JUNCTION) switch(find_type_in_direction(SOUTHEAST)) if(NULLTURF_BORDER) - if((smoothing_flags & SMOOTH_BORDER)) + if(smoothing_flags & SMOOTH_BORDER) . |= SOUTHEAST_JUNCTION if(ADJ_FOUND) . |= SOUTHEAST_JUNCTION diff --git a/code/controllers/master.dm b/code/controllers/master.dm index e61d6d8e7ea..9aba13a22bc 100644 --- a/code/controllers/master.dm +++ b/code/controllers/master.dm @@ -529,7 +529,7 @@ GLOBAL_REAL(Master, /datum/controller/master) = new queue_node = queue_node.queue_next continue - if((queue_node_flags & SS_BACKGROUND)) + if(queue_node_flags & SS_BACKGROUND) if(!bg_calc) current_tick_budget = queue_priority_count_bg bg_calc = TRUE diff --git a/code/game/dna/dna_modifier.dm b/code/game/dna/dna_modifier.dm index 1b60bd3a519..ac297b6ef8e 100644 --- a/code/game/dna/dna_modifier.dm +++ b/code/game/dna/dna_modifier.dm @@ -735,8 +735,8 @@ var/datum/dna2/record/buf = buffers[bufferId] - if((buf.types & DNA2_BUF_UI)) - if((buf.types & DNA2_BUF_UE)) + if(buf.types & DNA2_BUF_UI) + if(buf.types & DNA2_BUF_UE) connected.occupant.real_name = buf.dna.real_name connected.occupant.name = buf.dna.real_name connected.occupant.UpdateAppearance(buf.dna.UI.Copy()) diff --git a/code/game/gamemodes/miniantags/guardian/types/healer.dm b/code/game/gamemodes/miniantags/guardian/types/healer.dm index 466a448f728..0ceeee7dadb 100644 --- a/code/game/gamemodes/miniantags/guardian/types/healer.dm +++ b/code/game/gamemodes/miniantags/guardian/types/healer.dm @@ -132,7 +132,7 @@ if(!Adjacent(A)) to_chat(src, "You must be adjacent to your target!") return - if((A.anchored)) + if(A.anchored) to_chat(src, "Your target can not be anchored!") return to_chat(src, "You begin to warp [A]") diff --git a/code/game/machinery/cryopod.dm b/code/game/machinery/cryopod.dm index c4111835cbe..f0cbbda6ab1 100644 --- a/code/game/machinery/cryopod.dm +++ b/code/game/machinery/cryopod.dm @@ -391,13 +391,13 @@ if(GLOB.PDA_Manifest.len) GLOB.PDA_Manifest.Cut() for(var/datum/data/record/R in GLOB.data_core.medical) - if((R.fields["name"] == occupant.real_name)) + if(R.fields["name"] == occupant.real_name) qdel(R) for(var/datum/data/record/T in GLOB.data_core.security) - if((T.fields["name"] == occupant.real_name)) + if(T.fields["name"] == occupant.real_name) qdel(T) for(var/datum/data/record/G in GLOB.data_core.general) - if((G.fields["name"] == occupant.real_name)) + if(G.fields["name"] == occupant.real_name) announce_rank = G.fields["rank"] qdel(G) diff --git a/code/game/machinery/machinery.dm b/code/game/machinery/machinery.dm index 4c5ca812044..e97ceb0bad6 100644 --- a/code/game/machinery/machinery.dm +++ b/code/game/machinery/machinery.dm @@ -379,7 +379,7 @@ /obj/machinery/proc/exchange_parts(mob/user, obj/item/storage/part_replacer/W) var/shouldplaysound = 0 - if((flags & NODECONSTRUCT)) + if(flags & NODECONSTRUCT) return FALSE if(istype(W) && component_parts) if(panel_open || W.works_from_distance) diff --git a/code/game/mecha/mecha_topic.dm b/code/game/mecha/mecha_topic.dm index 80966cc3130..24352468fe4 100644 --- a/code/game/mecha/mecha_topic.dm +++ b/code/game/mecha/mecha_topic.dm @@ -287,7 +287,7 @@ if(href_list["rfreq"]) if(usr != occupant) return var/new_frequency = (radio.frequency + afilter.getNum("rfreq")) - if((radio.frequency < PUBLIC_LOW_FREQ || radio.frequency > PUBLIC_HIGH_FREQ)) + if(radio.frequency < PUBLIC_LOW_FREQ || radio.frequency > PUBLIC_HIGH_FREQ) new_frequency = sanitize_frequency(new_frequency) radio.set_frequency(new_frequency) send_byjax(occupant,"exosuit.browser","rfreq","[format_frequency(radio.frequency)]") diff --git a/code/game/objects/items/devices/radio/radio_objects.dm b/code/game/objects/items/devices/radio/radio_objects.dm index f861e7b7a56..64a5c5c3bfa 100644 --- a/code/game/objects/items/devices/radio/radio_objects.dm +++ b/code/game/objects/items/devices/radio/radio_objects.dm @@ -512,18 +512,6 @@ GLOBAL_LIST_EMPTY(deadsay_radio_systems) broadcast_message(tcm) qdel(tcm) // Delete the message datum -/* -/obj/item/radio/proc/accept_rad(obj/item/radio/R as obj, message) - - if((R.frequency == frequency && message)) - return 1 - else if - - else - return null - return -*/ - /obj/item/radio/proc/receive_range(freq, level) // check if this radio can receive on the given frequency, and if so, diff --git a/code/game/objects/items/weapons/flamethrower.dm b/code/game/objects/items/weapons/flamethrower.dm index ac626199b33..a16963b648a 100644 --- a/code/game/objects/items/weapons/flamethrower.dm +++ b/code/game/objects/items/weapons/flamethrower.dm @@ -218,7 +218,7 @@ previousturf = T operating = FALSE for(var/mob/M in viewers(1, loc)) - if((M.client && M.machine == src)) + if(M.client && M.machine == src) attack_self(M) diff --git a/code/game/objects/items/weapons/tape.dm b/code/game/objects/items/weapons/tape.dm index 360e2150df1..ab111432411 100644 --- a/code/game/objects/items/weapons/tape.dm +++ b/code/game/objects/items/weapons/tape.dm @@ -49,7 +49,7 @@ icon_state = "taperoll-2" if((amount <= 6) && (amount > 4)) icon_state = "taperoll-3" - if((amount > 6)) + if(amount > 6) icon_state = "taperoll-4" else icon_state = "taperoll-4" diff --git a/code/game/objects/objs.dm b/code/game/objects/objs.dm index f1b782571a1..5947d66a801 100644 --- a/code/game/objects/objs.dm +++ b/code/game/objects/objs.dm @@ -140,7 +140,7 @@ var/is_in_use = FALSE var/list/nearby = viewers(1, src) for(var/mob/M in nearby) - if((M.client && M.machine == src)) + if(M.client && M.machine == src) is_in_use = TRUE src.attack_hand(M) if(isAI(usr) || isrobot(usr)) @@ -165,7 +165,7 @@ var/list/nearby = viewers(1, src) var/is_in_use = FALSE for(var/mob/M in nearby) - if((M.client && M.machine == src)) + if(M.client && M.machine == src) is_in_use = TRUE src.interact(M) var/ai_in_use = AutoUpdateAI(src) diff --git a/code/game/objects/structures/noticeboard.dm b/code/game/objects/structures/noticeboard.dm index 5ffc0ab9d50..b74f52a1d3b 100644 --- a/code/game/objects/structures/noticeboard.dm +++ b/code/game/objects/structures/noticeboard.dm @@ -52,7 +52,7 @@ if((usr.stat || usr.restrained())) //For when a player is handcuffed while they have the notice window open return var/obj/item/P = locate(href_list["remove"]) - if((P && P.loc == src)) + if(P && P.loc == src) P.loc = get_turf(src) //dump paper on the floor because you're a clumsy fuck P.add_fingerprint(usr) add_fingerprint(usr) @@ -77,6 +77,6 @@ if(href_list["read"]) var/obj/item/paper/P = locate(href_list["read"]) - if((P && P.loc == src)) + if(P && P.loc == src) P.show_content(usr) return diff --git a/code/game/turfs/simulated/floor/lava.dm b/code/game/turfs/simulated/floor/lava.dm index 8040ca5df38..e718e0dec43 100644 --- a/code/game/turfs/simulated/floor/lava.dm +++ b/code/game/turfs/simulated/floor/lava.dm @@ -206,7 +206,7 @@ if((O.resistance_flags & (LAVA_PROOF|INDESTRUCTIBLE)) || O.throwing) continue . = TRUE - if((O.resistance_flags & ON_FIRE)) + if(O.resistance_flags & ON_FIRE) continue if(!(O.resistance_flags & FLAMMABLE)) O.resistance_flags |= FLAMMABLE //Even fireproof things burn up in lava diff --git a/code/game/turfs/space/space_turf.dm b/code/game/turfs/space/space_turf.dm index 5e89ba1d44d..2cef6597e29 100644 --- a/code/game/turfs/space/space_turf.dm +++ b/code/game/turfs/space/space_turf.dm @@ -161,7 +161,7 @@ A.z = target_z A.x = world.maxx - 2 spawn (0) - if((A && A.loc)) + if(A && A.loc) A.loc.Entered(A) else if(src.x >= world.maxx) if(istype(A, /obj/effect/meteor)) @@ -186,7 +186,7 @@ A.z = target_z A.x = 3 spawn (0) - if((A && A.loc)) + if(A && A.loc) A.loc.Entered(A) else if(src.y <= 1) if(istype(A, /obj/effect/meteor)) @@ -210,7 +210,7 @@ A.z = target_z A.y = world.maxy - 2 spawn (0) - if((A && A.loc)) + if(A && A.loc) A.loc.Entered(A) else if(src.y >= world.maxy) @@ -235,7 +235,7 @@ A.z = target_z A.y = 3 spawn (0) - if((A && A.loc)) + if(A && A.loc) A.loc.Entered(A) return diff --git a/code/game/verbs/ooc.dm b/code/game/verbs/ooc.dm index 146ad37d3e2..bd187cc3f6f 100644 --- a/code/game/verbs/ooc.dm +++ b/code/game/verbs/ooc.dm @@ -70,7 +70,7 @@ GLOBAL_VAR_INIT(admin_ooc_colour, "#b82e00") if(prefs.unlock_content) if(display_colour == GLOB.normal_ooc_colour) - if((prefs.toggles & PREFTOGGLE_MEMBER_PUBLIC)) + if(prefs.toggles & PREFTOGGLE_MEMBER_PUBLIC) display_colour = GLOB.member_ooc_colour for(var/client/C in GLOB.clients) @@ -83,7 +83,7 @@ GLOBAL_VAR_INIT(admin_ooc_colour, "#b82e00") display_name = "[bicon(byond)][display_name]" if(donator_level > 0) - if((prefs.toggles & PREFTOGGLE_DONATOR_PUBLIC)) + if(prefs.toggles & PREFTOGGLE_DONATOR_PUBLIC) var/icon/donator = icon('icons/ooc_tag_16x.png') display_name = "[bicon(donator)][display_name]" diff --git a/code/modules/antagonists/changeling/powers/apex_predator.dm b/code/modules/antagonists/changeling/powers/apex_predator.dm index e40d7207e8e..60306e115f6 100644 --- a/code/modules/antagonists/changeling/powers/apex_predator.dm +++ b/code/modules/antagonists/changeling/powers/apex_predator.dm @@ -10,7 +10,7 @@ /datum/action/changeling/apex_predator/sting_action(mob/user) var/list/target_by_name = list() for(var/mob/living/carbon/human/possible_target as anything in GLOB.human_list) - if((!possible_target.mind || possible_target.z != user.z)) + if(!possible_target.mind || possible_target.z != user.z) continue target_by_name[possible_target.real_name] = possible_target diff --git a/code/modules/clothing/gloves/misc_gloves.dm b/code/modules/clothing/gloves/misc_gloves.dm index 8ccbd2546f8..87d7c9a2682 100644 --- a/code/modules/clothing/gloves/misc_gloves.dm +++ b/code/modules/clothing/gloves/misc_gloves.dm @@ -197,7 +197,7 @@ else click_speed_modifier = initial(click_speed_modifier) // 2 - if((L.a_intent in accepted_intents)) + if(L.a_intent in accepted_intents) L.changeNext_move(click_speed_modifier) return FALSE diff --git a/code/modules/mob/living/carbon/human/human_update_icons.dm b/code/modules/mob/living/carbon/human/human_update_icons.dm index 085402ede25..355ddc11d8c 100644 --- a/code/modules/mob/living/carbon/human/human_update_icons.dm +++ b/code/modules/mob/living/carbon/human/human_update_icons.dm @@ -110,7 +110,8 @@ Please contact me on #coderbus IRC. ~Carn x var/list/cached_standing_overlays = list() // List of everything currently in a human's actual overlays /mob/living/carbon/human/proc/apply_overlay(cache_index) - if((. = overlays_standing[cache_index])) + . = overlays_standing[cache_index] + if(.) add_overlay(.) /mob/living/carbon/human/proc/remove_overlay(cache_index) diff --git a/code/modules/mob/living/silicon/ai/ai_mob.dm b/code/modules/mob/living/silicon/ai/ai_mob.dm index 1dc0a5f34d4..646216f2bba 100644 --- a/code/modules/mob/living/silicon/ai/ai_mob.dm +++ b/code/modules/mob/living/silicon/ai/ai_mob.dm @@ -27,7 +27,7 @@ GLOBAL_LIST_INIT(ai_verbs_default, list( if(subject!=null) for(var/A in GLOB.ai_list) var/mob/living/silicon/ai/M = A - if((M.client && M.machine == subject)) + if(M.client && M.machine == subject) is_in_use = 1 subject.attack_ai(M) return is_in_use diff --git a/code/modules/mob/living/simple_animal/bot/ed209bot.dm b/code/modules/mob/living/simple_animal/bot/ed209bot.dm index eb4ae2dea83..0e9270984f0 100644 --- a/code/modules/mob/living/simple_animal/bot/ed209bot.dm +++ b/code/modules/mob/living/simple_animal/bot/ed209bot.dm @@ -438,7 +438,7 @@ lastfired = world.time var/turf/T = loc var/atom/U = (istype(target, /atom/movable) ? target.loc : target) - if((!U || !T)) + if(!U || !T) return while(!isturf(U)) U = U.loc @@ -504,11 +504,11 @@ /mob/living/simple_animal/bot/ed209/bullet_act(obj/item/projectile/Proj) if(!disabled) var/lasertag_check = 0 - if((lasercolor == "b")) + if(lasercolor == "b") if(istype(Proj, /obj/item/projectile/beam/lasertag/redtag)) lasertag_check++ - else if((lasercolor == "r")) + else if(lasercolor == "r") if(istype(Proj, /obj/item/projectile/beam/lasertag/bluetag)) lasertag_check++ diff --git a/code/modules/mob/living/simple_animal/hostile/syndicate_mobs.dm b/code/modules/mob/living/simple_animal/hostile/syndicate_mobs.dm index 2e35b599467..afd4595d3bd 100644 --- a/code/modules/mob/living/simple_animal/hostile/syndicate_mobs.dm +++ b/code/modules/mob/living/simple_animal/hostile/syndicate_mobs.dm @@ -73,7 +73,7 @@ if(prob(ranged_block_chance)) visible_message("[src] blocks [Proj] with its shield!") else - if((Proj.damage_type == BRUTE || Proj.damage_type == BURN)) + if(Proj.damage_type == BRUTE || Proj.damage_type == BURN) adjustHealth(Proj.damage) return 0 diff --git a/code/modules/mob/living/simple_animal/slime/slime_mob.dm b/code/modules/mob/living/simple_animal/slime/slime_mob.dm index f9005b355a0..4db2674ec93 100644 --- a/code/modules/mob/living/simple_animal/slime/slime_mob.dm +++ b/code/modules/mob/living/simple_animal/slime/slime_mob.dm @@ -250,7 +250,7 @@ if(!Proj) return attacked += 10 - if((Proj.damage_type == BURN)) + if(Proj.damage_type == BURN) adjustBruteLoss(-abs(Proj.damage)) //fire projectiles heals slimes. Proj.on_hit(src) else diff --git a/code/modules/paperwork/faxmachine.dm b/code/modules/paperwork/faxmachine.dm index d89b06f8b83..251929d00b8 100644 --- a/code/modules/paperwork/faxmachine.dm +++ b/code/modules/paperwork/faxmachine.dm @@ -201,7 +201,7 @@ GLOBAL_LIST_EMPTY(fax_blacklist) if("rename") // rename the item that is currently in the fax machine if(copyitem) var/n_name = sanitize(copytext(input(usr, "What would you like to label the fax?", "Fax Labelling", copyitem.name) as text, 1, MAX_MESSAGE_LEN)) - if((copyitem && copyitem.loc == src && usr.stat == 0)) + if(copyitem && copyitem.loc == src && usr.stat == 0) if(istype(copyitem, /obj/item/paper)) copyitem.name = "[(n_name ? "[n_name]" : initial(copyitem.name))]" copyitem.desc = "This is a paper titled '" + copyitem.name + "'." diff --git a/code/modules/paperwork/paper_bundle.dm b/code/modules/paperwork/paper_bundle.dm index 60646ef54c6..b5b5094bbe8 100644 --- a/code/modules/paperwork/paper_bundle.dm +++ b/code/modules/paperwork/paper_bundle.dm @@ -202,7 +202,7 @@ /obj/item/paper_bundle/proc/rename(mob/user) var/n_name = sanitize(copytext(input(user, "What would you like to label the bundle?", "Bundle Labelling", name) as text, 1, MAX_MESSAGE_LEN)) - if((loc == user && !user.stat)) + if(loc == user && !user.stat) name = "[(n_name ? "[n_name]" : "paper bundle")]" add_fingerprint(user) diff --git a/code/modules/surgery/organs/organ_datums/lung_datum.dm b/code/modules/surgery/organs/organ_datums/lung_datum.dm index 19e683c0625..c939bbab651 100644 --- a/code/modules/surgery/organs/organ_datums/lung_datum.dm +++ b/code/modules/surgery/organs/organ_datums/lung_datum.dm @@ -52,7 +52,7 @@ */ /datum/organ/lungs/proc/check_breath(datum/gas_mixture/breath, mob/living/carbon/human/H) - if((H.status_flags & GODMODE)) + if(H.status_flags & GODMODE) return if(HAS_TRAIT(H, TRAIT_NOBREATH)) diff --git a/tools/ci/check_grep2.py b/tools/ci/check_grep2.py index 3be9d13d1c8..da83d24d0c8 100644 --- a/tools/ci/check_grep2.py +++ b/tools/ci/check_grep2.py @@ -104,16 +104,19 @@ def check_to_chats_have_a_user_arguement(lines): CONDITIONAL_LEADING_SPACE = re.compile(r"(if|for|while|switch)\s+(\(.*?\)?)") # checks for "if (thing)", replace with $1$2 CONDITIONAL_BEGINNING_SPACE = re.compile(r"(if|for|while|switch)\((!?) (.+\)?)") # checks for "if( thing)", replace with $1($2$3 CONDITIONAL_ENDING_SPACE = re.compile(r"(if|for|while|switch)(\(.+) \)") # checks for "if(thing )", replace with $1$2) +CONDITIONAL_DOUBLE_PARENTHESIS = re.compile(r"(if)\((\([^)]+\))\)$") # checks for if((thing)), replace with $1$2 # To fix any of these, run them as regex in VSCode, with the appropriate replacement # It may be a good idea to turn the replacement into a script someday def check_conditional_spacing(lines): for idx, line in enumerate(lines): if CONDITIONAL_LEADING_SPACE.search(line): - return Failure(idx + 1, "Found a conditional statement matching the format \"if (thing)\", please use \"if(thing)\" instead.") + return Failure(idx + 1, "Found a conditional statement matching the format \"if (thing)\" (irregular spacing), please use \"if(thing)\" instead.") if CONDITIONAL_BEGINNING_SPACE.search(line): - return Failure(idx + 1, "Found a conditional statement matching the format \"if( thing)\", please use \"if(thing)\" instead.") + return Failure(idx + 1, "Found a conditional statement matching the format \"if( thing)\" (irregular spacing), please use \"if(thing)\" instead.") if CONDITIONAL_ENDING_SPACE.search(line): - return Failure(idx + 1, "Found a conditional statement matching the format \"if(thing )\", please use \"if(thing)\" instead.") + return Failure(idx + 1, "Found a conditional statement matching the format \"if(thing )\" (irregular spacing), please use \"if(thing)\" instead.") + if CONDITIONAL_DOUBLE_PARENTHESIS.search(line): + return Failure(idx + 1, "Found a conditional statement matching the format \"if((thing))\" (unnecessary outer parentheses), 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"(?