[MIRROR] Adds a check grep for using src as a trait source rather that REF(src) [MDB IGNORE] (#23264)

* Adds a check grep for using `src` as a trait source rather that `REF(src)` (#77836)

## About The Pull Request

Using `src` as a trait source is an error and can often lead to
hard-deletes

If you wish to tie a source to a certain datum, it is common to use
`REF(src)` instead.

Ideally, we would lint or test for any use of a reference rather than a
string in use in trait sources, but that's a bit harder to setup.
Currently (from what I can see) the *only* erroneous use of references
as sources are via `src`, so it being the most common error, I see it
fine to lint for it.

## Changelog

Nothing player facing.

* Adds a check grep for using `src` as a trait source rather that `REF(src)`

* Update style.dm

---------

Co-authored-by: MrMelbert <51863163+MrMelbert@users.noreply.github.com>
Co-authored-by: Giz <13398309+vinylspiders@users.noreply.github.com>
This commit is contained in:
SkyratBot
2023-08-23 01:18:53 -04:00
committed by GitHub
co-authored by MrMelbert Giz
parent ab236fd886
commit 53955051d0
8 changed files with 25 additions and 13 deletions
+2 -2
View File
@@ -98,7 +98,7 @@
RegisterSignal(src, COMSIG_ATOM_TOOL_ACT(TOOL_MULTITOOL), PROC_REF(on_parent_multitool))
ADD_TRAIT(mob_parent, TRAIT_STYLISH, src) // SKYRAT EDIT ADD - allows style meter chads to do flips
ADD_TRAIT(mob_parent, TRAIT_STYLISH, REF(src)) // SKYRAT EDIT ADD - allows style meter chads to do flips
/datum/component/style/RegisterWithParent()
RegisterSignal(parent, COMSIG_MOB_ITEM_AFTERATTACK, PROC_REF(hotswap))
@@ -152,7 +152,7 @@
if(mob_parent.hud_used)
mob_parent.hud_used.static_inventory -= meter
mob_parent.hud_used.show_hud(mob_parent.hud_used.hud_version)
REMOVE_TRAIT(mob_parent, TRAIT_STYLISH, src) // SKYRAT EDIT ADD - allows style meter chads to do flips
REMOVE_TRAIT(mob_parent, TRAIT_STYLISH, REF(src)) // SKYRAT EDIT ADD - allows style meter chads to do flips
return ..()