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" diff --git a/kobuki/e964bbb/e964bbb.bug b/kobuki/e964bbb/e964bbb.bug index 33b76d06..4dd2038e 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: locomotion 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 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 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)." }, diff --git a/scripts/robust.yaml b/scripts/robust.yaml new file mode 100644 index 00000000..f8fa7624 --- /dev/null +++ b/scripts/robust.yaml @@ -0,0 +1,75 @@ +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(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') +bugzoo: include('_bugzoo') + +--- + +_bug: + 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") + application: any(str(min=1), null()) + task: enum("perception", "localization", "planning", "manipulation", "locomotion", + "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: 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)) + 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: 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}$") diff --git a/scripts/validate.sh b/scripts/validate.sh index 5dd79d8e..0f80ed19 100755 --- a/scripts/validate.sh +++ b/scripts/validate.sh @@ -1,11 +1,7 @@ #!/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" +VALIDATOR="${DIR}/yamale_validator.py" 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 ${VALIDATOR} $1 diff --git a/scripts/yamale_validator.py b/scripts/yamale_validator.py new file mode 100644 index 00000000..02d4e59c --- /dev/null +++ b/scripts/yamale_validator.py @@ -0,0 +1,39 @@ +# -*- coding: utf-8 -*- + +# Import Yamale and make a schema object: +import sys +import os +import yamale +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 + +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]) + +# 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) + sys.exit(1) 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