Skip to content

Commit

Permalink
Updates grep checks again and fixes issues
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkSuckerberg committed Jan 8, 2024
1 parent 63818ee commit 5b95509
Show file tree
Hide file tree
Showing 24 changed files with 104 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -840,7 +840,7 @@
"uE" = (
/obj/structure/fans/tiny,
/obj/machinery/door/keycard{
name = "NanoTrasen Secure Solutions";
name = "Nanotrasen Secure Solutions";
puzzle_id = "NTB1"
},
/turf/open/floor/wood,
Expand Down
8 changes: 4 additions & 4 deletions _maps/RandomRuins/SandRuins/whitesands_surface_chokepoint.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
/mob/living/simple_animal/hostile/nanotrasen/ranged{
atmos_requirements = list("min_oxy"=5,"max_oxy"=0,"min_tox"=0,"max_tox"=0,"min_co2"=0,"max_co2"=999,"min_n2"=0,"max_n2"=0);
damage_coeff = list("brute"=1,"fire"=1,"toxin"=1,"clone"=1,"stamina"=0,"oxygen"=0);
name = "\improper NanoTrasen Stranded Security Officer"
name = "\improper Nanotrasen Stranded Security Officer"
},
/turf/open/floor/plating/asteroid/whitesands/dried,
/area/ruin)
Expand All @@ -38,7 +38,7 @@
atmos_requirements = list("min_oxy"=5,"max_oxy"=0,"min_tox"=0,"max_tox"=0,"min_co2"=0,"max_co2"=999,"min_n2"=0,"max_n2"=0);
damage_coeff = list("brute"=1,"fire"=1,"toxin"=1,"clone"=1,"stamina"=0,"oxygen"=0);
dir = 4;
name = "\improper NanoTrasen Stranded Security Officer"
name = "\improper Nanotrasen Stranded Security Officer"
},
/turf/open/floor/plating/asteroid/whitesands/dried,
/area/ruin)
Expand All @@ -50,7 +50,7 @@
atmos_requirements = list("min_oxy"=5,"max_oxy"=0,"min_tox"=0,"max_tox"=0,"min_co2"=0,"max_co2"=999,"min_n2"=0,"max_n2"=0);
damage_coeff = list("brute"=1,"fire"=1,"toxin"=1,"clone"=1,"stamina"=0,"oxygen"=0);
dir = 8;
name = "\improper NanoTrasen Stranded Security Officer"
name = "\improper Nanotrasen Stranded Security Officer"
},
/turf/open/floor/plating/asteroid/whitesands/dried,
/area/ruin)
Expand Down Expand Up @@ -97,7 +97,7 @@
atmos_requirements = list("min_oxy"=5,"max_oxy"=0,"min_tox"=0,"max_tox"=0,"min_co2"=0,"max_co2"=999,"min_n2"=0,"max_n2"=0);
damage_coeff = list("brute"=1,"fire"=1,"toxin"=1,"clone"=1,"stamina"=0,"oxygen"=0);
dir = 8;
name = "\improper NanoTrasen Stranded Security Officer"
name = "\improper Nanotrasen Stranded Security Officer"
},
/turf/open/floor/plating/asteroid/whitesands/dried,
/area/ruin)
Expand Down
2 changes: 1 addition & 1 deletion code/__HELPERS/names.dm
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ GLOBAL_LIST_INIT(ship_faction_to_prefixes, list(
"CMSV",
"CMGSV",
),
"NanoTrasen" = list(
"Nanotrasen" = list(
"NTSV",
),
))
Expand Down
2 changes: 1 addition & 1 deletion code/_globalvars/lists/faxes.dm
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* * button_color - The color of this fax button in the list of all faxes.
*/
GLOBAL_LIST_INIT(additional_faxes_list, list(
list("fax_name" = "NanoTrasen Central Command", "button_color" = "#46B946"),
list("fax_name" = "Nanotrasen Central Command", "button_color" = "#46B946"),
list("fax_name" = "Inteq Management Field Command", "button_color" = "#FACE65"),
list("fax_name" = "Colonial Minutemen Headquarters", "button_color" = "#538ACF"),
list("fax_name" = "Saint-Roumain Council of Huntsmen", "button_color" = "#6B443D"),
Expand Down
4 changes: 2 additions & 2 deletions code/datums/aquarium.dm
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
else
InitializeOther()

ADD_TRAIT(parent, TRAIT_FISH_CASE_COMPATIBILE, src)
ADD_TRAIT(parent, TRAIT_FISH_CASE_COMPATIBILE, REF(src))
RegisterSignal(parent, COMSIG_MOVABLE_MOVED, PROC_REF(enter_aquarium))

//If component is added to something already in aquarium at the time initialize it properly.
Expand Down Expand Up @@ -134,7 +134,7 @@

/datum/component/aquarium_content/PreTransfer()
. = ..()
REMOVE_TRAIT(parent, TRAIT_FISH_CASE_COMPATIBILE, src)
REMOVE_TRAIT(parent, TRAIT_FISH_CASE_COMPATIBILE, REF(src))

/datum/component/aquarium_content/Destroy(force, silent)
if(current_aquarium)
Expand Down
4 changes: 2 additions & 2 deletions code/datums/components/aquarium.dm
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
else
InitializeOther()

ADD_TRAIT(parent, TRAIT_FISH_CASE_COMPATIBILE, src)
ADD_TRAIT(parent, TRAIT_FISH_CASE_COMPATIBILE, REF(src))
RegisterSignal(parent, COMSIG_MOVABLE_MOVED, PROC_REF(enter_aquarium))

//If component is added to something already in aquarium at the time initialize it properly.
Expand Down Expand Up @@ -134,7 +134,7 @@

/datum/component/aquarium_content/PreTransfer()
. = ..()
REMOVE_TRAIT(parent, TRAIT_FISH_CASE_COMPATIBILE, src)
REMOVE_TRAIT(parent, TRAIT_FISH_CASE_COMPATIBILE, REF(src))

/datum/component/aquarium_content/Destroy(force, silent)
if(current_aquarium)
Expand Down
2 changes: 1 addition & 1 deletion code/datums/ert.dm
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
leader_role = /datum/antagonist/ert/lp/lieutenant
roles = list(/datum/antagonist/ert/lp, /datum/antagonist/ert/lp/medic, /datum/antagonist/ert/lp/engineer)
rename_team = "Loss Prevention Team"
polldesc = "a NanoTrasen loss prevention team"
polldesc = "a Nanotrasen loss prevention team"

// Inteq

Expand Down
4 changes: 2 additions & 2 deletions code/game/objects/effects/step_triggers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
return

if(immobilize)
ADD_TRAIT(AM, TRAIT_IMMOBILIZED, src)
ADD_TRAIT(AM, TRAIT_IMMOBILIZED, REF(src))

affecting.Add(AM)
while(AM && !stopthrow)
Expand Down Expand Up @@ -104,7 +104,7 @@

affecting.Remove(AM)

REMOVE_TRAIT(AM, TRAIT_IMMOBILIZED, src)
REMOVE_TRAIT(AM, TRAIT_IMMOBILIZED, REF(src))


/* Stops things thrown by a thrower, doesn't do anything */
Expand Down
4 changes: 2 additions & 2 deletions code/game/objects/items/devices/PDA/PDA.dm
Original file line number Diff line number Diff line change
Expand Up @@ -326,8 +326,8 @@ GLOBAL_LIST_EMPTY(PDAs)

if(6)
dat += "<h4>[PDAIMG(mail)] ExperTrak® Skill Tracker V4.26.2</h4>"
dat += "<i>Thank you for choosing ExperTrak® brand software! ExperTrak® inc. is proud to be a NanoTrasen employee expertise and effectiveness department subsidary!</i>"
dat += "<br><br>This software is designed to track and monitor your skill development as a NanoTrasen employee. Your job performance across different fields has been quantified and categorized below.<br>"
dat += "<i>Thank you for choosing ExperTrak® brand software! ExperTrak® inc. is proud to be a Nanotrasen employee expertise and effectiveness department subsidary!</i>"
dat += "<br><br>This software is designed to track and monitor your skill development as a Nanotrasen employee. Your job performance across different fields has been quantified and categorized below.<br>"
var/datum/mind/targetmind = user.mind
for (var/type in GLOB.skill_types)
var/datum/skill/S = GetSkillRef(type)
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/melee/misc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@
return
if (is_type_in_typecache(target, ovens))
if (held_sausage && held_sausage.roasted)
to_chat("<span class='warning'>Your [held_sausage] has already been cooked!</span>")
to_chat(src, "<span class='warning'>Your [held_sausage] has already been cooked!</span>")
return
if (istype(target, /obj/singularity) && get_dist(user, target) < 10)
to_chat(user, "<span class='notice'>You send [held_sausage] towards [target].</span>")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
/obj/structure/closet/infinite/open(mob/living/user, force = FALSE)
. = ..()
if(. && auto_close_time)
addtimer(CALLBACK(src, PROC_REF(close_on_my_own)), auto_close_time, TIMER_OVERRIDE)
addtimer(CALLBACK(src, PROC_REF(close_on_my_own)), auto_close_time, TIMER_UNIQUE|TIMER_OVERRIDE)

/obj/structure/closet/infinite/proc/close_on_my_own()
if(close())
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/structures/tribal_torch.dm
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
if(!burning)
user.visible_message("<span class='notice'>[user] starts to pull [src] free from the ground....</span>", "<span class='notice'>You start to pull [src] free from the ground...</span>")
if(do_after(user, 20, progress = 1, target = src))
to_chat("<span class='notice'>You pull [src] free from the ground.</span>")
to_chat(user, "<span class='notice'>You pull [src] free from the ground.</span>")
var/torch = new /obj/item/candle/tribal_torch
user.put_in_hands(torch)
qdel(src)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/cargo/blackmarket/blackmarket_market.dm
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
var/price = I.price + shipping[method]
// I can't get the price of the item and shipping in a clean way to the UI, so I have to do this.
if(uplink.money < price)
to_chat("<span class='warning'>You don't have enough credits in [uplink] for [I] with [method] shipping.</span>")
to_chat(user, "<span class='warning'>You don't have enough credits in [uplink] for [I] with [method] shipping.</span>")
return FALSE

if(I.buy(uplink, user, method))
Expand Down
2 changes: 1 addition & 1 deletion code/modules/client/client_procs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ GLOBAL_LIST_INIT(blacklisted_builds, list(
return
..() //redirect to hsrc.Topic()

///dumb workaround because byond doesnt seem to recognize the .proc/Topic() typepath for /datum/proc/Topic() from the client Topic,
///dumb workaround because byond doesnt seem to recognize the PROC_REF(Topic()) typepath for /datum/proc/Topic() from the client Topic,
///so we cant queue it without this

Check failure on line 147 in code/modules/client/client_procs.dm

View workflow job for this annotation

GitHub Actions / Run Linters

Check Regex

Old-style proc references removed from here, update check_regex.yml
/client/proc/_Topic(datum/hsrc, href, list/href_list)
return hsrc.Topic(href, href_list)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/clothing/head/berets.dm
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

/obj/item/clothing/head/beret/archaic
name = "archaic beret"
desc = "An absolutely ancient beret, allegedly worn by the first mime to ever step foot on a NanoTrasen station."
desc = "An absolutely ancient beret, allegedly worn by the first mime to ever step foot on a Nanotrasen station."
icon_state = "archaicberet"
dog_fashion = null

Expand Down
2 changes: 1 addition & 1 deletion code/modules/jobs/job_types/_job.dm
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
if(back_storage)
back_storage.handle_item_insertion(loadout_dumper, TRUE)
else if(!spawnee.put_in_hands(loadout_dumper, TRUE))
to_chat("Unable to place loadout box.")
to_chat(spawnee, "Unable to place loadout box.")

/datum/job/proc/override_latejoin_spawn(mob/living/carbon/human/H) //Return TRUE to force latejoining to not automatically place the person in latejoin shuttle/whatever.
return FALSE
Expand Down
2 changes: 1 addition & 1 deletion code/modules/paperwork/fax.dm
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
*/
/obj/machinery/fax/emag_act(mob/user)
if(!panel_open && !allow_exotic_faxes)
balloon_alert(user, "Open the panel first!")
balloon_alert(user, "open panel first!")
return TRUE
if(!(obj_flags & EMAGGED))
obj_flags |= EMAGGED
Expand Down
2 changes: 1 addition & 1 deletion code/modules/reagents/reagent_containers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
amount_per_transfer_from_this = possible_transfer_amounts[i+1]
else
amount_per_transfer_from_this = possible_transfer_amounts[1]
balloon_alert(user, "Transferring [amount_per_transfer_from_this]u")
balloon_alert(user, "transferring [amount_per_transfer_from_this]u")
return

/obj/item/reagent_containers/attack(mob/M, mob/user, def_zone)
Expand Down
File renamed without changes.
102 changes: 79 additions & 23 deletions tools/ci/check_grep.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,12 @@ fi;
part "common spelling mistakes"
if $grep -i 'nanotransen' $map_files; then
echo
echo -e "${RED}ERROR: Misspelling of Nanotrasen detected in maps, please remove the extra N(s).${NC}"
echo -e "${RED}ERROR: Misspelling(s) of Nanotrasen detected in maps, please remove the extra N(s).${NC}"
st=1
fi;
if $grep 'NanoTrasen' $map_files; then
echo
echo -e "${RED}ERROR: Misspelling(s) of Nanotrasen detected in maps, please uncapitalize the T(s).${NC}"
st=1
fi;
if $grep -i'centcomm' $map_files; then
Expand All @@ -96,28 +101,42 @@ if $grep '^\t+ [^ *]' $code_files; then
st=1
fi;

section "unit tests"
part "mob/living/carbon/human usage"
if $grep 'allocate\(/mob/living/carbon/human[,\)]' code/modules/unit_tests/**/**.dm ||
$grep 'new /mob/living/carbon/human\s?\(' ||
$grep 'var/mob/living/carbon/human/\w+\s?=\s?new' ; then
echo
echo -e "${RED}ERROR: Usage of mob/living/carbon/human detected in a unit test, please use mob/living/carbon/human/consistent.${NC}"
st=1
fi;
#section "unit tests"
#unit_test_files="code/modules/unit_tests/**/**.dm"
#part "mob/living/carbon/human usage"
#if $grep 'allocate\(/mob/living/carbon/human[,\)]' $unit_test_files ||
# $grep 'new /mob/living/carbon/human\s?\(' $unit_test_files ||
# $grep 'var/mob/living/carbon/human/\w+\s?=\s?new' $unit_test_files ; then
# echo
# echo -e "${RED}ERROR: Usage of mob/living/carbon/human detected in a unit test, please use mob/living/carbon/human/consistent.${NC}"
# st=1
#fi;

section "common mistakes"
part "global vars"
if $grep '^/*var/' $code_files; then
echo
echo -e "${RED}ERROR: Unmanaged global var use detected in code, please use the helpers.${NC}"
st=1
echo -e "${RED}ERROR: Unmanaged global var use detected in code, please use the helpers.${NC}"
st=1
fi;

part "proc args with var/"
if $grep '^/[\w/]\S+\(.*(var/|, ?var/.*).*\)' $code_files; then
echo
echo -e "${RED}ERROR: Changed files contains a proc argument starting with 'var'.${NC}"
st=1
echo -e "${RED}ERROR: Changed files contains a proc argument starting with 'var'.${NC}"
st=1
fi;

part "src as a trait source" # ideally we'd lint / test for ANY datum reference as a trait source, but 'src' is the most common.
if $grep -i '(add_trait|remove_trait)\(.+,\s*.+,\s*src\)' $code_files; then
echo
echo -e "${RED}ERROR: Using 'src' as a trait source. Source must be a string key - dont't use references to datums as a source, perhaps use 'REF(src)'.${NC}"
st=1
fi;
if $grep -i '(add_traits|remove_traits)\(.+,\s*src\)' $code_files; then
echo
echo -e "${RED}ERROR: Using 'src' as trait sources. Source must be a string key - dont't use references to datums as sources, perhaps use 'REF(src)'.${NC}"
st=1
fi;

part "balloon_alert sanity"
Expand All @@ -140,6 +159,13 @@ if $grep 'balloon_alert\(.*?, ?"[A-Z]' $code_files; then
st=1
fi;

part "update_icon_updates_onmob element usage"
if $grep 'AddElement\(/datum/element/update_icon_updates_onmob.+ITEM_SLOT_HANDS' $code_files; then
echo
echo -e "${RED}ERROR: update_icon_updates_onmob element automatically updates ITEM_SLOT_HANDS, this is redundant and should be removed.${NC}"
st=1
fi;

part "common spelling mistakes"
if $grep -i 'centcomm' $code_files; then
echo
Expand All @@ -151,22 +177,40 @@ if $grep -ni 'nanotransen' $code_files; then
echo -e "${RED}ERROR: Misspelling(s) of Nanotrasen detected in code, please remove the extra N(s).${NC}"
st=1
fi;
if $grep 'NanoTrasen' $code_files; then
echo
echo -e "${RED}ERROR: Misspelling(s) of Nanotrasen detected in code, please uncapitalize the T(s).${NC}"
st=1
fi;

part "map json sanity"
for json in _maps/configs/*.json
do
map_path=$(jq -r '.map_path' $json)
while read map_file; do
filename="_maps/$map_path/$map_file"
if [ ! -f $filename ]
then
echo
echo -e "${RED}ERROR: Found an invalid file reference to $filename in _maps/$json ${NC}"
st=1
fi
done < <(jq -r '[.map_file] | flatten | .[]' $json)
if [ ! -f $map_path ]
then
echo
echo -e "${RED}ERROR: Found an invalid file reference to $map_path in $json ${NC}"
st=1
fi
done

part "updatepaths validity"
missing_txt_lines=$(find tools/UpdatePaths/Scripts -type f ! -name "*.txt" | wc -l)
if [ $missing_txt_lines -gt 0 ]; then
echo
echo -e "${RED}ERROR: Found an UpdatePaths File that doesn't end in .txt! Please add the proper file extension!${NC}"
st=1
fi;

number_prefix_lines=$(find tools/UpdatePaths/Scripts -type f | wc -l)
valid_number_prefix_lines=$(find tools/UpdatePaths/Scripts -type f | $grep -P "\d+_(.+)" | wc -l)
if [ $valid_number_prefix_lines -ne $number_prefix_lines ]; then
echo
echo -e "${RED}ERROR: Detected an UpdatePaths File that doesn't start with the PR number! Please add the proper number prefix!${NC}"
st=1
fi;

section "515 Proc Syntax"
part "proc ref syntax"
if $grep '\.proc/' $code_x_515 ; then
Expand All @@ -177,6 +221,12 @@ fi;

if [ "$pcre2_support" -eq 1 ]; then
section "regexes requiring PCRE2"
part "empty variable values"
if $grep -PU '{\n\t},' $map_files; then
echo
echo -e "${RED}ERROR: Empty variable value list detected in map file. Please remove the curly brackets entirely.${NC}"
st=1
fi;
part "to_chat sanity"
if $grep -P 'to_chat\((?!.*,).*\)' $code_files; then
echo
Expand All @@ -195,6 +245,12 @@ if [ "$pcre2_support" -eq 1 ]; then
echo -e "${RED}ERROR: File(s) with no trailing newline detected, please add one.${NC}"
st=1
fi
#part "improper atom initialize args"
#if $grep -P '^/(obj|mob|turf|area|atom)/.+/Initialize\((?!mapload).*\)' $code_files; then
# echo
# echo -e "${RED}ERROR: Initialize override without 'mapload' argument.${NC}"
# st=1
#fi;
else
echo -e "${RED}pcre2 not supported, skipping checks requiring pcre2"
echo -e "if you want to run these checks install ripgrep with pcre2 support.${NC}"
Expand Down

0 comments on commit 5b95509

Please sign in to comment.