mirror of
https://github.com/brazilofmux/tinymux
synced 2026-08-13 00:23:11 -04:00
softcode_lint.py — static analysis of MUX softcode:
Checks:
Balanced brackets [ ], parentheses ( ), braces { }
Known function names (~200 TinyMUX functions)
Valid substitution patterns (%#, %0-%9, %q0-%qz, %va-%vz, etc.)
Dangerous commands (@force, @destroy, @toad, @shutdown, etc.)
Integrated into worldbuilder.py as 'lint' action:
worldbuilder.py lint spec.yaml
Also available standalone:
softcode_lint.py spec.yaml — lint a YAML spec
softcode_lint.py --raw code.txt — lint raw softcode text
Test: softcode_test.yaml exercises all check types
5 errors (unclosed delimiters, dangerous @force)
2 warnings (unknown function, invalid %z substitution)
Town spec with real attributes passes cleanly
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
24 lines
694 B
YAML
24 lines
694 B
YAML
zone:
|
|
name: Softcode Test
|
|
|
|
rooms:
|
|
good_room:
|
|
name: Good Room
|
|
description: |
|
|
A room with properly written softcode attributes.
|
|
attrs:
|
|
ACONNECT: "@pemit %#=Welcome to the room!"
|
|
SMELL: "[if(gt(secs(),0),You smell flowers.,Nothing.)]"
|
|
LOOK_CMD: "$look *:@pemit %#=[get(%!/DESC)]"
|
|
|
|
bad_room:
|
|
name: Bad Room
|
|
description: |
|
|
A room with softcode problems for the linter to catch.
|
|
attrs:
|
|
BROKEN_BRACKETS: "[pemit(%#,Hello"
|
|
BROKEN_PARENS: "@pemit %#=[add(1,2]"
|
|
BROKEN_BRACES: "@switch 1=1,{@pemit %#=Hi"
|
|
UNKNOWN_FUNC: "[bogusfunction(1,2,3)]"
|
|
DANGEROUS: "@force %#=DROP ALL"
|
|
BAD_SUB: "Hello %z invalid sub"
|