-
Notifications
You must be signed in to change notification settings - Fork 8
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
JSON Formatter for Result file (C++ and Python versions). Adds py Text report and py GithubCI report #191
base: main
Are you sure you want to change the base?
Conversation
This commit introduces a new optional (and disabled by default) report format module for JSON file. Really similar to the Text Report module, uses nlohmann-json as dependency which is obtained automatically by CMake via `FetchContent`. To enable compilation of the module a specific option (`ASAM_QC_JSON_REPORT_FORMAT_ENABLE`) should be enabled in CMake at configuration time. Side note, adding `.vscode` as ignored directory for the project. Signed-off-by: Matteo Ragni <matteo.ragni@antemotion.com>
This commit introduces a new optional (and disabled by default) report format module for JSON file. Really similar to the Text Report module, uses nlohmann-json as dependency which is obtained automatically by CMake via `FetchContent`. To enable compilation of the module a specific option (`ASAM_QC_JSON_REPORT_FORMAT_ENABLE`) should be enabled in CMake at configuration time. Side note, adding `.vscode` as ignored directory for the project. Signed-off-by: Matteo Ragni <matteo.ragni@antemotion.com>
…into antemotion-mr/json-format
This commit introduces a new optional (and disabled by default) report format module for JSON file. Really similar to the Text Report module, uses nlohmann-json as dependency which is obtained automatically by CMake via `FetchContent`. To enable compilation of the module a specific option (`ASAM_QC_JSON_REPORT_FORMAT_ENABLE`) should be enabled in CMake at configuration time. Side note, adding `.vscode` as ignored directory for the project. Signed-off-by: Matteo Ragni <matteo.ragni@antemotion.com>
…into antemotion-mr/json-format
The json report tool can be started with either: * `qc-report-json` * `python -m runtime.report.json` Signed-off-by: Matteo Ragni <matteo.ragni@antemotion.com>
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.
Many thanks for the amazing work, @MatteoRagni. I have few minor comments below. Beside them, the only significant remark is that we can move the python module outside of the runtime
module, to keep them decoupled.
Also, could you add an example output json file to README?
src/report_modules/report_module_json/dependencies/nlohman-json/CMakeLists.txt
Outdated
Show resolved
Hide resolved
Users can disable completely FetchContent with an option. In this case, nlohmann-json must be found via find_package (externally installed or vcpkg) Signed-off-by: Matteo Ragni <matteo.ragni@antemotion.com>
The commit introduces two base report classes: one to create the a custom formatter, the latter to wrap the formatter rapidly in an application. The approach has been tested on the json formatter. An initial scaffolding for the default text formatter has been provided, but implementation has not been done (prints only "not yet implemented") The approach implements also: - command line provided formatter parameters - support for reading from stdin - support for dump into stdout and stderr Signed-off-by: Matteo Ragni <matteo.ragni@antemotion.com>
Signed-off-by: Matteo Ragni <matteo.ragni@antemotion.com>
Report tool for github ci. It must exit with value different than 0 if issue are found, so that the CI can trigger the error. Signed-off-by: Matteo Ragni <matteo.ragni@antemotion.com>
Signed-off-by: Matteo Ragni <matteo.ragni@antemotion.com>
Signed-off-by: Matteo Ragni <matteo.ragni@antemotion.com>
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.
Hi @MatteoRagni , I think it would be great if we can replace the C++ Text Report with this Python Text Report (not sure if we manage to do it in v1.0.0-rc.1, but if not, we can have v1.0.0-rc.2 for that).
I just compared the output of the Python Text Report with the current C++ Text Report and have few comments below.
😮 @MatteoRagni, thanks for this huge contribution! Some general notes:
Thanks again. |
Thanks for the suggestion. I still think this is a common effort, there is no direct need to cite company name.
The project is configured for black as formatter, and the code is formatted according to its style. I'll take a look for the code spell checker.
The PR must take into account #195 which is just merged. I'll try to have a look at both integration and @hoangtungdinh comments above in a couple of days. |
Signed-off-by: Matteo Ragni <matteo.ragni@antemotion.com>
Signed-off-by: Matteo Ragni <matteo.ragni@antemotion.com>
Signed-off-by: Matteo Ragni <matteo.ragni@antemotion.com>
…m-ev#193) Signed-off-by: hoangtungdinh <11166240+hoangtungdinh@users.noreply.github.com> Co-authored-by: hoangtungdinh <11166240+hoangtungdinh@users.noreply.github.com>
…m-ev#192) Signed-off-by: hoangtungdinh <11166240+hoangtungdinh@users.noreply.github.com> Co-authored-by: hoangtungdinh <11166240+hoangtungdinh@users.noreply.github.com>
Signed-off-by: romanodanilo <danilo@ivex.ai> Signed-off-by: romanodanilo <62891297+romanodanilo@users.noreply.github.com>
Signed-off-by: hoangtungdinh <11166240+hoangtungdinh@users.noreply.github.com>
Signed-off-by: hoangtungdinh <11166240+hoangtungdinh@users.noreply.github.com>
Signed-off-by: hoangtungdinh <11166240+hoangtungdinh@users.noreply.github.com>
Signed-off-by: hoangtungdinh <11166240+hoangtungdinh@users.noreply.github.com>
Signed-off-by: hoangtungdinh <11166240+hoangtungdinh@users.noreply.github.com>
Signed-off-by: Matteo Ragni <matteo.ragni@antemotion.com>
Signed-off-by: Matteo Ragni <matteo.ragni@antemotion.com>
The commit implements the following - considers Domain Specific Info in result as raw xml.etree Element, for string creation - includes the qc-report-text and qc-report-json in framework test - saves the framework unit test error output in one additional file (currently not stored in online pipelines). The file is added to gitignore Signed-off-by: Matteo Ragni <matteo.ragni@antemotion.com>
I set the DCO to pass, it was wrongly recognized by the pipeline, even if signs were there. |
Signed-off-by: Matteo Ragni <MatteoRagni@users.noreply.github.com>
Signed-off-by: Matteo Ragni <matteo.ragni@antemotion.com>
I added documentation for the report utilities in manual/python_qc_framework The PR is ready for merge (but revision is required) |
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.
LGTM. Thanks for the great work, @MatteoRagni !
@hoangtungdinh : You want to merge/include it in rc2? If yes, then I need to take the time to look into the final behavior.... because currently nobody else has used it. So, there was no chance that people can give feedback. The code looks good 👍 I've some worries about changing the functionality just before the release. I 💣-ed my products too often in life with merging cool stuff before the official release. 🙈 |
I think it would be great if this change could be in the final release, but it is not really a must. I'm perfectly fine if we decide to move it to the next release. The main reason for releasing it is that after this PR we will switch to the Python Text Report, and we plan to remove the C++ Text Report, addressing #115. Subsequent feedback can be incorporated directly into the Python Text Report, which is the future 😝. I've tested the code locally once and it seems okay, but admittedly not intensively. In any case, I will release rc1 without this change first. And then we can decide whether to include it in rc2 or not. |
Do we think we can move on with this? |
Oh yes! I will directly look into the code that we can remove the current difficult parts as soon as possible. |
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.
Do we really want to add both JSON report modules (Python and C++) to main? Does the C++ version have more features or some other reasons? The C++ JSON report modules feels deprecated before it have reached main.
Or maybe you want to add it, that if after the final switch to the Python based report modules then we could easier restore it?
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.
Actually it is there only for historic reasons... The PR started with the C++ Json module, then @hoangtungdinh asked for a python version to deprecate the C++ libs, and it remained. I think I can make an update and completely remove it.
A schema of the output, with description of the fields is available in | ||
[`schema/output-schema.json`](schema/output-schema.json). | ||
|
||
## Licenses for Dependencies |
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.
This should go to https://github.com/asam-ev/qc-framework/tree/main/licenses, in case we decide to add this C++ based report module to main.
"properties": { | ||
"inputFile": { | ||
"type": "string", | ||
"descrition": "Input file defined for the current run of the checker" |
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.
"descrition": "Input file defined for the current run of the checker" | |
"descrition": "Input file defined for the current run of the framework" |
def p(val, indent=0): | ||
if indent > 0: | ||
print(" " * indent, file=output, flush=True, end="") | ||
print(val, file=output, flush=True) | ||
|
||
def S(indent=0): p(line_sep1, indent) | ||
|
||
def s(indent=0): p(line_sep2, indent) | ||
|
||
def n(indent=0): p("", indent) |
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.
I'm confused about the function names p, S, s, and n and what they are doing. It's the abracadabra xqar -> txt :-)
I know it's internal.... but can we get at least one line as comment? Is this a common approach I've never seen?
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.
Ah, it's print, big/small separator and indented new line.
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.
That means I need to comment a little more the code...
I was checking the changes between the last time and now, and there is only one minor thing: If you could include the |
Description
This commit introduces a new optional (and disabled by default) report format module for JSON file. Really similar to the Text Report module, uses nlohmann-json as dependency which is obtained automatically by CMake via
FetchContent
.Alternatively, a python version of the json report tool shipped with the runtime is implemented.
To enable compilation of the module a specific option (
ASAM_QC_JSON_REPORT_FORMAT_ENABLE
) should be enabled in CMake at configuration time.Side note, adding
.vscode
as ignored directory for the project.Main changes
runtime.report.json
module.How was the PR tested?
Notes
Adding
.vscode
as ignored directory (.gitignore
)