Conversation
|
Ha, CI is actually working: ;) |
|
|
scripts/robust.yaml
Outdated
| system: str(min=1, max=40) | ||
| severity: enum("error", "warning", "convention-violation", "bad-smell", | ||
| "minor-issue", "not-a-bug") | ||
| links: list(str()) |
There was a problem hiding this comment.
added a preliminary check for URLs in 9e9be82, but better solutions welcome
| task: enum("perception", "localization", "planning", "manipulation", | ||
| "human-robot interaction", "simulation", "diagnostics", "SLAM", | ||
| "N/A") | ||
| subsystem: str(min=1) |
There was a problem hiding this comment.
Shouldn't this be an enum?
There was a problem hiding this comment.
you mean the subsystem. I think we should definitely make sure that consistent names and spelling is used, otherwise, I think it is of secondary importance, whether it is an enum or not. If you make it enum it is easier for you to detect divergences. The cost is that the scheme has to be changed whenever a new value pops up. I think this is a price that is entirely acceptable. So if you prefer to let yamale control it, just go ahead.
| try: | ||
| yamale.validate(schema, data) | ||
| print('Validation success! 👍') | ||
| except yamale.YamaleError as e: |
There was a problem hiding this comment.
Handle errors in each field
|
Ping @ipa-hsd: could you update us on the status of this PR? |
|
Command: Example out of the script (it checks for all bug files at once): |
scripts/yamale_validator.py
Outdated
| print("Error validating data '%s' with '%s'\n\t" % (result.data, result.schema)) | ||
| for error in result.errors: | ||
| print('\t%s' % error) | ||
| exit(1) |
There was a problem hiding this comment.
I think that this should be sys.exit
|
The timestamps should actually be in ISO 8601 format. I believe what you have (now) is in that format, but just wanted to mention the "official" name. |
|
Note btw: I'm not sure you can just use the Just changing the format is not going to result in correct timestamps. Having incorrect timestamps will lead to the time-machine using incorrect |
|
It's probably worth adding a particular version of |
scripts/yamale_validator.py
Outdated
| @@ -0,0 +1,18 @@ | |||
| # Import Yamale and make a schema object: | |||
| import yamale | |||
| schema = yamale.make_schema('./robust.yaml') | |||
There was a problem hiding this comment.
This will prevent the script from being run outside the scripts directory. To allow the script to be used anywhere, you could add:
import os
dir_here = os.path.dirname(__file__)
schema_path = os.path.join(dir_here, 'robust.yaml')
data_path = os.path.join(dir_here, 'yamale.bug')
scripts/validate.sh
Outdated
| 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 |
There was a problem hiding this comment.
Update to allow script to be executed from outside of the scripts directory.
There was a problem hiding this comment.
Should we go "all out" and add argparse support?
Then add an arg to specify the location of the schema.
scripts/robust.yaml
Outdated
| --- | ||
|
|
||
| _bug: | ||
| phase: enum("build", "startup", "runtime", "does not apply") |
trying out yamale though
- added date validator - included time-machine and bugzoo fields in sample bug
not the best solution, since difficult to generalize URLs
- added date validator - included time-machine and bugzoo fields in sample bug
not the best solution, since difficult to generalize URLs
|
As per #376 (comment), dropped 0c46707 |
|
@gavanderhoorn @ChrisTimperley please take a look now. |
| pull-request: null | ||
| license: ['BSD'] | ||
| fix-in: ['kobuki_driver/src/driver/diff_drive.cpp'] | ||
| pull-request: N/A |
There was a problem hiding this comment.
Just a question: we don't use null any more for this then? Or was that too ambiguous (as in: could also mean we just haven't bothered to look for one)?
There was a problem hiding this comment.
I am not sure in general, but for this specific case, the commit was not part of any PR. So N/A might be more suitable here.
| 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 |
There was a problem hiding this comment.
Does our CI setup guarantee Python 3 is installed?
There was a problem hiding this comment.
I would suggest to add that, just so we keep things working/consistent.
Just checked and the current .travis.yml actually specifies 2.7.
scripts/yamale.bug
Outdated
| bug-commit: 4f317228c5d5c5bfc96f3f0dfa692bc4b93dcc43 | ||
| fix-commit: b96bf672a718b9f0c9694e4314283e385ba96231 | ||
| fork-urls: | ||
| - https://github.com/robust-rosin/mavros |
There was a problem hiding this comment.
This is a "test bug", correct? Should we rename it to something like yamale_test.bug?
There was a problem hiding this comment.
We could even delete this. I haven't been careful with this one. The kobuki bug in this PR is more complete.
gavanderhoorn
left a comment
There was a problem hiding this comment.
Other than the inline comments, this looks OK.
it is not complete, was just an initial test to try yamale
|
addressed the inline comments by @gavanderhoorn. Merging this PR. |
|
Bit of a pet peeve, sorry, but remember to squash and rebase next time so that we maintain a sensible commit history on |
Fixes most of the issues with the schema.
Though this doesn't allow automating fixing the bug files in any way. Porting to yamale. See #355