Run gf doc before reading library source code to infer an API.
gf doc ORG/LIB # library overview and function index
gf doc ORG/LIB "FUNC" # documentation and examples for one function
gf doc "FUNC" # fuzzy search across libraries
gf doc --build-json # rebuild the index after test files changeDocumentation comes from tests/. Keep syntax, parameters, return values, and
error behavior documented at the top of each test file.
gf check 的 unit-test 规则按报错提示修复,不要去看 gf check 的实现:
- 测试文件顶部文档只认可
语法、参数、返回值三个小节标题(后跟;; ----下划线行);出现错误行为等其他小节标题会报未知的小节标题【...】, 把错误行为说明并入返回值描述或写成普通;;正文(不带下划线分隔)。 max-tree-depth超限(默认 <= 15)时按报错提示的文件/行号降低该处嵌套层数 (提取 let* 中间量、拆辅助函数等),不要改宽全局阈值。- 其他规则(如
缺少导出函数 ... 的单元测试)按提示补对应测试文件或修正归 属,不要修改gf check本身。
gf test # all tests
gf test tests/liii/string/ # tests in a directory
gf test string-test.scm # one test file
gf test string # tests whose path contains "string"
gf test --changed-since=HEAD # changed test files only
gf test -V tests/liii/json/ # full output for failuresTest files must end with -test.scm.
测试策略:不要轻易在本地运行全量测试(gf test)。开发和调试时只运行与当前改动相关的针对性测试(如单个测试文件或目录)。策略是先 gh pr 提交到 GitHub 触发 CI,然后在等待 CI 的过程中再去运行全量测试。
Run gf fmt before committing.
gf fmt # format the repository
gf fmt file.scm # format one file
gf fmt path/to/dir # format a directory recursively
gf fmt --changed-since=HEAD # format files changed since HEAD
gf fmt --check # check without modifying filesScheme (.scm/.sld), C++, and stem sources are supported.
- 保持
cond的可读性优势:cond擅长平铺分支规则、状态机/循环基线分流以及按参数个数重载分流,结构直观类似决策表。不要为了缩减代码行数而机械地将清晰的cond改写为复杂的布尔表达式(and/or)或增加嵌套if/let。 - 小 PR 原则:重构 PR 尽量聚焦单文件或单一职责,保证改动自包含且独立可验证,避免跨文件大范围混杂改动。