Repository navigation
hw/gen: --format json, the generator's findings for tools - #144
Merged
Merged
Conversation
validate, generate and check take --format json: one JSON document on standard output and nothing else, its shape in hw/schemas/diagnostics.schema.json. It holds the status and exit code, every finding with its file, line, node path and message apart (and the line the text output prints), the rule it concerns (HW-001, HW-002, HW-003), each outdated generated file's diff, the files written and the boards checked. A failure of the generator itself, as the Python 3.11 one was, still yields a document (internal-error, exit status 3), its trace on standard error. EmbLink Studio's first stage reads it. The findings are taken apart from the HW-002 text in one place (emb_hwgen/diagnostics.py); every error the negative tests raise must come back whole from its parts, which found node paths holding a compatible (bindings.st,stm32f4-iwdg.class). The Diagnostics tests check each outcome's document against the schema. Text output is unchanged. Signed-off-by: teo1747 <motsoujunior17@gmail.com>
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Nov 13, 2026
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Nov 13, 2026
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Nov 13, 2026
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Nov 13, 2026
…ostics Signed-off-by: teo1747 <motsoujunior17@gmail.com>
Main checks every file's header since #143; this one was written before it. Signed-off-by: teo1747 <motsoujunior17@gmail.com>
Both changed emb-hwgen.py. Every command now writes through #146's three-way writer (A126) and takes --format json, a board or a system alike: an application's description validates and generates with a document too, a merge conflict generate leaves is an HW-003 finding (status stale, exit 1), and check reports its stale files as findings in both formats and counts the systems it checked (the schema gains 'systems'). The text output prints each finding's line, then its diff. hw/gen's 190 tests pass and check --strict is clean. Signed-off-by: teo1747 <motsoujunior17@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What it adds
emb-hwgen validate,generateandchecktake--format json. The command then prints a single JSON document on standard output and nothing else.hw/schemas/diagnostics.schema.jsondefines the document. EmbLink Studio's first stage (S1) reads it, so the IDE never parses text.{ "tool": "emb-hwgen", "version": "0.1.0", "format": 1, "command": "validate", "status": "errors", "exit_code": 2, "files": [], "diagnostics": [ {"severity": "error", "rule": "HW-002", "file": "boards/st/nucleo_f446re/board.yaml", "line": 26, "path": "console.baud", "message": "expected integer, found string 'fast'", "text": "boards/st/nucleo_f446re/board.yaml:26: console.baud: expected integer, found string 'fast'"} ] }statusandexit_code:ok(exit 0): warnings are still possible;errors(exit 2): the descriptions are wrong;stale(exit 1):checkfound outdated outputs or hardware facts outside a description;internal-error(exit 3): the generator itself failed. The document carries the exception's type and message, and the traceback goes to stderr. The Python 3.11 crash (hw/gen, ci: the generator's clock errors on Python 3.10 and 3.11 #142) would have reached the IDE this way.ruleis HW-002, HW-001 or HW-003;fileslists whatgeneratewrote, andboardscounts whatcheckchecked.formatis the document's own version: a new field keeps it, and a changed or removed field bumps it.Text output is unchanged.
How it's built and tested
file:line: node.path: message) in one place,emb_hwgen/diagnostics.py.bindings.st,stm32f4-iwdg.class), which the pattern now allows.generate's file list, stale output with its diff, a board root withoutboards/, an internal error, and Windows and HW-001 lines. Each document is validated against the schema with the in-tree validator.Fractionbug that hw/gen, ci: the generator's clock errors on Python 3.10 and 3.11 #142 fixes.docs/engineering/hwgen.mddocuments the output, with an example taken from a real run, and the docs build passes.Signed-off-by: teo1747 motsoujunior17@gmail.com