# validate

> **Tool `tools/formats/validate.py`** (program, Formats). Run a decoder over every file of a type and report which files fail or leave bytes unread.

Run it with `./gameframe run validate ARGS` or `python3 tools/formats/validate.py`. [Source on GitHub](https://github.com/tanepiper/game-frame/blob/main/tools/formats/validate.py).

## Its own help

This is the help text in the tool itself, as `./gameframe tool validate` prints it.

```text
Run a decoder over every file of a type and report which files fail or leave bytes unread.

Usage: validate.py DECODER.py GLOB [GLOB ...] [--show N]

DECODER.py defines `decode(reader)`, which reads one whole file from a `Reader` (reader.py) and
returns what it found; validate.py then calls `reader.done()`, so a file with unread bytes
counts as a failure. A decoder is right only when every file of its type passes: one sample is
not enough, because optional fields and version differences show up in a few files only.
`--show N` prints the result of the first N files. Exit status 1 if any file fails.

    validate.py examples/sample-game/decode_sample.py 'examples/sample-game/build/*.dat' --show 1
```

## Named by

Skills: [re-format](/skills/re-format).

Agents: [re-decoder](/agents/re-decoder).
