rqm check
rqm check
rqm check reads the whole project and tells you what is wrong with it. It runs nothing, it reads no test reports and it needs no network, so it is safe to run as often as you like, in an editor hook or at the start of a build.
rqm check
It has no options of its own besides --format, --strict and --baseline. The static check cannot be narrowed or switched off: a check that could be would not be a check.
The release gate
rqm check --baseline is the release gate. It does the static check first, and then reads the baseline that rqm.yaml configures and says whether that baseline backs every required requirement. A required requirement that is verified by test passes when the baseline says verified; one that is verified some other way passes when it says not_applicable and the requirement declares manual evidence. The gate reads no run record, so a newer run cannot change its answer.
The exit code of the gate is 0 when every required requirement passes, 1 when one of them does not, and 2 when the project or the baseline has an error. It needs a configured baseline: a project without one exits 2 with E-BASELINE-NOT-CONFIGURED, and a configured file that was not fetched exits 2 with E-BASELINE-MISSING.
$ rqm check
checked 4 requirements (loaded 4 of 4 discovered requirement files)
The summary says how many requirements were checked, and how many of the files that were found became requirements. When the two numbers differ, some files were refused, and diagnostics tell you which and why.
What it checks
rqm.yamlis valid: every key is known, the kinds and the suites are declared properly, and the suites that are required exist.- Every requirement file is a valid requirement. Each file is read on its own terms, so one broken file does not hide the problems in the others.
- Ids and uuids are unique.
- Every
parentand every link refers to a requirement that was loaded, parent chains have no loop and are not deeper than four ancestors, and inherited fields can be inherited. - A requirement that is
requiredand is verified bytesthas a test bound to it (E-REQUIRED-UNBOUND). See Binding tests to requirements.
Here is what it prints when two files are wrong:
$ rqm check
checked 2 requirements (loaded 2 of 4 discovered requirement files)
error[E-FIELD-VALUE]: The field 'status' must be one of draft, approved, required, deprecated, rejected, found 'aproved'
--> requirements/RQM-2.yaml:11:9
error[E-UNKNOWN-FIELD]: Unknown field 'priorty'
--> requirements/RQM-4.yaml:10:1
[exit 2]
Every diagnostic has a code, and Diagnostic codes says what each one means and what to do about it.
The exit code
check exits with 0 when the project has no errors, and with 2 when it has at least one. A warning does not change that, unless you run rqm check --strict, which makes a warning exit with 2 as well. That is the right way to run it in continuous integration. See The command line.
Output for scripts
With --format json, the list of diagnostics is a list of objects with a code, a severity, a message and the place of the problem, and the data holds the counts. Scripts should look at the exit code first and at the codes of the diagnostics after that. The full layout is in The JSON output.
Options
$ rqm check --help
Check the whole project without running anything
Usage: rqm check [OPTIONS]
Options:
--baseline Also check that the baseline backs every required requirement: the release gate
--format <FORMAT> Output format. JSON is the stable contract [default: human] [possible values: human, json]
--strict Treat warnings as errors for the exit code. The output itself does not change
-h, --help Print help