Logo BCDDLogo CSC
BCDDBehavioural Contract-Driven Design
version 1.0-beta
ITEN

10. The bcdd check command

Form: bcdd check [--strict] [--json] [--dir FOLDER]... FILE.

Case Standard output Standard error Exit code
file read, no errors; without --strict, or with --strict and no unrecognised lines the report nothing 0
file read, at least one error (with or without --strict) the report nothing 1
file read, no errors, --strict and at least one unrecognised line the report nothing 3
file that does not exist: the system answers that the name is not there, or that a part of the path is not a folder; also a symbolic link that points to a file that does not exist nothing bcdd check: file not found: ARG 2
is a folder or is not a regular file nothing bcdd check: not a file: ARG 2
any other reason why the file cannot be examined or read: file permissions, permissions of a folder of the path, read error nothing bcdd check: not readable: ARG 2
non-UTF-8 bytes nothing bcdd check: the file is not valid UTF-8 (line N), with N the line of the first wrong byte 2
--dir ARG: the name is not there, or a part of the path is not a folder nothing bcdd check: folder not found: ARG 2
--dir ARG exists but is not a folder nothing bcdd check: not a folder: ARG 2
--dir ARG is a folder but cannot be opened to read its contents; or it is not known whether it exists, because the query to the system fails for another reason (for example a folder of the path without traverse permission) nothing bcdd check: folder not readable: ARG 2
missing or extra arguments; --strict repeated; --json repeated; --dir without argument; the same --dir repeated; another option that begins with - nothing usage: bcdd check [--strict] [--json] [--dir FOLDER]... FILE 2

ARG is the argument exactly as it was written. Every error message ends with an LF. The checks are made in this order: the arguments; then the file (that it exists, that it is a regular file, that it can be read, that it is UTF-8); then the --dir folders, one at a time in the written order. The first that fails decides the message. A symbolic link is followed: a link to a folder is a folder, a broken one is “not found”. “Not readable” deliberately does not state the cause: for check the person needs to know only that the file has not been checked, and code 2 says so.

What prevails. If a file has errors and also unrecognised lines, with --strict the code is 1: errors prevail, because they are the more serious problem and must be corrected first; the unrecognised lines remain visible in section 5 and in the outcome line. In general, from the strongest: 2 (the file could not be checked), 1 (errors), 3 (only unrecognised lines, with --strict), 0. Code 3 therefore comes only from a file read in full and without errors. E14 is an error like the others (code 1). Neither a citation not found nor a citation found in a file with errors or with unrecognised lines changes the exit code, with or without --strict.

Properties that check respects:

For an unknown command and for bcdd without arguments: nothing on standard output, and on standard error

usage: bcdd [--lang it|en] COMMAND; commands: new NAME | check [--strict] [--json] [--dir FOLDER]... FILE | refine FILE [--csc NAME] | ratify FILE [--csc NAME] [--dir FOLDER]... [ID | --all] D-number

on a single line, with a final LF; code 2.

The language of the texts. bcdd writes its texts in English, or in Italian on request. Form: bcdd [--lang it|en] COMMAND ….