Files
fulpstation/.github/guides/AUTODOC.md
A miscellaneous Fern 9bd86e85b5 June/July TGU: Loadout menu, flatpackers and... whatever else! (#1230)
* Initial Commit

* Not quite all was staged, apparently.

* Multiline no longer necessary

* For my convenience...

* Forgot an important little tidbit in routes.tsx

* This updated, apparently.

* And now hell breaks loose

* First batch

* Second Batch

* Third batch (Unit Tests)

* Improvised shotgun ammo is gone; Vibebots are refactored

* UpdatePath sweeps in our fulp_modules/_maps folder

* I can't bring myself to do it.

* Map stuff

* Didn't mean to leave this uncommented

* I carpet-bombed them with Find-Replace. Let's see what linters think

* I sure do hope this is comprehensive and doesn't break other things

* This may take a while

* Next Round

* Hopefully the last batch before getting on with actual fixes

* Telescreens

* :/

* Stragglers

* Helio Emergency Shuttle; NearStation adjustments.

* Only one more commit for greenchecks... Shuttle code be dammed.

* Pff, the file was missing

* Same treatment as the other map files.

* Missed a comma :P

* BZ chambers for Xenobiology

* Odd. Most of these got done earlier. Not sure why this one wasn't.

* Mapping sweep. I didn't adjust C_tags in Theia. Another time.

* The balloon alerts overlap

* I hate TGU I hate TGU

* I meant to say "I hate TG" on the last one. Freudian slip.

* Fix Fix

* Nanite research cost rebalance

* TGU-Update: Step 0

* Yeah I figured it'd do this.

* I accidentally undid this

* Failed to catch this one

* I don't trust hundredths not to break or be broken somewhere.

* Little air alarm tweaks

* Ports #1228

* Stuff I missed

* Silly

* TGU so nice we're going to make it thrice

* Yarn

* Should be all? Fixes cult stun too.

* Thermomachine layers

* Free square spellcheck to rerun tests and see if it's consistent

* All credit goes to QLA for reminding me to actually do this

* Update to e40becd742

* github folder
2024-08-06 20:17:51 -04:00

4.1 KiB

dmdoc

DMDOC is a documentation generator for DreamMaker, the scripting language of the BYOND game engine. It produces simple static HTML files based on documented files, macros, types, procs, and vars.

We use dmdoc to generate DOCUMENTATION for our code, and that documentation is automatically generated and built on every new commit to the master branch

This gives new developers a clickable reference DOCUMENTATION they can browse to better help gain understanding of the /tg/station codebase structure and api reference.

Documenting code on /tg/station

We use block comments to document procs and classes, and we use /// line comments when documenting individual variables.

It is required that all new code be covered with DMdoc code, according to the Requirements

We also require that when you touch older code, you must document the functions that you have touched in the process of updating that code

Required

A class must always be autodocumented, and all public functions must be documented

All class level defined variables must be documented

Internal functions should be documented, but may not be

A public function is any function that a developer might reasonably call while using or interacting with your object. Internal functions are helper functions that your public functions rely on to implement logic

Documenting a proc

When documenting a proc, we give a short one line description (as this is shown next to the proc definition in the list of all procs for a type or global namespace), then a longer paragraph which will be shown when the user clicks on the proc to jump to its definition

/**
 * Short description of the proc
 *
 * Longer detailed paragraph about the proc
 * including any relevant detail
 * Arguments:
 * * arg1 - Relevance of this argument
 * * arg2 - Relevance of this argument
 */

Documenting a class

We first give the name of the class as a header, this can be omitted if the name is just going to be the typepath of the class, as dmdoc uses that by default

Then we give a short oneline description of the class

Finally we give a longer multi paragraph description of the class and its details

/**
 * # Classname (Can be omitted if it's just going to be the typepath)
 *
 * The short overview
 *
 * A longer
 * paragraph of functionality about the class
 * including any assumptions/special cases
 *
 */

Documenting a variable/define

Give a short explanation of what the variable, in the context of the class, or define is.

/// Type path of item to go in suit slot
var/suit = null

Module level description of code

Modules are the best way to describe the structure/intent of a package of code where you don't want to be tied to the formal layout of the class structure.

On /tg/station we do this by adding markdown files inside the code directory that will also be rendered and added to the modules tree. The structure for these is deliberately not defined, so you can be as freeform and as wheeling as you would like.

Here is a representative example of what you might write

Special variables

You can use certain special template variables in DM DOC comments and they will be expanded

    [DEFINE_NAME] - Expands to a link to the define definition if documented
    [/mob] - Expands to a link to the docs for the /mob class
    [/mob/proc/adjust_drunk_effect] - Expands to a link that will take you to the /mob class and anchor you to the adjust_drunk_effect proc docs
    [/mob/var/stat] - Expands to a link that will take you to the /mob class and anchor you to the stat var docs

You can customise the link name by using [link name][link shorthand].

eg. [see more about adjust drunk effect here] [/mob/proc/adjust_drunk_effect]

This is very useful to quickly link to other parts of the autodoc code to expand upon a comment made, or reasoning about code