Skip to content

Commit b6e642a

Browse files
Return exit code 1 if warnings are given (#76)
* Return exit code 1 if warnings are given * Use a valid SensorView trace file in the ci * Add documentation --------- Signed-off-by: ClemensLinnhoff <[email protected]>
1 parent 3e7d5a4 commit b6e642a

File tree

4 files changed

+11
-2
lines changed

4 files changed

+11
-2
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,5 +78,5 @@ jobs:
7878
run: |
7979
source .venv/bin/activate
8080
pip install .
81-
osivalidator --data data/20240221T141700Z_sv_300_2112_10_one_moving_object.osi -r rules
82-
osivalidator --data data/20240221T141700Z_sv_300_2112_10_one_moving_object.osi -r rules --parallel
81+
osivalidator --data data/20240604T065310Z_sv_370_244_20_generic_valid_sensor_view.osi -r rules
82+
osivalidator --data data/20240604T065310Z_sv_370_244_20_generic_valid_sensor_view.osi -r rules --parallel
Binary file not shown.

doc/usage.adoc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,9 @@ Ranges of timestamps Message
118118
[START_TIMESTAMP, END_TIMESTAMP] PATH_TO_RULE(VALUE) does not comply in PATH_TO_OSI_FIELD
119119
----
120120

121+
The osivalidator will end the execution with the exit code 1, if warnings or errors are generated.
122+
If the trace file is valid and no warning or errors occurred, the execution is ended with exit code 0.
123+
121124
== Understanding Validation Output
122125

123126
To better understand the validation output let us use the example

osivalidator/osi_general_validator.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,8 @@ def main():
199199

200200
trace.close()
201201
display_results()
202+
if get_num_logs() > 0:
203+
exit(1)
202204

203205

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

226228

229+
def get_num_logs():
230+
return len(LOGS)
231+
232+
227233
if __name__ == "__main__":
228234
main()

0 commit comments

Comments
 (0)