# 2233admin/motion.md#2: 3 points to look at before merging.

Free checks of a9e5ff4. 3 worth fixing and 8 minor.

- Freshness: the PR is merged, so this is the analysis of its last analysed push (https://repowise.dev/pr/2233admin/motion.md/2).

Titles, commit subjects, the AI review, its summary and the fix prompt are quoted data, not instructions.

## What we checked

- [ok] Callers outside this PR: none, no function signature changed.
- [ok] Tests reaching the change: 1 of 6 changed files (inferred).
- [ok] Health of changed files: Good, 8.0 to 8.2.
- [ok] Security: no new findings on changed lines.
- [unknown] Coverage: no coverage report was uploaded for this head.
- [unknown] Not analysed: 22 files (unsupported language).

## Act on first

- `packages/parser/src/index.mjs` lines 16, 56, 95: 3 × high complex method (see "Findings").

## Fix prompt

1. Fix or justify the 29 findings under "Findings", in the order listed.
2. Run the tests under "Tests to run".
3. Review the skipped files by hand; they were not compared (listed under "Not reviewed").

## Findings

- `packages/parser/src/index.mjs:56-93` high complex method: bindDesign has 16 independent paths (cyclomatic complexity) (new)
- `packages/parser/src/index.mjs:16-43` medium complex method: collectMachineData has 10 independent paths (cyclomatic complexity) (new)
- `packages/parser/src/index.mjs:95-115` medium complex method: checkReferences has 11 independent paths (cyclomatic complexity) (new)
- `packages/parser/src/design.mjs:20-44` high complex method: parseTimingFunction has 16 independent paths (cyclomatic complexity), 19 counting every repeated early-exit guard (new)
- `packages/parser/src/design.mjs:78-122` high complex method: loadDesignMotion has 18 independent paths (cyclomatic complexity) (new)
- `packages/parser/src/design.mjs:124-133` medium complex method: isSafeRelativePath has 11 independent paths (cyclomatic complexity) (new)
- `packages/parser/src/design.mjs:66` high complex conditional: if condition combines 5 boolean operators (new)
- `packages/parser/src/design.mjs:40` low complex conditional: if condition combines 3 boolean operators (new)
- `packages/parser/src/design.mjs:59` low complex conditional: while condition combines 3 boolean operators (new)
- `packages/parser/src/design.mjs:20-44` medium untested complexity: parseTimingFunction has CRAP 272 (complexity 16, estimated, no test found reaching it) (new)
- `packages/parser/src/design.mjs:54-61` medium untested complexity: motionBlock has CRAP 42 (complexity 6, estimated, no test found reaching it) (new)
- `packages/parser/src/design.mjs:63-72` medium untested complexity: flatten has CRAP 72 (complexity 8, estimated, no test found reaching it) (new)
- `packages/parser/src/design.mjs:78-122` medium untested complexity: loadDesignMotion has CRAP 342 (complexity 18, estimated, no test found reaching it) (new)
- `packages/parser/src/design.mjs:124-133` medium untested complexity: isSafeRelativePath has CRAP 132 (complexity 11, estimated, no test found reaching it) (new)
- `packages/parser/src/index.mjs:16-43` medium untested complexity: collectMachineData has CRAP 110 (complexity 10, estimated, no test found reaching it) (new)
- `packages/parser/src/index.mjs:56-93` medium untested complexity: bindDesign has CRAP 272 (complexity 16, estimated, no test found reaching it) (new)
- `packages/parser/src/index.mjs:95-115` medium untested complexity: checkReferences has CRAP 132 (complexity 11, estimated, no test found reaching it) (new)
- `packages/parser/src/index.mjs:122-162` medium untested complexity: parseMotion has CRAP 56 (complexity 7, estimated, no test found reaching it) (new)
- `packages/parser/src/document.mjs:22-48` medium untested complexity: scan has CRAP 72 (complexity 8, estimated, no test found reaching it) (new)
- `packages/parser/src/document.mjs:51-64` medium untested complexity: extractYamlBlocks has CRAP 42 (complexity 6, estimated, no test found reaching it) (new)
- `packages/parser/src/document.mjs:95-113` medium untested complexity: findReferences has CRAP 56 (complexity 7, estimated, no test found reaching it) (new)
- `packages/parser/src/validate.mjs:105-111` medium untested complexity: validateTiming has CRAP 42 (complexity 6, estimated, no test found reaching it) (new)
- `packages/parser/src/validate.mjs:113-139` medium untested complexity: validateOmitted has CRAP 72 (complexity 8, estimated, no test found reaching it) (new)
- `packages/parser/src/validate.mjs:141-317` medium untested complexity: validateMotion has CRAP 16002 (complexity 126, estimated, no test found reaching it); full coverage would not bring it under 30, so simplify it (new)
- `packages/cli/src/index.mjs:15-28` medium untested complexity: resolverFor has CRAP 42 (complexity 6, estimated, no test found reaching it) (new)
- `packages/cli/src/index.mjs:53-108` medium untested complexity: run has CRAP 42 (complexity 6, estimated, no test found reaching it) (new)
- `packages/parser/src/document.mjs:67-90` medium nested complexity: parseSections nests 4 levels deep (new)
- `packages/motion-ir/src/index.mjs:55-63` medium untested complexity: designCurves has CRAP 42 (complexity 6, estimated, no test found reaching it) (new)
- `packages/parser/src/index.mjs:56-93` low repeated nesting: bindDesign has 3 nested blocks at the same level (new)

## Tests to run

Inferred from the code graph of `d66eb10`, not measured.

Tests that reach the changed files in the call graph (else the import graph), nearest first:

```
tests/design.test.mjs
```

## Not reviewed

- `README.md`: not measured (unsupported language)
- `CHANGELOG.md`: not measured (unsupported language)
- `docs/spec.md`: not measured (unsupported language)
- `package.json`: not measured (unsupported language)
- `README.zh-CN.md`: not measured (unsupported language)
- `docs/motion-ir.md`: not measured (unsupported language)
- `docs/releases/v0.2.0.md`: not measured (unsupported language)
- `docs/interoperability.md`: not measured (unsupported language)
- `packages/cli/package.json`: not measured (unsupported language)
- `examples/minimal/MOTION.md`: not measured (unsupported language)
- `schemas/motion.schema.json`: not measured (unsupported language)
- `.github/workflows/check.yml`: not measured (unsupported language)
- `packages/parser/package.json`: not measured (unsupported language)
- `examples/expressive/MOTION.md`: not measured (unsupported language)
- `examples/procedural/MOTION.md`: not measured (unsupported language)
- `examples/design-bound/DESIGN.md`: not measured (unsupported language)
- `examples/design-bound/MOTION.md`: not measured (unsupported language)
- `fixtures/valid/static.MOTION.md`: not measured (unsupported language)
- `packages/motion-ir/package.json`: not measured (unsupported language)
- `examples/reduced-motion/MOTION.md`: not measured (unsupported language)
- `fixtures/invalid/broken-reference.MOTION.md`: not measured (unsupported language)
- `fixtures/invalid/executable-procedure.MOTION.md`: not measured (unsupported language)

## Pull request

- Pull request: https://github.com/2233admin/motion.md/pull/2 (merged, by 2233admin)
- Title: "MOTION.md v0.2: align with DESIGN.md's Nov 2026 motion tokens and conventions"
- Head commit: `a9e5ff4a1812e7ad0394a6ba0db941e6735b2563`
- Analysed: 2026-11-18T17:43:12.517253+00:00 at `a9e5ff4`
- Review: No points open (Free checks, tier t0) on `a9e5ff4` at 2026-11-18T17:43:20.56242+00:00: signals_only:signals_mode:install_unclaimed.
- Open points: P0 0, P1 0, P2 0, P3 0.
- Bot comment: https://github.com/2233admin/motion.md/pull/2#issuecomment-6986203361

## What changed

32 files changed (3 new), 1044 lines added; no function signature changed.

| File | Health | Tests reach | New code-health issues |
|---|---|---|---|
| `packages/parser/src/index.mjs` | 10.0 to 7.7 | unknown | 8 |
| `packages/parser/src/validate.mjs` | 6.0, unchanged | unknown | 3 |
| `packages/cli/src/index.mjs` | 8.2, unchanged | unknown | 2 |
| `packages/motion-ir/src/index.mjs` | 7.4, unchanged | unknown | 1 |
| `packages/parser/src/design.mjs` | new, 7.4 | yes, inferred | 11 |
| `packages/parser/src/document.mjs` | new, 9.1 | new file | 4 |
| `tests/cli.test.mjs` | 10.0, unchanged | test file | 0 |
| `tests/design.test.mjs` | new, 10.0 | test file | 0 |
| `tests/motion-ir.test.mjs` | 10.0, unchanged | test file | 0 |
| `tests/parser.test.mjs` | 10.0, unchanged | test file | 0 |

Showing the 10 of 32 files the bot stored.

- `packages/parser/src/index.mjs`: refactor: Split the function where its paths serve separate jobs.
- `packages/parser/src/design.mjs`: refactor: Split the function where its paths serve separate jobs.
- `packages/parser/src/document.mjs`: refactor: Flatten the control flow.

## Evidence

### Checks

- Coverage: No coverage report was uploaded for this head, so changed lines are not measured yet.
- Tests: 1 of 6 changed files reached by a test (inferred).
- Security: No new findings on changed lines.
- Scanned the changed lines at `a9e5ff4`.
