From 3646d292f1ba8052dbdc7cd0817e3352a4287c02 Mon Sep 17 00:00:00 2001 From: carsten-kuebler <32508295+carsten-kuebler@users.noreply.github.com> Date: Thu, 26 Apr 2018 11:07:53 +0200 Subject: [PATCH 1/8] Additional test cases for comments --- osi_common.proto | 1 - osi_featuredata.proto | 2 +- osi_sensordata.proto | 2 +- osi_version.proto.in | 8 ++++++-- test_cases.py | 37 +++++++++++++++++++++++++++++++++++-- 5 files changed, 43 insertions(+), 7 deletions(-) diff --git a/osi_common.proto b/osi_common.proto index a4cfd4770..118cf28a8 100644 --- a/osi_common.proto +++ b/osi_common.proto @@ -136,7 +136,6 @@ message Dimension3d // Rotation_yaw_pitch_roll = Rotation_roll*Rotation_pitch*Rotation_yaw // // vector_global_coord_system := Inverse_Rotation_yaw_pitch_roll(Orientation3d)*(vector_local_coord_system) + local_origin::position - // // \attention This definition changed in OSI version 3.0.0. Previous OSI // versions (V2.xx) had an other definition. diff --git a/osi_featuredata.proto b/osi_featuredata.proto index 73acba16e..ab5eb1943 100644 --- a/osi_featuredata.proto +++ b/osi_featuredata.proto @@ -112,7 +112,7 @@ message SensorDetectionHeader optional Identifier sensor_id = 7; // - // \brief Data qualifier communicates the overall availability of the + // Data qualifier communicates the overall availability of the // interface. // enum DataQualifier diff --git a/osi_sensordata.proto b/osi_sensordata.proto index 32e6405e0..250303cd1 100644 --- a/osi_sensordata.proto +++ b/osi_sensordata.proto @@ -39,7 +39,7 @@ message DetectedEntityHeader optional DataQualifier data_qualifier = 3; // - // \brief Data qualifier communicates the overall availability of the + // Data qualifier communicates the overall availability of the // interface. // enum DataQualifier diff --git a/osi_version.proto.in b/osi_version.proto.in index a19cf5faf..bba3e7899 100644 --- a/osi_version.proto.in +++ b/osi_version.proto.in @@ -11,7 +11,7 @@ package osi3; // // The field denoting the version number. This needs to be set by the // sender to the actual OSI version that is to be sent. Code wanting to -// access the version number of the OSI code base can access a FileOption, +// access the version number of the OSI code base can access a FileOptions, // which has the proper values, like this: // // @code @@ -44,8 +44,12 @@ message InterfaceVersion optional uint32 version_patch = 3; } - +// +// \brief Extension of FileOptions for OSI +// extend google.protobuf.FileOptions { + // Extend FileOptions with current interface version of OSI + // optional InterfaceVersion current_interface_version = 81000; } diff --git a/test_cases.py b/test_cases.py index 025bd2da4..3adc19cc3 100644 --- a/test_cases.py +++ b/test_cases.py @@ -12,6 +12,7 @@ enumName = "" noMessage = 0 noComment = 0 + hasBrief = False for line in fin: i = i + 1 @@ -59,8 +60,10 @@ matchComment = re.search("//", line) if matchComment is not None: statement = line[:matchComment.start()] + comment = line[matchComment.end():] else: statement = line + comment = "" # -------------------------------------------------------------- # Test case 6-8 camelcase for enums and check enum name? @@ -131,6 +134,9 @@ def convert(name): if matchNameConv is None: print(file + " in line " + str(i) + ": message name wrong. '"+endOfLine[matchName.start():matchName.end()]+"'") state = 1 + elif re.search(r"\bextend\b", statement) is not None: + # treat extend as message + noMessage += 1 else: # Check field names if noMessage > 0: @@ -158,15 +164,42 @@ def convert(name): noMessage -= 1 # -------------------------------------------------------------- - # Test case 13 is checking if comment is min. 2 lines + # Test case 13-17 is checking comment if line.find("//") != -1: noComment += 1; + if comment.find("\\brief") != -1: + hasBrief = True; else: + # Test case 13 is checking if comment is min. 2 lines if noComment == 1: print(file + " in line " + str(i-1) + ": short comment - min. 2 lines.") state = 1 - noComment = 0 + if re.search(r"\bmessage\b", statement) is not None or re.search(r"\bextend\b", statement) is not None: + if hasBrief == False: + # Test case 14 each message and extend has a \brief comment + print(file + " in line " + str(i-1) + ": \\brief section in comment is missing for: '"+statement+"'") + state = 1 + elif hasBrief == True: + # Test case 15 only message and extend has a \brief comment + print(file + " in line " + str(i-1) + ": \\brief section in comment is not necessary for: '"+statement+"'") + state = 1 + + if re.search(r"\bmessage\b", statement) is not None or re.search(r"\bextend\b", statement) is not None or re.search(r"\benum\b", statement) is not None: + if noComment == 0: + # Test case 16 every message, extend or enum has a comment + print(file + " in line " + str(i) + ": comment is missing for: '"+statement+"'") + state = 1 + if noMessage > 0 or isEnum == True: + if statement.find(";") != -1: + if noComment == 0: + # Test case 17 every statement has a comment + print(file + " in line " + str(i) + ": comment is missing for: '"+statement+"'") + state = 1 + + noComment = 0 + hasBrief = False + # -------------------------------------------------------------- From e5c5ca439094cd602e1377f9241ca8862de3aa72 Mon Sep 17 00:00:00 2001 From: carsten-kuebler <32508295+carsten-kuebler@users.noreply.github.com> Date: Thu, 26 Apr 2018 11:38:42 +0200 Subject: [PATCH 2/8] Travis CI Class list Class list is not sorted. Try to sort it. --- doxygen_config.cmake.in | 1 + 1 file changed, 1 insertion(+) diff --git a/doxygen_config.cmake.in b/doxygen_config.cmake.in index 8c7c8883d..2c5fea045 100644 --- a/doxygen_config.cmake.in +++ b/doxygen_config.cmake.in @@ -21,6 +21,7 @@ INPUT_FILTER = "python @FILTER_PROTO2CPP_PY_PATH@/proto2cpp.py" HAVE_DOT = YES HIDE_UNDOC_RELATIONS = NO MAX_DOT_GRAPH_DEPTH = 2 +SORT_MEMBER_DOCS = YES # If someone wants UML diagrams in the documentation, the next parameter must # be commented in. From a9379772fedea87133d1177095e0ee5ae0ca85b5 Mon Sep 17 00:00:00 2001 From: carsten-kuebler <32508295+carsten-kuebler@users.noreply.github.com> Date: Thu, 26 Apr 2018 13:32:42 +0200 Subject: [PATCH 3/8] Optimize output Remove "\n" in error messages. --- test_cases.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test_cases.py b/test_cases.py index 3adc19cc3..f90ea87ff 100644 --- a/test_cases.py +++ b/test_cases.py @@ -64,6 +64,10 @@ else: statement = line comment = "" + + # New line is not necessary. Remove for a better output. + statement = statement.replace("\n", "") + comment = comment.replace("\n", "") # -------------------------------------------------------------- # Test case 6-8 camelcase for enums and check enum name? From 59d9c929c7acdd66d8b32f5d13de46794e525ffd Mon Sep 17 00:00:00 2001 From: carsten-kuebler <32508295+carsten-kuebler@users.noreply.github.com> Date: Thu, 26 Apr 2018 14:00:17 +0200 Subject: [PATCH 4/8] Check for optional and repeated Every field must have optional or repeated. --- test_cases.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/test_cases.py b/test_cases.py index f90ea87ff..81e5497b9 100644 --- a/test_cases.py +++ b/test_cases.py @@ -117,7 +117,7 @@ def convert(name): state = 1 # -------------------------------------------------------------- - # Test case 10-12 check message name, field type and field name + # Test case 10-12,18 check message name, field type and field name # # Check (nested) messages @@ -161,6 +161,11 @@ def convert(name): if matchNameConv is None: print(file + " in line " + str(i) + ": field message type wrong. Check: '"+checkType+"'") state = 1 + + if re.search(r"\boptional\b",type) is None and re.search(r"\brepeated\b",type) is None: + # Test 18 has every field the multiplicity "repeated" or "optional" + print(file + " in line " + str(i) + ": field multiplicity (\"optional\" or \"repeated\") is missing. Check: '"+statement+"'") + state = 1 # Search for a closing brace. matchClosingBrace = re.search("}", statement) @@ -205,6 +210,7 @@ def convert(name): hasBrief = False # -------------------------------------------------------------- + # Next Test 19 sys.exit(state) From a1146c8c6d2ed1811133ca93f613566f3108226f Mon Sep 17 00:00:00 2001 From: carsten-kuebler <32508295+carsten-kuebler@users.noreply.github.com> Date: Thu, 26 Apr 2018 14:57:20 +0200 Subject: [PATCH 5/8] Check end of files if newline is at the end of each file --- open_simulation_interface-config-version.cmake.in | 2 +- osi_detectedlane.proto | 2 +- test_cases.py | 12 +++++++++--- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/open_simulation_interface-config-version.cmake.in b/open_simulation_interface-config-version.cmake.in index 70069a3b0..2f6ae95e7 100644 --- a/open_simulation_interface-config-version.cmake.in +++ b/open_simulation_interface-config-version.cmake.in @@ -18,4 +18,4 @@ else() else() set(PACKAGE_VERSION_COMPATIBLE FALSE) endif() -endif() \ No newline at end of file +endif() diff --git a/osi_detectedlane.proto b/osi_detectedlane.proto index ef1b15158..98a6315d7 100644 --- a/osi_detectedlane.proto +++ b/osi_detectedlane.proto @@ -118,4 +118,4 @@ message DetectedLaneBoundary // optional LaneBoundary.Classification classification = 2; } -} \ No newline at end of file +} diff --git a/test_cases.py b/test_cases.py index 81e5497b9..1ea69c54b 100644 --- a/test_cases.py +++ b/test_cases.py @@ -13,9 +13,11 @@ noMessage = 0 noComment = 0 hasBrief = False + hasNewLine = True for line in fin: i = i + 1 + hasNewLine = line.endswith("\n") # -------------------------------------------------------------- # Test case 1 is checking if there are illegal tabulators in the code @@ -210,8 +212,12 @@ def convert(name): hasBrief = False # -------------------------------------------------------------- - # Next Test 19 - + # Next Test 20 + + + # Test case 19 last line must end with a new line. + if hasNewLine == False: + print(file + " has no new line at the end of the file.") + state = 1 sys.exit(state) - From 10a8750e06de7a2ef8c89cbdc022489179e96c1d Mon Sep 17 00:00:00 2001 From: carsten-kuebler <32508295+carsten-kuebler@users.noreply.github.com> Date: Fri, 27 Apr 2018 08:41:21 +0200 Subject: [PATCH 6/8] Add unit test cases for doxygen documentation Add \c Add doxygen test cases to travis.yml Remove special char in roadmarking (problem for doxygen windows) Add documentation for extended class in osi_version.proto.in --- .travis.yml | 1 + osi_roadmarking.proto | 6 +++--- osi_version.proto.in | 4 ++-- test_cases_doc.py | 23 +++++++++++++++++++++++ 4 files changed, 29 insertions(+), 5 deletions(-) create mode 100644 test_cases_doc.py diff --git a/.travis.yml b/.travis.yml index a2cd58971..fc3fb1ab7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -81,6 +81,7 @@ script: - cmake -D FILTER_PROTO2CPP_PY_PATH=${DEPS_DIR}/proto2cpp .. - doxygen - cd .. + - python test_cases_doc.py # Deploy the documentation on github (only for master branch). deploy: diff --git a/osi_roadmarking.proto b/osi_roadmarking.proto index c21dd3c33..4ca75730e 100644 --- a/osi_roadmarking.proto +++ b/osi_roadmarking.proto @@ -109,9 +109,9 @@ message RoadMarking // TYPE_PAINTED_TRAFFIC_SIGN = 2; - // Paint on the road surface indicating a monochrome logical symbol of a - // traffic sign (e.g. digits 50 as start of speed limit 50 or stop line - // for stop sign). + // Paint on the road surface indicating a monochrome logical symbol + // of a traffic sign (e.g. digits 50 as start of speed limit 50 or + // stop line for stop sign). // TYPE_SYMBOLIC_TRAFFIC_SIGN = 3; diff --git a/osi_version.proto.in b/osi_version.proto.in index bba3e7899..bc8eeca51 100644 --- a/osi_version.proto.in +++ b/osi_version.proto.in @@ -45,10 +45,10 @@ message InterfaceVersion } // -// \brief Extension of FileOptions for OSI +// \brief Extension of \c FileOptions for OSI // extend google.protobuf.FileOptions { - // Extend FileOptions with current interface version of OSI + // Extend \c FileOptions with current interface version of OSI // optional InterfaceVersion current_interface_version = 81000; } diff --git a/test_cases_doc.py b/test_cases_doc.py new file mode 100644 index 000000000..2264ba5bf --- /dev/null +++ b/test_cases_doc.py @@ -0,0 +1,23 @@ +import sys +import unicodedata +import re +from glob import * + +state = 0 + +for file in glob("doc/html/*.htm*"): + with open(file, "rt") as fin: + i = 0 + + for line in fin: + i = i + 1 + + # -------------------------------------------------------------- + # Test case 1 is checking if there are illegal hash chars in the + # documentation. -> doxygen link not found. + if re.search(r"([\s>]|^)#\w",line) is not None: + print(file + " in line " + str(i) + ": not permitted hash found") + state = 1 + + +sys.exit(state) From 7703c5b64a6d4c5d41ebb4a2f21f7e6ad638fe34 Mon Sep 17 00:00:00 2001 From: carsten-kuebler <32508295+carsten-kuebler@users.noreply.github.com> Date: Fri, 27 Apr 2018 08:46:36 +0200 Subject: [PATCH 7/8] Extend error message --- test_cases_doc.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test_cases_doc.py b/test_cases_doc.py index 2264ba5bf..a4ac99304 100644 --- a/test_cases_doc.py +++ b/test_cases_doc.py @@ -15,8 +15,9 @@ # -------------------------------------------------------------- # Test case 1 is checking if there are illegal hash chars in the # documentation. -> doxygen link not found. - if re.search(r"([\s>]|^)#\w",line) is not None: - print(file + " in line " + str(i) + ": not permitted hash found") + matchHash = re.search(r"([\s>]|^)#\w(\S)*",line) + if matchHash is not None: + print(file + " in line " + str(i) + ": not permitted hash found. Search for: '"+line[matchHash.start():matchHash.end()]) state = 1 From ea87ebe8ac45736a35d05789abad5c92978e110b Mon Sep 17 00:00:00 2001 From: carsten-kuebler <32508295+carsten-kuebler@users.noreply.github.com> Date: Fri, 27 Apr 2018 09:26:49 +0200 Subject: [PATCH 8/8] Bugfix readme.md and doxygen --- README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index 8aeaa2150..dde595daa 100644 --- a/README.md +++ b/README.md @@ -102,9 +102,7 @@ Copy the content of the repo proto2cpp to your desired `` Citing ------ -Use the following citation for referencing the OSI interface in your scientific work: - -`@misc{osi.2017, +Use the following citation for referencing the OSI interface in your scientific work: `@misc{osi.2017, author = {Hanke, Timo and Hirsenkorn, Nils and {van~Driesten}, Carlo and {Garcia~Ramos}, Pilar and Schiementz, Mark and Schneider, Sebastian}, year = {2017}, title = {{Open Simulation Interface: A generic interface for the environment perception of automated driving functions in virtual scenarios.}},