Repository navigation
docs: simplify guides and document CLI flags #49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,44 +1,30 @@ | ||
| # Contributing | ||
|
|
||
| Thanks for helping improve the CodeGen Compare Tool. This file is the short | ||
| version of what CI enforces; [`docs/architecture.md`](docs/architecture.md) is | ||
| the map of how the pieces fit and why. | ||
| Read [AGENTS.md](AGENTS.md) for constraints and [Architecture](docs/architecture.md) for module ownership. | ||
|
|
||
| ## Setup | ||
|
|
||
| No install is needed to run the tool or the tests — the core is standard | ||
| library only. | ||
| From the repository folder: | ||
|
|
||
| ```bash | ||
| git clone https://github.com/longvo92/codegen-compare-tool.git | ||
| cd codegen-compare-tool | ||
| python -m pip install ruff mypy | ||
| python -m compare_tool --help | ||
| ``` | ||
|
|
||
| The viewer and its tests need PySide6: | ||
| The CLI and core tests need no runtime dependencies. Install the optional viewer for GUI work: | ||
|
|
||
| ```bash | ||
| pip install "PySide6>=6.5" | ||
| python -m pip install -e ".[viewer]" | ||
| ``` | ||
|
|
||
| ## Two hard constraints | ||
| ## Change requirements | ||
|
|
||
| These are checked automatically ([`tests/test_stdlib_only.py`](tests/test_stdlib_only.py)), | ||
| not left to reviewers to remember: | ||
| - Support Python 3.8+ and keep the core/zipapp standard-library only. | ||
| - Keep Qt imports in `compare_tool/qtviewer/`; shared models must work without Qt. | ||
| - Test new noise rules with both a noise-only case and a nearby real change. | ||
| - Keep CLI, viewer and report decisions consistent. | ||
| - Update task-oriented English/Vietnamese guides when usage changes. Put release notes in [CHANGELOG.md](CHANGELOG.md). | ||
|
|
||
| 1. **The compare core is standard library only.** Everything under | ||
| `compare_tool/` except `compare_tool/qtviewer/` ships inside | ||
| `compare_tool.pyz`, the documented fallback for machines where antivirus | ||
| blocks the `.exe`. One third-party import there and the zipapp stops running | ||
| on exactly those machines. If you genuinely need a library in the core, say | ||
| so in the PR — it is a real trade-off (it costs the `.pyz` and the "zero | ||
| dependencies" line), not something to slip in. | ||
| 2. **PySide6 lives only under `compare_tool/qtviewer/`,** imported lazily when | ||
| the viewer opens. `tree.py` and `summary_model.py` stay Qt-free so the suite | ||
| runs headless. | ||
| ## Verification | ||
|
|
||
| Python 3.8 is a shipped promise: no `match`, no `X | Y` at runtime, and | ||
| `list[str]` in an annotation needs `from __future__ import annotations`. | ||
|
|
||
|
|
||
| Issues and pull requests are welcome. | ||
| Run the [checks and relevant smoke tests](docs/architecture.md#verification) before opening a PR. Documentation-only changes need link, example and diff checks. |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,126 +1,68 @@ | ||
| <p align="center"> | ||
| <img src="resources/logo/logo-full.png" alt="CodeGen Compare Tool" width="360"> | ||
| </p> | ||
|
|
||
| <p align="center"> | ||
| <a href="https://github.com/longvo92/codegen-compare-tool/actions/workflows/test.yml"><img src="https://github.com/longvo92/codegen-compare-tool/actions/workflows/test.yml/badge.svg" alt="Test"></a> | ||
| <a href="https://www.python.org/downloads/"><img src="https://img.shields.io/badge/python-3.8%2B-blue.svg" alt="Python 3.8+"></a> | ||
| <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-green.svg" alt="License: MIT"></a> | ||
| <a href="https://github.com/longvo92/codegen-compare-tool/releases/latest"><img src="https://img.shields.io/github/v/release/longvo92/codegen-compare-tool?label=release&color=blue" alt="Release"></a> | ||
| </p> | ||
|
|
||
| <p align="center">🇻🇳 <a href="docs/vi/README.md">Tiếng Việt</a></p> | ||
|
|
||
| # CodeGen Compare Tool | ||
|
|
||
| Compare two AUTOSAR MATLAB/Simulink code-generation snapshots and focus on the changes that need review. | ||
|
|
||
| The tool filters generator noise that it can prove is harmless, then summarizes changes to generated C/C++, ARXML, RTE access and A2L objects. | ||
| [Tiếng Việt](docs/vi/README.md) | ||
|
|
||
| > If a difference cannot be proven to be noise, it remains a real change. | ||
| Compare AUTOSAR MATLAB/Simulink codegen folders or ZIPs and review C/C++, ARXML, RTE and A2L changes. Only proven generator noise is filtered; unexplained differences remain real changes. | ||
|
|
||
| ## Quick start | ||
|
|
||
| Download `compare-tool.exe` or `compare_tool.pyz` from the [latest release](https://github.com/longvo92/codegen-compare-tool/releases/latest). Both accept the options shown below. | ||
| 1. Download `compare-tool.exe` from [Releases](https://github.com/longvo92/codegen-compare-tool/releases/latest) and open it. No Python installation is needed. | ||
| 2. Select BASELINE and CURRENT, then run the comparison. | ||
| 3. Review changes in the viewer or export an offline HTML report. | ||
|
|
||
| To run from source: | ||
| For CLI use, download `compare_tool.pyz` and run it with Python 3.8+, or use the source commands below. Replace `python -m compare_tool` with `compare-tool.exe` or `python compare_tool.pyz` for downloaded builds. | ||
|
|
||
| ## Run from source | ||
|
|
||
| ```bash | ||
| git clone https://github.com/longvo92/codegen-compare-tool.git | ||
| cd codegen-compare-tool | ||
| ``` | ||
|
|
||
| For downloaded builds, replace `python -m compare_tool` with `compare-tool.exe` or `python compare_tool.pyz`. | ||
|
|
||
| Check consistency before delivery using one folder or ZIP (new in source; not released yet): | ||
|
|
||
| ```bash | ||
| python -m compare_tool --check-current current | ||
| ``` | ||
|
|
||
| This mode runs no diff and writes no HTML. The `delivery` policy gates missing input and unchecked items; existing comparison commands and YAML remain supported. See [usage](docs/usage.md#consistency-check) for mappings and exceptions. | ||
|
|
||
| Create a self-contained HTML report: | ||
|
|
||
| ```bash | ||
| python -m compare_tool baseline current --report report.html | ||
| ``` | ||
|
|
||
| Print only a terminal summary: | ||
| The CLI uses only the Python standard library. For the desktop viewer: | ||
|
|
||
| ```bash | ||
| python -m compare_tool baseline current --no-report | ||
| python -m pip install -e ".[viewer]" | ||
| python -m compare_tool | ||
| ``` | ||
|
|
||
| The terminal mode shows a per-model Overview, AUTOSAR/A2L changes, consistency warnings, effective compare settings, hunk-classification totals and one summary for each non-identical file. Add `--check-consistency` to validate CURRENT generated RTE calls against CURRENT ARXML declarations. It does not print individual hunks, source diffs or create HTML. | ||
| Sample inputs: [tests/fixtures/demo](tests/fixtures/demo). | ||
|
|
||
| Open the desktop viewer: | ||
| ## Usage | ||
|
|
||
| ```bash | ||
| python -m compare_tool | ||
| python -m compare_tool baseline current --no-report | ||
| python -m compare_tool --check-current current | ||
| ``` | ||
|
|
||
| The viewer requires PySide6. The CLI and `compare_tool.pyz` use only the Python standard library. | ||
|
|
||
| Folders and ZIP archives are accepted as inputs. | ||
|
|
||
| ## Outputs | ||
|
|
||
| | Output | Use it for | | ||
| | Output | Use it to | | ||
| |---|---| | ||
| | Desktop viewer | Interactive side-by-side review | | ||
| | HTML report | Sharing or publishing as a CI artifact | | ||
| | `--check-current PATH` | CURRENT consistency and coverage before delivery | | ||
| | `--no-report` | Detailed terminal review and diagnostics without generated files | | ||
| | `--json` | Structured pipeline processing | | ||
| | `--sarif` | Code-scanning annotations | | ||
|
|
||
| The comparison engine also reports: | ||
|
|
||
| - model/SWC ownership; | ||
| - ports, port interfaces, runnables and events; | ||
| - `Rte_*` access points; | ||
| - A2L `CHARACTERISTIC` and `MEASUREMENT` objects; | ||
| - possible incomplete regeneration across ARXML, A2L and generated C; | ||
| - generated RTE calls that disagree with CURRENT ARXML access declarations when `--check-consistency` is enabled. | ||
|
|
||
| Old/new regeneration warnings remain advisory. The optional CURRENT-tree check is disabled by default; when enabled, a `fail` finding exits `1`, an incomplete consistency scan exits `2`, and a `warn` finding does not change the exit code. No consistency result changes a file verdict. | ||
|
|
||
| ## Verdicts | ||
|
|
||
| | Verdict | Meaning | | ||
| |---|---| | ||
| | Modified | A real change needs review | | ||
| | Comment | Only comments changed | | ||
| | Unimportant | Only proven generator noise changed | | ||
| | Added / Deleted | The file exists on one side only | | ||
| | Identical | No difference | | ||
| | Not compared | The file could not be read or compared | | ||
|
|
||
| ## CI exit codes | ||
|
|
||
| | Code | Meaning | | ||
| |---:|---| | ||
| | `0` | No real changes | | ||
| | `1` | Real changes found | | ||
| | `2` | Comparison incomplete or failed | | ||
| | Desktop viewer | Review changes side by side | | ||
| | HTML report | Share results offline or as a CI artifact | | ||
| | `--no-report` | Review summaries and diagnostics in the terminal | | ||
| | `--check-current PATH` | Check CURRENT RTE/ARXML consistency before delivery | | ||
| | `--json` / `--sarif` | Export comparison results for pipelines | | ||
|
|
||
| `--exit-zero` suppresses only file-difference failures, never consistency failures or incomplete scans. `--check-current` returns `0` for a policy pass, `1` for failed rules and `2` for incomplete input/scanning or unchecked items under delivery policy. | ||
| CURRENT consistency findings are terminal-only; JSON/SARIF exports contain comparison results and old/new advisories. | ||
|
|
||
| ## Requirements | ||
| ## Review the results | ||
|
|
||
| - Python 3.8 or newer | ||
| - No server, database or network access at runtime | ||
| - PySide6 only for the desktop viewer | ||
| - Self-contained HTML reports with no CDN or external assets | ||
| - **Modified**, **Added** and **Deleted** need review. **Comment** and **Unimportant** contain only comments or proven noise. **Not compared** indicates an error. | ||
| - Overview groups changes by model/SWC, including ports, runnables, events, RTE access and A2L objects. | ||
| - Old/new regeneration warnings are advisory; unchanged output does not prove regeneration history. | ||
| - `--check-current` uses delivery policy: failed rules exit `1`; missing input, scan errors or unchecked items exit `2`. See the [User Guide](docs/usage.md#consistency-check) for scope and exceptions. | ||
| - Comparisons exit `0` when clean, `1` for real changes or enabled consistency failures, and `2` for errors/incomplete scans. `--exit-zero` suppresses only file-difference failures. | ||
|
|
||
| ## Documentation | ||
|
|
||
| - [Usage Guide](docs/usage.md) — commands, viewer controls, noise rules and CI | ||
| - [Vietnamese documentation](docs/vi/README.md) | ||
| - [User Guide](docs/usage.md) — viewer, CLI, noise rules and CI | ||
| - [Architecture](docs/architecture.md) — components, contracts, verification and builds | ||
| - [Contributing](CONTRIBUTING.md) — setup and change requirements | ||
| - [Changelog](CHANGELOG.md) — release notes | ||
|
|
||
| Run `python -m compare_tool --help` for the complete CLI reference. | ||
| See [CLI flags](docs/usage.md#cli-flags) for defaults and supported combinations, or run `python -m compare_tool --help`. HTML reports work offline without a server or external assets. | ||
|
|
||
| ## License | ||
|
|
||
| [MIT](LICENSE) © 2026 Long Vo Thien | ||
| [MIT](LICENSE) · Long Vo Thien | ||
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
State that only JSON contains the old/new advisories. When a pipeline requests SARIF,
serialize.build_sarif()emits only actionable per-file findings and has no advisory field, whereas the JSON document stores advisories underconsistency; the current wording incorrectly promises SARIF consumers data they cannot receive.Useful? React with 👍 / 👎.