mirror of
https://github.com/fulpstation/fulpstation.git
synced 2025-12-10 10:01:40 +00:00
Adds linting guidelines to CONTRIBUTING.md (#54646)
This commit is contained in:
21
.github/CONTRIBUTING.md
vendored
21
.github/CONTRIBUTING.md
vendored
@@ -329,6 +329,27 @@ This is good:
|
|||||||
* [tgui/README.md](../tgui/README.md)
|
* [tgui/README.md](../tgui/README.md)
|
||||||
* [tgui/tutorial-and-examples.md](../tgui/docs/tutorial-and-examples.md)
|
* [tgui/tutorial-and-examples.md](../tgui/docs/tutorial-and-examples.md)
|
||||||
|
|
||||||
|
### Signal Handlers
|
||||||
|
All procs that are registered to listen for signals using `RegisterSignal()` must contain at the start of the proc `SIGNAL_HANDLER` eg;
|
||||||
|
```
|
||||||
|
/type/path/proc/signal_callback()
|
||||||
|
SIGNAL_HANDLER
|
||||||
|
// rest of the code
|
||||||
|
```
|
||||||
|
This is to ensure that it is clear the proc handles signals and turns on a lint to ensure it does not sleep.
|
||||||
|
|
||||||
|
There exists `SIGNAL_HANDLER_DOES_SLEEP`, but this is only for legacy signal handlers that still sleep, new/changed code may not use this.
|
||||||
|
|
||||||
|
### Enforcing parent calling
|
||||||
|
When adding new signals to root level procs, eg;
|
||||||
|
```
|
||||||
|
/atom/proc/setDir(newdir)
|
||||||
|
SHOULD_CALL_PARENT(TRUE)
|
||||||
|
SEND_SIGNAL(src, COMSIG_ATOM_DIR_CHANGE, dir, newdir)
|
||||||
|
dir = newdir
|
||||||
|
```
|
||||||
|
The `SHOULD_CALL_PARENT(TRUE)` lint should be added to ensure that overrides/child procs call the parent chain and ensure the signal is sent.
|
||||||
|
|
||||||
### Other Notes
|
### Other Notes
|
||||||
* Code should be modular where possible; if you are working on a new addition, then strongly consider putting it in its own file unless it makes sense to put it with similar ones (i.e. a new tool would go in the "tools.dm" file)
|
* Code should be modular where possible; if you are working on a new addition, then strongly consider putting it in its own file unless it makes sense to put it with similar ones (i.e. a new tool would go in the "tools.dm" file)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user