Skip to content
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

Return exit code 1 if warnings are given #76

Merged
merged 3 commits into from
Jun 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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()