Dim
Command Line Interface
Information
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
Dim shall provide a command line switch to print the command line usage. |
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
Dim shall provide a command line switch to print the license. |
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
Dim shall provide a command line switch to print the version. |
Errors
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
On any invalid or missing command line arguments, Dim shall print a meaningful error message and exit with exit code != 0. |
Syntax
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
The following chapter describes each attribute of the different file types. For a complete overview with additional information please refer to the user documentation. |
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
All input files shall be in YAML format. |
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
Invalid characters (according to YAML standard) and in addition non-breaking spaces in requirements files shall be exchanged on-the-fly during loading by a YAML compatible replacement. |
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
All literal values (not arrays or hashes) shall be interpreted as strings even if they would be integers or booleans in standard YAML syntax, e.g. 123 shall be interpreted as "123". |
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
All files shall be compatible to UTF-8. |
Requirements Files
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
A requirements file shall have a "document" name attribute. |
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
If the document name is missing in the requirements file, an error shall be raised. |
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
A requirements file shall have an optional "enclosed" attribute which specifies files which are needed for the requirements, e.g. images. |
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
A requirements file shall have an optional "metadata" attribute which consists of any user specific string, e.g. the origin of the requirements document, history or version. |
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
A requirements file shall have zero or more requirements objects. These objects shall have strings as ID. |
Regular Form
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
In the regular form, the ID shall be a key of a collection of key/values pairs of strings. |
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
A requirements object shall have an optional "type" attribute. |
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
A requirements object shall have an optional "text" attribute. |
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
A requirements object shall have an optional "verification_criteria" attribute. |
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
A requirements object shall have an optional "feature" attribute. |
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
A requirements object shall have an optional "change_request" attribute. |
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
A requirements object shall have an optional "tags" attribute. |
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
A requirements object shall have an optional "asil" attribute. |
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
A requirements object shall have an optional "cal" attribute. |
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
A requirements object shall have an optional "developer" attribute. |
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
A requirements object shall have an optional "tester" attribute. |
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
A requirements object shall have an optional "test_setups" attribute. |
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
A requirement object shall have an optional 'verification_methods' attribute. |
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
"verification_methods" replaces "test_setups". |
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
A requirements object shall have an optional "status" attribute. |
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
A requirements object shall have an optional "review_status" attribute. |
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
A requirements object shall have an optional "comment" attribute. |
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
A requirements object shall have an optional "miscellaneous" attribute. |
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
A requirements object shall have an optional "sources" attribute. |
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
A requirements object shall have an optional "refs" attribute. |
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
A requirements object shall have an optional language attributes for "text", "verification_criteria" and "comment". |
Short Form
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
In the short form, the ID shall be the key of a key/value pair of strings. |
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
If a requirement object has a heading type and only text, it shall be writable in one line for convenience. The value shall include the heading level and the heading text. |
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
If a requirement object has type "information" and only text, it shall be writable in one line for convenience. The value shall include the information type and the text. |
Config Files
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
A config file shall have exactly one "Config" attribute which consists of an array of config entries. |
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
A config entry shall have exactly one "files" entry. |
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
A config entry shall have exactly one "originator" entry. |
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
A config entry shall have exactly one "category" entry. |
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
A config file shall have an optional "Property" attribute. |
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
A config file shall have an optional "Attributes" field. |
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
A config file shall have an optional "disable_naming_convention_check" field a config entry. |
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
If the category for a config entry is "software" and "disable_naming_convention_check" value is not set to "yes", Dim shall check for ID naming conventions. An ID must start with "SRS_" and must be named in SRS_<feature>_<aspect> fashion including the two underscores. The document name must start with "SRS_" and must be named in SRS_<feature> fashion including the underscore. <feature> and <aspect> must be non empty strings with only alphanumeric characters along with hyphen allowed. If this naming convention is not met, Dim shall throw a meaningful error message and exit with exit code != 0. |
Properties File
|
Asil: QM | Cal: QM | Upstream Asil: QM | Upstream Cal: QM |
A properties file shall define default values for attributes of requirement elements which are not explicitly set. |
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
Dim shall be able to accept the attributes file using a command line argument. If the config file includes the reference to custom attributes and another attributes file is loaded using command line argument, then Dim shall load the attributes from both files for processing requirements. In case these attribute files contains duplicate attributes, then attributes referenced from the config file shall be given priority. |
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
When the attributes file is referenced in Config file or passed using the command line argument, Dim shall validate the configuration for custom attributes and load them for processing the requirements. |
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
An attributes file shall accept custom attributes for Dim. |
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
If a single requirements file is loaded, then Dim shall automatically search for "attributes.dim" file recursively in parent directory till root directory is reached. This does not apply if a config file is loaded instead of single requirements file. |
Loading Files
Reading Data
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
Dim shall read the files specified on command line and in the config file. The data shall be made available to subcommands. |
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
Dim shall skip the enclosed file check when "--no-check-enclosed" flag is passed. |
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
If any error occurs during loading the config, property or requirements files, Dim shall print a meaningful error message and exit with exit code != 0. Errors can occur due to file access issues like missing files or the files have invalid syntax. |
Consistency Checks
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
Requirements can reference other requirements which can reference again other requirements in same category level. In case of a cyclic reference, Dim shall print a meaningful error message and exit with exit code != 0. |
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
If a reference cannot be resolved, which means the ID does not exist, Dim shall print a meaningful error message and exit with exit code != 0. |
|
Asil: QM | Cal: QM | Upstream Asil: QM | Upstream Cal: QM |
The command line interface of Dim shall provide an option to disable this unresolved-references-check, which means Dim shall neither complain about missing references nor exit Dim. |
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
If several files share the same document name, the originator and the category must be the same for all of these files. If not, Dim shall print a meaningful error message and exit with exit code != 0. |
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
Dim shall support "module" as alias for "document". If "module" is specified, "document" shall be set to the value of "module". If both are specified, an error shall be raised. |
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
If several files share the same document name, "metadata" must not be defined more than once. Otherwise Dim shall print a meaningful error message and exit with exit code != 0. |
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
Requirement IDs shall be unique over all files. If the same ID is used for more than one requirement, Dim shall print a meaningful error message and exit with exit code != 0. |
Subcommands
check
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
The command line interface of Dim shall provide a "check" subcommand which loads the input files and executes consistency checks. |
stats
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
The command line interface of Dim shall provide a "stats" subcommand which prints basic metrics to the console. The metrics shall be printed for every loaded document and a summary over all documents. |
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
The metrics shall include at least: |
format
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
The command line interface of Dim shall provide a "format" subcommand which formats the loaded requirements files. Missing references are allowed by default while formatting. |
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
The formatter shall adapt the whitespaces in a predefined style. |
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
The formatter shall arrange the attributes in a predefined order. |
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
The formatter shall change requirements from regular to short form if possible. |
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
The formatter shall not remove any attributes, even if the default value is specified. |
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
The formatter shall remove duplicate values in "tags", "verification_methods", "sources" and "refs". |
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
By default, the formatter shall change the files in-place. |
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
It shall be possible to only check the formatting without changing the files. In case of incorrect formatting, an error message shall be printed and Dim shall exit with an exit code != 0. Different line endings like CRLF and LF shall be ignored. |
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
It shall be possible to write the formatted data to extra files and not overwrite the original files. This makes it easier to use third-party compare-tools. |
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
It shall be possible to read the input from STDIN and to print the formatted output to the STDOUT. This functionality supports auto-formatting in text editors like Vim. |
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
The Dim formatter shall remove the "test_setups" attribute from formatted file and keep only 'verification_methods'. |
export
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
The command line interface of Dim shall provide an "export" subcommand which exports the requirements data to other file formats. It shall be possible to specify the output folder. |
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
Within the output folder, a new folder for every document shall be created with a requirements file named "<document>/Requirements.<type>", e.g. "myModule/Requirements.json". The document name shall be sanitized, e.g. "/" shall be converted to "_" to avoid invalid folder names. |
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
Files specified in the enclosed attributes shall be copied to the appropriate document's output folder. |
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
It shall be possible to filter requirements for exports based on their attributes, e.g. that only input and software requirements are exported. |
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
After exporting is complete, files from exported folder which are no longer referenced in the exported folder shall be cleaned up. |
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
Exported requirements file shall contain "verification_methods" and not "test_setups". |
JSON
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
JSON exports shall have all requirement attributes as key/value pairs plus ID, document name and originator. |
CSV
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
CSV exports shall have "Sep=," in the first line to specify the separator character. |
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
CSV exports shall have all requirement attributes plus ID, document name and originator in the second line. The following lines shall consist of the values of the requirements according to the attribute names defined in the second line. |
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
All values shall be wrapped by double quotes. Double quotes in the values shall be escaped. |
RST
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
RST exports shall export the data according to the Sphinx dox_trace extension syntax. |
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
In the RST export, literals like "text" or "verification_criteria" shall be exported as Sphinx raw-html elements to avoid invalid RST files. This means special characters like "<" or "\n" must be escaped or converted. It shall be possible to mark substrings explicitly to skip this conversion. |
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
Existing RST files shall only be overwritten if data has been changed to keep the time stamp of the files. |
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
Additionally to the requirements files, the RST exporter shall create index files for each originator/category pair to be directly used by Sphinx. |
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
Before formatting requirements files with custom attributes, Dim shall load the attributes file first. |
Ruby API
Reading
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
It shall be possible to load files by using the Dim Ruby API directly. A data structure shall be provided with resolved default values if the values are not provided explicitly in the requirements files. |
Convenience Methods for Requirements
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
A requirements object shall provide a method "safety_relevant?" which returns true if "asil" is not set to "QM" or "not_set", otherwise false. |
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
A requirements object shall provide a method "security_relevant?" which returns true if "cal" is set to "CAL_4", otherwise false. |
Additional Getters
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
A requirement shall have a getter for the document name. |
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
A requirement shall have a getter for the originator. The value shall be taken from the config file. If a requirements file was loaded directly without a config file, the originator shall be "". |
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
A requirement shall have a getter for the category. The value shall be taken from the config file. If a requirements file was loaded directly without a config file, the category shall be "unspecified". |
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
A requirement shall have a getter for the filename. |
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
A requirement shall have a getter for the line number. |
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
A requirement shall have a getter for the backward references which are calculated automatically by Dim. |
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
A requirement shall have a getter for the existing references. When loading with disabled missing-reference-check, the list can be shorter than the original list in refs attribute. |
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
A requirement shall have a getter for upstream references, which means a list of IDs from refs to higher category level plus backward-refs from higher or same category level IDs. |
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
A requirement shall have a getter for downstream references, which means a list of IDs from refs to lower or same category level plus backward-refs from lower category level IDs. |
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
The metadata of the documents shall be available via the API. |
Convenience Methods for Attributes With Comma Separated Values
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
Dim shall extend the String class with a "cleanSplit" method which returns an array of the elements without leading and trailing whitespaces. |
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
Dim shall extend the String class with a "cleanArray" method which returns the same as "cleanSplit" but same as cleanSplit, but without empty elements. |
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
Dim shall extend the String class with a "cleanUniqArray" method which returns the same as "cleanArray" but also removes duplicates. |
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
Dim shall extend the String class with a "cleanString" method which returns a string without empty elements, leading and trailing whitespaces. |
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
Dim shall extend the String class with a "cleanUniqString" method which returns the same as "cleanString" but also removes duplicates. |
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
Dim shall extend the String class with an "addEnum" method which add an enum to the string, makes the enums unique and returns the result. |
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
Dim shall extend the String class with a "removeEnum" method which removes all enums from the string and returns the result. |
Writing
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
It shall be possible to change requirements files by using the Dim Ruby API directly. A data structure shall be provided without resolved default values to be able to work on the original data. It shall be possible to write the changed data back to the file system. |
Testing Requirements
|
Asil: QM | Cal: QM | Upstream Asil: - | Upstream Cal: - |
To ease testing, it shall be possible to read the command line output of Dim in unit tests when calling functions directly. This means stdout and stderr need to be redirected through string streams. |