8000 Add fail-on-violation option to verify by beckyjackson · Pull Request #738 · ontodev/robot · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add fail-on-violation option to verify #738

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Add [`validate`] command [#691]
- Add `--errors <path>` option to [`template`] in [#713]
- Add new formats to [`report`]: HTML, JSON, and XLSX [#699]
- Add `--fail-on-violation <bool>` option to [`verify`] in [#738]

### Fixed
- Handle empty [`template`] property charactersitics in [#719]
Expand Down Expand Up @@ -205,6 +206,7 @@ First official release of ROBOT!
[`template`]: http://robot.obolibrary.org/template
[`validate`]: http://robot.obolibrary.org/validate

[#738]: https://github.com/ontodev/robot/pull/738
[#728]: https://github.com/ontodev/robot/pull/728
[#727]: https://github.com/ontodev/robot/pull/727
[#726]: https://github.com/ontodev/robot/pull/726
Expand Down
10 changes: 10 additions & 0 deletions docs/verify.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,16 @@ And the CSV file `results/equivalent.csv` should have:
first,second,firstLabel,secondLabel
http://purl.obolibrary.org/obo/TEST_A,http://purl.obolibrary.org/obo/TEST_B,,


### Fail on Violation

By default, this command will fail with a non-zero exit code when any violations are found. If you wish the command to succeed (e.g., for use for warnings in workflows), you can include `--fail-on-violation false`. Note that it will still log `FAIL Rule [rule name]` on the command line.

robot verify --input asserted-equiv.owl \
--queries equivalent.sparql \
--fail-on-violation false \
--output-dir results/

---

## Error Messages
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ public class VerifyCommand implements Command {
/** Initialze the command. */
public VerifyCommand() {
Options o = CommandLineHelper.getCommonOptions();
o.addOption("F", "fail-on-violation", true, "logging level to fail on");
o.addOption("i", "input", true, "Input Ontology");
o.addOption("O", "output-dir", true, "Directory to place reports in");

Option queries = new Option("q", "queries", true, "verify one or more SPARQL queries");
queries.setArgs(Option.UNLIMITED_VALUES);
o.addOption(queries);

o.addOption("O", "output-dir", true, "Directory to place reports in");

options = o;
}

Expand Down Expand Up @@ -133,8 +133,9 @@ public CommandState execute(CommandState state, String[] args) throws Exception
}
}

if (!passing) {
throw new Exception(verificationFailed);
boolean failOnViolation = CommandLineHelper.getBooleanValue(line, "fail-on-violation", true);
if (!passing && failOnViolation) {
System.exit(1);
}

return state;
Expand Down
0