From 02d34045f7b5cc184de6c24c151876cac529a18b Mon Sep 17 00:00:00 2001 From: Harsh Deshpande Date: Wed, 5 Aug 2020 16:17:34 +0200 Subject: [PATCH 01/20] converted to arrays --- universal_robot/a58f4b5/a58f4b5.bug | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/universal_robot/a58f4b5/a58f4b5.bug b/universal_robot/a58f4b5/a58f4b5.bug index 1ad33a36..6de304af 100644 --- a/universal_robot/a58f4b5/a58f4b5.bug +++ b/universal_robot/a58f4b5/a58f4b5.bug @@ -31,7 +31,7 @@ classification: | keywords: ['meta-package', 'catkin'] system: universal_robot severity: error -links: http://www.ros.org/reps/rep-0127.html | https://github.com/catkin/catkin_tools/issues/370#issuecomment-219157118 +links: [http://www.ros.org/reps/rep-0127.html, https://github.com/catkin/catkin_tools/issues/370#issuecomment-219157118] bug: phase: build specificity: ROS-specific @@ -39,7 +39,7 @@ bug: application: null task: null subsystem: driver - package: ros-industrial/universal_robot/ur10_moveit_config | ros-industrial/universal_robot/ur3_moveit_config | ros-industrial/universal_robot/ur5_moveit_config + package: [ros-industrial/universal_robot/ur10_moveit_config, ros-industrial/universal_robot/ur3_moveit_config, ros-industrial/universal_robot/ur5_moveit_config] languages: package.xml detected-by: build system reported-by: unreported From 7cf0405f7d3721932b3e4d4ae76b18ffebf762b4 Mon Sep 17 00:00:00 2001 From: Harsh Deshpande Date: Wed, 9 Sep 2020 13:07:29 +0200 Subject: [PATCH 02/20] [WIP] fixes issues with the json schema trying out yamale though --- scripts/robust.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/robust.json b/scripts/robust.json index 237056ef..21586eb5 100644 --- a/scripts/robust.json +++ b/scripts/robust.json @@ -98,14 +98,14 @@ "items" : { "type" : "string", "minLength" : 5, - "pattern" : "^([a-z0-9A-Z_]+)(/[a-z0-9A-Z_]+){2}$" + "pattern" : "^([a-z0-9A-Z-]+)(/[a-z0-9A-Z_]+){2}$" }, "description" : "A list of packages involved. Each entry should specify the project, the repository, and the package, for example: 'ros-industrial/universal_robot/ur_bringup'" }, "languages" : { "type" : "array", "items" : { "enum" : [ "python", "cmake", "C++", "package.xml", - "launch.xml", "msg", "srv", "xacro", "urdf" ] }, + "launch.xml", "msg", "srv", "xacro", "urdf", "robot specific" ] }, "description" : "A list of the languages involved in the failure. N/A if the error is not explicitly reported by the language infrastructure. Avoid a generic XML tag (all files in ROS have some known schema, and let's try to narrow it down when writing). Also the language should be N/A if the bug is not reported by the language infrastructure (so if the error is in package.xml but a C++ compiler fails then the language is 'C++' here, not 'package.xml'. The latter is listed under the fix. If the error is not reported by a language infrastructure, but for instance wrong behavior is discovered in simulation, then do not put a language in). For this reason it should be fairly unusual to have more than one language listed here." }, "detected-by" : { @@ -160,7 +160,7 @@ "repo" : { "type" : "string", "minLength" : 3, - "pattern" : "^(https://github\\.com/[a-zA-Z0-9_]+/[a-zA-Z0-9_]+)$", + "pattern" : "^(https://github\\.com/[a-zA-Z0-9-]+/[a-zA-Z0-9_]+)$", "description" : "URI reference to repository where the bug was fixed." }, "hash" : { @@ -173,7 +173,7 @@ "pull-request" : { "type" : "string", "minLength" : 1, - "pattern" : "(^(https://github\\.com/[a-zA-Z0-9_]+/[a-zA-Z0-9_]+/pull/[0-9]+)?$)|(^N/A$)", + "pattern" : "(^(https://github\\.com/[a-zA-Z0-9-]+/[a-zA-Z0-9_]+/pull/[0-9]+)?$)|(^N/A$)", "description" : "URI for pull request that fixed the bug. N/A if no pull request (for instance direct commit)." }, "license" : { @@ -195,7 +195,7 @@ "type" : "array", "items" : { "enum" : [ "python", "cmake", "C++", "package.xml", "launch.xml", - "msg", "srv", "xacro", "urdf" ] + "msg", "srv", "xacro", "urdf", "robot specific" ] }, "description" : "The languages involved in fixing the bug. (See list of conventions for naming languages under bug/language)." }, From 5a2b019351b2e0c4ef2aff760fa582a57c94005e Mon Sep 17 00:00:00 2001 From: Harsh Deshpande Date: Wed, 9 Sep 2020 16:40:58 +0200 Subject: [PATCH 03/20] porting schema to yamale --- scripts/robust.yaml | 62 +++++++++++++++++++++++++++++++++++++ scripts/yamale.bug | 33 ++++++++++++++++++++ scripts/yamale_validator.py | 18 +++++++++++ 3 files changed, 113 insertions(+) create mode 100644 scripts/robust.yaml create mode 100644 scripts/yamale.bug create mode 100644 scripts/yamale_validator.py diff --git a/scripts/robust.yaml b/scripts/robust.yaml new file mode 100644 index 00000000..21ba696f --- /dev/null +++ b/scripts/robust.yaml @@ -0,0 +1,62 @@ +id: str(min=7, max=7) +title: str(min=1, max=160) +description: str(min=1) +classification: str(min=1) +keywords: list(str(min=1, max=80)) +system: str(min=1, max=40) +severity: enum("error", "warning", "convention-violation", "bad-smell", + "minor-issue", "not-a-bug") +links: list(str()) +bug: include('_bug') +fix: include('_fix') +time-machine: include('_time-machine') +bugzoo: include('_bugzoo') + +--- + +_bug: + phase: enum("programming-time", "build-time", "compile-time", + "deployment-time", "runtime-initialization", "runtime-operation") + specificity: enum("general issue", "robotics-specific", "ROS-specific", + "application-specific") + architectural-location: enum("application-specific code", "platform code", "N/A") + application: any(str(min=1), null()) + task: enum("perception", "localization", "planning", "manipulation", + "human-robot interaction", "simulation", "diagnostics", "SLAM", + "N/A") + subsystem: str(min=1) + package: list(regex("^([a-z0-9A-Z-]+)(/[a-z0-9A-Z_]+){2}$")) + languages: list(enum("python", "cmake", "C++", "package.xml", + "launch.xml", "msg", "srv", "xacro", "urdf", "robot specific")) + detected-by: enum("build system", "compiler", "code scanning tool", + "assertions", "runtime detection", "runtime crash", + "testing violation", "developer", "user") + reported-by: enum("guest user", "contributor", "member developer", + "automatic", "unreported") + issue: any(regex("^((https://github\\.com/[a-zA-Z0-9_]+/[a-zA-Z0-9_]+/issues/[0-9]+)?)$"), str("N/A")) + time-reported: any(date(), null()) + reproducibility: str() + trace: str(min=1) + reproduction: any(str(min=1), null(), required=False) + +_fix: + repo: regex("^(https://github\\.com/[a-zA-Z0-9-]+/[a-zA-Z0-9_]+)$") + hash: regex("^[0-9a-f]{40}$") + pull-request: regex("(^(https://github\\.com/[a-zA-Z0-9-]+/[a-zA-Z0-9_]+/pull/[0-9]+)?$)|(^N/A$)") + license: list(enum("BSD", "GPLv3", "LGPLv3")) + fix-in: list(str(min=1)) + languages: list(enum("python", "cmake", "C++", "package.xml", "launch.xml", + "msg", "srv", "xacro", "urdf", "robot specific")) + time: any(date(), null()) + +_time-machine: + ros_distro: enum("noetic", "melodic", "lunar", "kinetic", "jade", "indigo", + "hydro", "groovy", "fuerte", "electric", "diamondback") + ros_pkgs: list(str(min=1)) + datetime: date() + +_bugzoo: + is-build-failure: any('true', 'false') + bug-commit: regex("^[0-9a-f]{40}$") + fix-commit: regex("^[0-9a-f]{40}$") + fork-urls: list(regex("^(https://github\\.com/[a-zA-Z0-9-]+/[a-zA-Z0-9_]+)$")) diff --git a/scripts/yamale.bug b/scripts/yamale.bug new file mode 100644 index 00000000..4b910ddd --- /dev/null +++ b/scripts/yamale.bug @@ -0,0 +1,33 @@ +%YAML 1.1 +--- +id: 28c23cd +title: Include directory to header file missing +description: > + CMakeList is essential for every ROS package and it contains the + information of the packages, which is needed for the buildsystem. + Prior to specifying targets, you need to specify where resources + can be found for said targets, specifically header files and + libraries. The argument to include_directories should be the + *_INCLUDE_DIRS variables generated by your find_package calls and + any additional directories that need to be included. + In the example the include to the "${catkin_INCLUDE_DIRS}" was + missing and thus, a header file, in this case "ScriptAction.h" + could not be found in this case by Jenkins. The problem was + solved by adding "include_directories(${catkin_INCLUDE_DIRS})" to + the CMakeLists. +classification: Missing Include / Dependency (no CWE) +keywords: ['include directories', 'CMakeLists'] +system: care-o-bot +severity: error +bug: + phase: deployment-time + specificity: ROS-specific + architectural-location: application-specific code + application: N/A + task: N/A + subsystem: specific application component + package: [ros-industrial/universal_robot/ur10_moveit_config, ros-industrial/universal_robot/ur3_moveit_config, ros-industrial/universal_robot/ur5_moveit_config] + languages: [package.xml] + detected-by: developer + reported-by: member developer + issue: N/A \ No newline at end of file diff --git a/scripts/yamale_validator.py b/scripts/yamale_validator.py new file mode 100644 index 00000000..8a6d5218 --- /dev/null +++ b/scripts/yamale_validator.py @@ -0,0 +1,18 @@ +# Import Yamale and make a schema object: +import yamale +schema = yamale.make_schema('./robust.yaml') + +# Create a Data object +data = yamale.make_data('./yamale.bug') + +# Validate data against the schema. Throws a ValueError if data is invalid. +try: + yamale.validate(schema, data) + print('Validation success! 👍') +except yamale.YamaleError as e: + print('Validation failed!\n') + for result in e.results: + print("Error validating data '%s' with '%s'\n\t" % (result.data, result.schema)) + for error in result.errors: + print('\t%s' % error) + exit(1) \ No newline at end of file From c0f38861622e0d1942a96aa176679c69fda4dc7b Mon Sep 17 00:00:00 2001 From: Harsh Deshpande Date: Wed, 9 Sep 2020 18:28:16 +0200 Subject: [PATCH 04/20] update validator and bug - added date validator - included time-machine and bugzoo fields in sample bug --- scripts/yamale.bug | 76 +++++++++++++++++++++++++------------ scripts/yamale_validator.py | 17 ++++++++- 2 files changed, 66 insertions(+), 27 deletions(-) diff --git a/scripts/yamale.bug b/scripts/yamale.bug index 4b910ddd..35066fc7 100644 --- a/scripts/yamale.bug +++ b/scripts/yamale.bug @@ -1,33 +1,59 @@ %YAML 1.1 --- -id: 28c23cd -title: Include directory to header file missing +id: b96bf67 +title: Incorrect orientation (wrong frame) passed to set_attitude_target description: > - CMakeList is essential for every ROS package and it contains the - information of the packages, which is needed for the buildsystem. - Prior to specifying targets, you need to specify where resources - can be found for said targets, specifically header files and - libraries. The argument to include_directories should be the - *_INCLUDE_DIRS variables generated by your find_package calls and - any additional directories that need to be included. - In the example the include to the "${catkin_INCLUDE_DIRS}" was - missing and thus, a header file, in this case "ScriptAction.h" - could not be found in this case by Jenkins. The problem was - solved by adding "include_directories(${catkin_INCLUDE_DIRS})" to - the CMakeLists. -classification: Missing Include / Dependency (no CWE) -keywords: ['include directories', 'CMakeLists'] -system: care-o-bot + MAVROS operates on a frame of base_link->ENU, whereas MAVLink + operates on aircraft->NED. Therefore, location and orientation + must be transformed between these two frames when communicating + between them. The buggy function correctly performs the + necessary frame conversions, but fails to pass the converted + orientation in the "set_attitude_target" function call. +classification: CWE-137 Representation Errors #PHYSICAL +keywords: + - incorrect argument + - function call + - frame conversion +system: mavros severity: error +links: [] bug: - phase: deployment-time - specificity: ROS-specific - architectural-location: application-specific code + phase: runtime-operation + specificity: general issue + architectural-location: N/A application: N/A task: N/A - subsystem: specific application component - package: [ros-industrial/universal_robot/ur10_moveit_config, ros-industrial/universal_robot/ur3_moveit_config, ros-industrial/universal_robot/ur5_moveit_config] - languages: [package.xml] + subsystem: N/A + package: [mavlink/mavros/mavros] + languages: + - C++ detected-by: developer - reported-by: member developer - issue: N/A \ No newline at end of file + reported-by: contributor + issue: N/A + time-reported: + reproducibility: N/A + trace: N/A +fix: + repo: https://github.com/mavlink/mavros + hash: b96bf672a718b9f0c9694e4314283e385ba96231 + pull-request: https://github.com/mavlink/mavros/pull/537 + license: + - BSD + - GPLv3 + - LGPLv3 + fix-in: + - mavros/src/plugins/setpoint_raw.cpp + languages: + - C++ + time: 2016-04-29T13:59:23-04:00 +time-machine: + ros_distro: indigo + ros_pkgs: + - mavros + datetime: 2016-04-29T13:59:23-04:00 +bugzoo: + is-build-failure: false + bug-commit: 4f317228c5d5c5bfc96f3f0dfa692bc4b93dcc43 + fix-commit: b96bf672a718b9f0c9694e4314283e385ba96231 + fork-urls: + - https://github.com/robust-rosin/mavros diff --git a/scripts/yamale_validator.py b/scripts/yamale_validator.py index 8a6d5218..9229a364 100644 --- a/scripts/yamale_validator.py +++ b/scripts/yamale_validator.py @@ -1,6 +1,19 @@ # Import Yamale and make a schema object: import yamale -schema = yamale.make_schema('./robust.yaml') +import datetime +from yamale.validators import DefaultValidators, Validator + +class Date(Validator): + """ Custom Date validator """ + tag = 'date' + + def _is_valid(self, value): + return isinstance(value, datetime.date) + +validators = DefaultValidators.copy() # This is a dictionary +validators[Date.tag] = Date + +schema = yamale.make_schema('./robust.yaml', validators=validators) # Create a Data object data = yamale.make_data('./yamale.bug') @@ -15,4 +28,4 @@ print("Error validating data '%s' with '%s'\n\t" % (result.data, result.schema)) for error in result.errors: print('\t%s' % error) - exit(1) \ No newline at end of file + exit(1) From 8d28830f76762d91ab914f26c95d4815fc627d10 Mon Sep 17 00:00:00 2001 From: Harsh Deshpande Date: Wed, 7 Oct 2020 14:32:38 +0200 Subject: [PATCH 05/20] validate links not the best solution, since difficult to generalize URLs --- scripts/robust.yaml | 2 +- scripts/yamale.bug | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/robust.yaml b/scripts/robust.yaml index 21ba696f..47e62270 100644 --- a/scripts/robust.yaml +++ b/scripts/robust.yaml @@ -6,7 +6,7 @@ keywords: list(str(min=1, max=80)) system: str(min=1, max=40) severity: enum("error", "warning", "convention-violation", "bad-smell", "minor-issue", "not-a-bug") -links: list(str()) +links: list(regex("^(http)s?://([A-Z0-9])?")) bug: include('_bug') fix: include('_fix') time-machine: include('_time-machine') diff --git a/scripts/yamale.bug b/scripts/yamale.bug index 35066fc7..e1be36dd 100644 --- a/scripts/yamale.bug +++ b/scripts/yamale.bug @@ -16,7 +16,7 @@ keywords: - frame conversion system: mavros severity: error -links: [] +links: ['https://github.com/yujinrobot/yujin_ocs/issues/7', 'http://wiki.ros.org/robot_pose_ekf'] bug: phase: runtime-operation specificity: general issue From d1c727dbeb02ee9cfda2c60bb1113aa4ce7b8e62 Mon Sep 17 00:00:00 2001 From: Harsh Deshpande Date: Wed, 7 Oct 2020 14:41:34 +0200 Subject: [PATCH 06/20] include for hash --- scripts/robust.yaml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/scripts/robust.yaml b/scripts/robust.yaml index 47e62270..d753a5cf 100644 --- a/scripts/robust.yaml +++ b/scripts/robust.yaml @@ -41,7 +41,7 @@ _bug: _fix: repo: regex("^(https://github\\.com/[a-zA-Z0-9-]+/[a-zA-Z0-9_]+)$") - hash: regex("^[0-9a-f]{40}$") + hash: include('_hash') pull-request: regex("(^(https://github\\.com/[a-zA-Z0-9-]+/[a-zA-Z0-9_]+/pull/[0-9]+)?$)|(^N/A$)") license: list(enum("BSD", "GPLv3", "LGPLv3")) fix-in: list(str(min=1)) @@ -57,6 +57,9 @@ _time-machine: _bugzoo: is-build-failure: any('true', 'false') - bug-commit: regex("^[0-9a-f]{40}$") - fix-commit: regex("^[0-9a-f]{40}$") + bug-commit: include('_hash') + fix-commit: include('_hash') fork-urls: list(regex("^(https://github\\.com/[a-zA-Z0-9-]+/[a-zA-Z0-9_]+)$")) + + +_hash: regex("^[0-9a-f]{40}$") From 89d455fd757530f9413305508aac5265bbf3fd9f Mon Sep 17 00:00:00 2001 From: Harsh Deshpande Date: Wed, 7 Oct 2020 15:05:13 +0200 Subject: [PATCH 07/20] use yamale in validate.sh --- scripts/validate.sh | 7 +------ scripts/yamale_validator.py | 3 ++- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/scripts/validate.sh b/scripts/validate.sh index 5dd79d8e..fb13eff1 100755 --- a/scripts/validate.sh +++ b/scripts/validate.sh @@ -1,11 +1,6 @@ #!/bin/bash # usage: ./validate.sh bugid.bug -# -# install: https://github.com/any-json/any-json -# install: https://github.com/jessedc/ajv-cli -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" -SCHEMA="${DIR}/robust.json" echo Checking schema compliance for $1 -any-json --input-format=yaml $1 | ajv --verbose --errors=text -s ${SCHEMA} -d /dev/stdin 2>&1 >/dev/null | sed "s/\/dev\/stdin/File $1/" +python3 yamale_validator.py $1 diff --git a/scripts/yamale_validator.py b/scripts/yamale_validator.py index 9229a364..db4cd301 100644 --- a/scripts/yamale_validator.py +++ b/scripts/yamale_validator.py @@ -1,4 +1,5 @@ # Import Yamale and make a schema object: +import sys import yamale import datetime from yamale.validators import DefaultValidators, Validator @@ -16,7 +17,7 @@ def _is_valid(self, value): schema = yamale.make_schema('./robust.yaml', validators=validators) # Create a Data object -data = yamale.make_data('./yamale.bug') +data = yamale.make_data(sys.argv[1]) # Validate data against the schema. Throws a ValueError if data is invalid. try: From 050bb960b04d942ec01b9aac33d52b7e90e52bff Mon Sep 17 00:00:00 2001 From: Harsh Deshpande Date: Tue, 13 Oct 2020 09:45:29 +0200 Subject: [PATCH 08/20] test for parsing yaml --- scripts/robust.yaml | 3 +-- scripts/yamale_validator.py | 13 ++++++++----- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/scripts/robust.yaml b/scripts/robust.yaml index d753a5cf..7187186e 100644 --- a/scripts/robust.yaml +++ b/scripts/robust.yaml @@ -15,8 +15,7 @@ bugzoo: include('_bugzoo') --- _bug: - phase: enum("programming-time", "build-time", "compile-time", - "deployment-time", "runtime-initialization", "runtime-operation") + phase: enum("build", "startup", "runtime", "does not apply") specificity: enum("general issue", "robotics-specific", "ROS-specific", "application-specific") architectural-location: enum("application-specific code", "platform code", "N/A") diff --git a/scripts/yamale_validator.py b/scripts/yamale_validator.py index db4cd301..f9ef4dca 100644 --- a/scripts/yamale_validator.py +++ b/scripts/yamale_validator.py @@ -21,12 +21,15 @@ def _is_valid(self, value): # Validate data against the schema. Throws a ValueError if data is invalid. try: + results = yamale.readers.yaml_reader.parse_yaml(sys.argv[1]) + print(results[0]['fix']['license']) yamale.validate(schema, data) print('Validation success! 👍') except yamale.YamaleError as e: - print('Validation failed!\n') - for result in e.results: - print("Error validating data '%s' with '%s'\n\t" % (result.data, result.schema)) - for error in result.errors: - print('\t%s' % error) + pass + # print('Validation failed!\n') + # for result in e.results: + # print("Error validating data '%s' with '%s'\n\t" % (result.data, result.schema)) + # for error in result.errors: + # print('\t%s' % error) exit(1) From 0980d08d853cdd3b8c3f816385566a9a98b9a139 Mon Sep 17 00:00:00 2001 From: Harsh Deshpande Date: Tue, 13 Oct 2020 12:29:13 +0200 Subject: [PATCH 09/20] clean bug file --- kobuki/e964bbb/e964bbb.bug | 38 +++++++++++++++++++++++++++++--------- 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/kobuki/e964bbb/e964bbb.bug b/kobuki/e964bbb/e964bbb.bug index 33b76d06..8a222f23 100644 --- a/kobuki/e964bbb/e964bbb.bug +++ b/kobuki/e964bbb/e964bbb.bug @@ -12,28 +12,48 @@ classification: "CWE-682: Incorrect Calculation #PHYSICAL" keywords: ['differential drive', 'velocity', 'driver', 'movement'] system: kobuki severity: error -links: +links: [] +failure-codes: + - PROGRAMMING:CALCULATIONS +fault-codes: + - SYSTEM:UNINTENDED-BEHAVIOUR + - SYSTEM:MOTION bug: phase: runtime specificity: robotics-specific architectural-location: application-specific code application: mobile robot - task: differential drive + task: motion subsystem: driver - package: yujinrobot/kobuki/kobuki_driver - languages: null + package: + - yujinrobot/kobuki/kobuki_driver + languages: + - C++ detected-by: developer reported-by: contributor issue: https://github.com/yujinrobot/kobuki/issues/227 time-reported: 2013-02-22T09:09:21Z reproducibility: always - trace: + trace: N/A fix: repo: https://github.com/yujinrobot/kobuki hash: e964bbb8700fb1a9b95c0cfe5a44d43321294d4f - pull-request: null - license: ['BSD'] - fix-in: ['kobuki_driver/src/driver/diff_drive.cpp'] + pull-request: N/A + license: + - 'BSD' + fix-in: + - 'kobuki_driver/src/driver/diff_drive.cpp' languages: - C++ - time: 2013-02-25 (09:31) + time: 2013-02-25T09:31:00Z +time-machine: + ros_distro: hydro + ros_pkgs: + - kobuki_driver + datetime: 2013-02-22T09:09:21Z +bugzoo: + is-build-failure: false + bug-commit: 7404126181d60ac20ebfddefba64405af58d3434 + fix-commit: e964bbb8700fb1a9b95c0cfe5a44d43321294d4f + fork-urls: + - https://github.com/robust-rosin/kobuki From bf1ddad9319d3a859d05868cb335bee71ca9f8fc Mon Sep 17 00:00:00 2001 From: Harsh Deshpande Date: Tue, 13 Oct 2020 12:29:32 +0200 Subject: [PATCH 10/20] added fault and failure codes in schema --- scripts/robust.yaml | 13 ++++++++++++- scripts/yamale_validator.py | 13 +++++-------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/scripts/robust.yaml b/scripts/robust.yaml index 7187186e..60c06b40 100644 --- a/scripts/robust.yaml +++ b/scripts/robust.yaml @@ -7,6 +7,17 @@ system: str(min=1, max=40) severity: enum("error", "warning", "convention-violation", "bad-smell", "minor-issue", "not-a-bug") links: list(regex("^(http)s?://([A-Z0-9])?")) +failure-codes: list(enum("BAD-SMELL", "ROS-SPECIFIC", "NAMING-TYPOS", "COPYPASTA", "DEFAULTS", + "CONFIG:PARAM", "CONFIG:REMAPPING", "CONFIG:ARGS", "CONFIG:CONSTANTS", "CONFIG:ENCODING", "CONFIG:NAMESPACE", "CONFIG:TOPIC", + "BDO:BUILD", "BDO:DEPENDENCY", "BDO:ORCHESTRATION", + "CONCURRENCY:NO-SYNC", "CONCURRENCY:BAD-SYNC", "CONCURRENCY:TIMING", "CONCURRENCY:SIGNALS", + "EVOLUTION:LANGUAGE", "EVOLUTION:LIBRARY", "EVOLUTION:PACKAGE", "EVOLUTION:DEPRECATION", "EVOLUTION:ROBOT", "EVOLUTION:FIRMWARE", "EVOLUTION:DOCS", "EVOLUTION:PATHS", + "PROGRAMMING:LOGIC", "PROGRAMMING:CALCULATIONS", "PROGRAMMING:CONTROL-FLOW", "PROGRAMMING:MISSING-FEATURE", "PROGRAMMING:VALIDATION", "PROGRAMMING:UNINITIALISED", "PROGRAMMING:BROKEN-CONTRACT", "PROGRAMMING:RESOURCES", "PROGRAMMING:DATATYPE", "PROGRAMMING:UNUSED", "PROGRAMMING:PATH", "PROGRAMMING:STRING-FORMATTING", "PROGRAMMING:COMPILER-ERROR", + "MODELS:ROBOT", "MODELS:WORLD", "MODELS:TRANSFORMATIONS", + "SYSTEMS:OS", "SYSTEMS:HARDWARE", "SYSTEM:FIRMWARE", "SYSTEMS:CONFIG")) +fault-codes: list(enum("WARNING", "UNKNOWN", "HARMLESS", "MISLEADING", "NONE", + "SYSTEM:LIVENESS", "SYSTEM:UNINTENDED-BEHAVIOUR", "SYSTEM:PERFORMANCE", "SYSTEM:NONE", "SYSTEM:PHYSICAL", "SYSTEM:MOTION", "SYSTEM:SIMULATION", + "SOFTWARE:BUILD", "SOFTWARE:RUNTIME", "SOFTWARE:NETWORK", "SOFTWARE:UX", "SOFTWARE:CONCURRENCY", "SOFTWARE:PERFORMANCE")) bug: include('_bug') fix: include('_fix') time-machine: include('_time-machine') @@ -20,7 +31,7 @@ _bug: "application-specific") architectural-location: enum("application-specific code", "platform code", "N/A") application: any(str(min=1), null()) - task: enum("perception", "localization", "planning", "manipulation", + task: enum("perception", "localization", "planning", "manipulation", "motion", "human-robot interaction", "simulation", "diagnostics", "SLAM", "N/A") subsystem: str(min=1) diff --git a/scripts/yamale_validator.py b/scripts/yamale_validator.py index f9ef4dca..db4cd301 100644 --- a/scripts/yamale_validator.py +++ b/scripts/yamale_validator.py @@ -21,15 +21,12 @@ def _is_valid(self, value): # Validate data against the schema. Throws a ValueError if data is invalid. try: - results = yamale.readers.yaml_reader.parse_yaml(sys.argv[1]) - print(results[0]['fix']['license']) yamale.validate(schema, data) print('Validation success! 👍') except yamale.YamaleError as e: - pass - # print('Validation failed!\n') - # for result in e.results: - # print("Error validating data '%s' with '%s'\n\t" % (result.data, result.schema)) - # for error in result.errors: - # print('\t%s' % error) + print('Validation failed!\n') + for result in e.results: + print("Error validating data '%s' with '%s'\n\t" % (result.data, result.schema)) + for error in result.errors: + print('\t%s' % error) exit(1) From dfefc15249b0c1fafa4be18830b5d223f2a69b6f Mon Sep 17 00:00:00 2001 From: Harsh Deshpande Date: Wed, 9 Sep 2020 18:28:16 +0200 Subject: [PATCH 11/20] update validator and bug - added date validator - included time-machine and bugzoo fields in sample bug --- scripts/yamale.bug | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/yamale.bug b/scripts/yamale.bug index e1be36dd..7266f127 100644 --- a/scripts/yamale.bug +++ b/scripts/yamale.bug @@ -16,7 +16,6 @@ keywords: - frame conversion system: mavros severity: error -links: ['https://github.com/yujinrobot/yujin_ocs/issues/7', 'http://wiki.ros.org/robot_pose_ekf'] bug: phase: runtime-operation specificity: general issue From 0c66f0a6ccaee328c09f03689b6d0aab450abc3e Mon Sep 17 00:00:00 2001 From: Harsh Deshpande Date: Wed, 7 Oct 2020 14:32:38 +0200 Subject: [PATCH 12/20] validate links not the best solution, since difficult to generalize URLs --- scripts/yamale.bug | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/yamale.bug b/scripts/yamale.bug index 7266f127..35066fc7 100644 --- a/scripts/yamale.bug +++ b/scripts/yamale.bug @@ -16,6 +16,7 @@ keywords: - frame conversion system: mavros severity: error +links: [] bug: phase: runtime-operation specificity: general issue From 16a8b581f757e803ed53e7319841ef57ac1bb60f Mon Sep 17 00:00:00 2001 From: Harsh Deshpande Date: Thu, 15 Oct 2020 10:44:59 +0200 Subject: [PATCH 13/20] included locomotion in task schema --- kobuki/e964bbb/e964bbb.bug | 2 +- scripts/robust.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/kobuki/e964bbb/e964bbb.bug b/kobuki/e964bbb/e964bbb.bug index 8a222f23..4dd2038e 100644 --- a/kobuki/e964bbb/e964bbb.bug +++ b/kobuki/e964bbb/e964bbb.bug @@ -23,7 +23,7 @@ bug: specificity: robotics-specific architectural-location: application-specific code application: mobile robot - task: motion + task: locomotion subsystem: driver package: - yujinrobot/kobuki/kobuki_driver diff --git a/scripts/robust.yaml b/scripts/robust.yaml index 60c06b40..61420182 100644 --- a/scripts/robust.yaml +++ b/scripts/robust.yaml @@ -31,7 +31,7 @@ _bug: "application-specific") architectural-location: enum("application-specific code", "platform code", "N/A") application: any(str(min=1), null()) - task: enum("perception", "localization", "planning", "manipulation", "motion", + task: enum("perception", "localization", "planning", "manipulation", "locomotion", "human-robot interaction", "simulation", "diagnostics", "SLAM", "N/A") subsystem: str(min=1) From f67bb239b280c8c408b9ac84ae4ece53d0797059 Mon Sep 17 00:00:00 2001 From: Harsh Deshpande Date: Sun, 18 Oct 2020 23:30:35 +0200 Subject: [PATCH 14/20] allow running script from outside folder --- scripts/yamale_validator.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/scripts/yamale_validator.py b/scripts/yamale_validator.py index db4cd301..ea0764c7 100644 --- a/scripts/yamale_validator.py +++ b/scripts/yamale_validator.py @@ -1,5 +1,6 @@ # Import Yamale and make a schema object: import sys +import os import yamale import datetime from yamale.validators import DefaultValidators, Validator @@ -14,7 +15,11 @@ def _is_valid(self, value): validators = DefaultValidators.copy() # This is a dictionary validators[Date.tag] = Date -schema = yamale.make_schema('./robust.yaml', validators=validators) +dir_here = os.path.dirname(__file__) +schema_path = os.path.join(dir_here, 'robust.yaml') +data_path = os.path.join(dir_here, 'yamale.bug') + +schema = yamale.make_schema(schema_path, validators=validators) # Create a Data object data = yamale.make_data(sys.argv[1]) @@ -29,4 +34,4 @@ def _is_valid(self, value): print("Error validating data '%s' with '%s'\n\t" % (result.data, result.schema)) for error in result.errors: print('\t%s' % error) - exit(1) + sys.exit(1) From 8d1c78e6a49d15494289a722ebc1618ea719b4a4 Mon Sep 17 00:00:00 2001 From: Harsh Deshpande Date: Sun, 18 Oct 2020 23:31:19 +0200 Subject: [PATCH 15/20] updated schema as per issues/361 --- scripts/robust.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/robust.yaml b/scripts/robust.yaml index 61420182..f8fa7624 100644 --- a/scripts/robust.yaml +++ b/scripts/robust.yaml @@ -26,7 +26,7 @@ bugzoo: include('_bugzoo') --- _bug: - phase: enum("build", "startup", "runtime", "does not apply") + phase: enum("build", "deployment", "runtime", "does not apply", "unknown") specificity: enum("general issue", "robotics-specific", "ROS-specific", "application-specific") architectural-location: enum("application-specific code", "platform code", "N/A") From ff8ced934862ff5624b8b915558db5c5c6061f08 Mon Sep 17 00:00:00 2001 From: Harsh Deshpande Date: Mon, 19 Oct 2020 10:11:24 +0200 Subject: [PATCH 16/20] added encoding --- scripts/yamale_validator.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/yamale_validator.py b/scripts/yamale_validator.py index ea0764c7..02d4e59c 100644 --- a/scripts/yamale_validator.py +++ b/scripts/yamale_validator.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + # Import Yamale and make a schema object: import sys import os From 673d8c594b14ea8ed391ff36adf24891ced8071d Mon Sep 17 00:00:00 2001 From: Harsh Deshpande Date: Tue, 20 Oct 2020 10:08:37 +0200 Subject: [PATCH 17/20] run bash script from anywhere --- scripts/validate.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/validate.sh b/scripts/validate.sh index fb13eff1..0f80ed19 100755 --- a/scripts/validate.sh +++ b/scripts/validate.sh @@ -1,6 +1,7 @@ #!/bin/bash # usage: ./validate.sh bugid.bug - +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" +VALIDATOR="${DIR}/yamale_validator.py" echo Checking schema compliance for $1 -python3 yamale_validator.py $1 +python3 ${VALIDATOR} $1 From e55f4823afa1f741338ececfdf56d3141cb6f75b Mon Sep 17 00:00:00 2001 From: Harsh Deshpande Date: Tue, 20 Oct 2020 10:10:54 +0200 Subject: [PATCH 18/20] added yamale to requirements.txt --- scripts/requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/requirements.txt b/scripts/requirements.txt index 75b71cb4..3a165a2f 100644 --- a/scripts/requirements.txt +++ b/scripts/requirements.txt @@ -4,3 +4,4 @@ requests>=2.19.1 docker>=3.5.0 packaging~=19.0 bugzoo>=2.1.27 +yamale==3.0.4 From 7971f5f3a0e2699d1a7aac28d7017a6a5fbc933d Mon Sep 17 00:00:00 2001 From: Harsh Deshpande Date: Thu, 22 Oct 2020 11:08:20 +0200 Subject: [PATCH 19/20] added python 3.6 to travis --- .travis.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 6610cf7e..b3cd2011 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,7 @@ language: python -python: ["2.7"] +python: + - "2.7" + - "3.6" cache: pip install: pip install yamllint script: "find . -type f -name *.bug | xargs yamllint -f parsable -c .yamllint.yml" From d5dddb8e2f90847fdc94ee028d23f79ebc3d9111 Mon Sep 17 00:00:00 2001 From: Harsh Deshpande Date: Thu, 22 Oct 2020 11:09:07 +0200 Subject: [PATCH 20/20] deleted yamale.bug it is not complete, was just an initial test to try yamale --- scripts/yamale.bug | 59 ---------------------------------------------- 1 file changed, 59 deletions(-) delete mode 100644 scripts/yamale.bug diff --git a/scripts/yamale.bug b/scripts/yamale.bug deleted file mode 100644 index 35066fc7..00000000 --- a/scripts/yamale.bug +++ /dev/null @@ -1,59 +0,0 @@ -%YAML 1.1 ---- -id: b96bf67 -title: Incorrect orientation (wrong frame) passed to set_attitude_target -description: > - MAVROS operates on a frame of base_link->ENU, whereas MAVLink - operates on aircraft->NED. Therefore, location and orientation - must be transformed between these two frames when communicating - between them. The buggy function correctly performs the - necessary frame conversions, but fails to pass the converted - orientation in the "set_attitude_target" function call. -classification: CWE-137 Representation Errors #PHYSICAL -keywords: - - incorrect argument - - function call - - frame conversion -system: mavros -severity: error -links: [] -bug: - phase: runtime-operation - specificity: general issue - architectural-location: N/A - application: N/A - task: N/A - subsystem: N/A - package: [mavlink/mavros/mavros] - languages: - - C++ - detected-by: developer - reported-by: contributor - issue: N/A - time-reported: - reproducibility: N/A - trace: N/A -fix: - repo: https://github.com/mavlink/mavros - hash: b96bf672a718b9f0c9694e4314283e385ba96231 - pull-request: https://github.com/mavlink/mavros/pull/537 - license: - - BSD - - GPLv3 - - LGPLv3 - fix-in: - - mavros/src/plugins/setpoint_raw.cpp - languages: - - C++ - time: 2016-04-29T13:59:23-04:00 -time-machine: - ros_distro: indigo - ros_pkgs: - - mavros - datetime: 2016-04-29T13:59:23-04:00 -bugzoo: - is-build-failure: false - bug-commit: 4f317228c5d5c5bfc96f3f0dfa692bc4b93dcc43 - fix-commit: b96bf672a718b9f0c9694e4314283e385ba96231 - fork-urls: - - https://github.com/robust-rosin/mavros