Contribution & Coding Standards
Relevant source files
The following files were used as context for generating this wiki page:
The BandaStation project enforces specific coding practices and contribution workflows to maintain code quality and system stability. These standards cover code formatting, automated linting, changelog management, and database schema versioning.
Code Linting and Formatting
The project uses automated scripts to enforce syntax and style rules. Developers must use tab indentation for DM code and avoid mixed indentation. Files must use LF (Unix) line endings rather than CRLF.
DM Code Restrictions
Automated checks prevent common mistakes and outdated syntax in DreamMaker (DM) code.
- Variable Management: Do not use unmanaged global variables; use project-specific helpers instead.
- Indentation: Use tabs for indentation. The linter flags any space indentation or mixed
<tab><space>usage. - Macros and Helpers: Use
LOWER_TEXT()instead of the BYOND-levellowertext(). UseGAME_VERB()orADMIN_VERB()instead of manual verb attribute sets. - Safe Trait Usage: Trait sources must be string keys. Do not use datum references (like
src) as trait sources; useREF(src)if necessary.
Sources: tools/ci/check_grep.sh:100-110, tools/ci/check_grep.sh:140-150, tools/ci/check_grep.sh:178-185
Local Define Sanity
To prevent namespace pollution, local #define statements must be cleaned up within the same file.
The diagram shows the logic used by the define sanity tool to ensure local defines do not leak into the global scope.
Sources: tools/define_sanity/check.py:65-85
TGUI Development Standards
TGUI is the project's React-based user interface framework. It relies on JavaScript and web technologies rather than native DM interfaces.
Technical Requirements
- Runtime: Bun v1.2.16+ is required for building and dependency management.
- Styling: Styles use SASS (SCSS). Atomic CSS classes are preferred for simple appearance changes.
- Linting: Developers should run
bun tgui:lintto auto-fix code problems before submitting Pull Requests.
Build and Test Commands
| Command | Action |
|---|---|
bin/tgui-build | Full production build with CI checks |
bin/tgui-dev | Launches development server |
bun tgui:tsc | Runs TypeScript compiler checks |
bun tgui:test | Executes unit and integration tests |
Sources: tgui/README.md:1-20, tgui/README.md:40-65
Changelog Management
Every player-facing change requires a changelog entry. These are individual .yml files stored in html/changelogs/.
Creation Process
- Create a
.ymlfile named[USERNAME]-PR-[NUMBER].yml. - Set the
authorfield to your username. - List changes using valid prefixes (e.g.,
bugfix,rscadd,qol). - Ensure the file is included in your commit.
Valid Prefixes
| Prefix | Usage |
|---|---|
bugfix | Fixes existing bugs |
rscadd | Adds a new feature |
rscdel | Removes a feature |
balance | Changes to game balance |
refactor | Internal code changes with no gameplay impact |
Sources: html/changelogs/example.yml:10-30, html/changelogs/__CHANGELOG_README.txt:10-20
Database Standards
When modifying the database schema, developers must update the versioning table and corresponding code defines.
- Schema Increment: Increment the minor version for general changes and the major version for significant overhauls.
- Code Sync: Update
DB_MAJOR_VERSION_220andDB_MINOR_VERSION_220insubsystems.dm. - Version Tracking: Insert a new record into
schema_revision_220after modifying the schema.
Sources: SQL/bandastation/database_changelog.md:1-10
Map Standards
Maps must be saved in the TGM format to minimize merge conflicts.
- TGM Format: Non-TGM formatted maps detected by CI will trigger a failure.
- Cleaning: CI scripts check for unexpected comments, invalid procs in variables, and outdated armor lists in map files.
- Pathing: Map
.jsonfiles must use all lowercase naming.
Sources: tools/ci/check_grep.sh:45-65, tools/ci/check_grep.sh:220-225
Summary
Adhering to these standards ensures that BandaStation remains maintainable and that automated tooling can effectively catch errors before they reach production. Consistent use of provided linters and build scripts is mandatory for all contributors.