Skip to content

Commit

Permalink
Return exit code 1 if warnings are given (#76)
Browse files Browse the repository at this point in the history
* Return exit code 1 if warnings are given
* Use a valid SensorView trace file in the ci
* Add documentation
---------

Signed-off-by: ClemensLinnhoff <clemens.linnhoff@partner.bmw.de>
  • Loading branch information
ClemensLinnhoff authored Jun 5, 2024
1 parent 3e7d5a4 commit b6e642a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,5 @@ jobs:
run: |
source .venv/bin/activate
pip install .
osivalidator --data data/20240221T141700Z_sv_300_2112_10_one_moving_object.osi -r rules
osivalidator --data data/20240221T141700Z_sv_300_2112_10_one_moving_object.osi -r rules --parallel
osivalidator --data data/20240604T065310Z_sv_370_244_20_generic_valid_sensor_view.osi -r rules
osivalidator --data data/20240604T065310Z_sv_370_244_20_generic_valid_sensor_view.osi -r rules --parallel
Binary file not shown.
3 changes: 3 additions & 0 deletions doc/usage.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@ Ranges of timestamps Message
[START_TIMESTAMP, END_TIMESTAMP] PATH_TO_RULE(VALUE) does not comply in PATH_TO_OSI_FIELD
----

The osivalidator will end the execution with the exit code 1, if warnings or errors are generated.
If the trace file is valid and no warning or errors occurred, the execution is ended with exit code 0.

== Understanding Validation Output

To better understand the validation output let us use the example
Expand Down
6 changes: 6 additions & 0 deletions osivalidator/osi_general_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,8 @@ def main():

trace.close()
display_results()
if get_num_logs() > 0:
exit(1)


def process_message(message, timestep, data_type):
Expand All @@ -224,5 +226,9 @@ def display_results():
return LOGGER.synthetize_results(LOGS)


def get_num_logs():
return len(LOGS)


if __name__ == "__main__":
main()

0 comments on commit b6e642a

Please sign in to comment.