10. The bcdd check command
Form: bcdd check [--strict] [--json] [--dir FOLDER]... FILE.
- The option
--strictcan be written before or afterFILE, only once. - The option
--jsoncan be written before or afterFILE, in any order with the others, only once. It performs the same check, with the same exit codes and the same messages on standard error; on standard output, in place of the report, it writes a single JSON object, with"forma": "bcdd-check"and"versione": 5. The object contains, among other things: the fieldmolteplicitaof thePARTcitations (section 4.9); aTYPEdeclaration for a list of values, for a named type and for aRecord, andSCENARIOfor an entity scenario;variantiinENTITYblocks;variante({"dimensione", "scelta"}ornull) in declarations, guarantees and citations;in(the suffix without parentheses orin:, ornull) in errors and in uses, whosemessaggioandtestoremain without the suffix; in therapporto,ha_composizioni,composizioni[](section 9) andassenze[](section 10). From version 5: the valuesBINDING,VERIFICATIONandPROFILEofblocchi[].tipo, withlegata({"nome", "versione"}of the bound CSC) andnome_proprio(the name afterAS, ornull) for aBINDING, andestensioni[]for aPROFILE(for each onenome,da,a,kind,level,riduzionetrue or false);statonullfor aVERIFICATION; the citations of typeIMPORT,LEGATAandUSINGin thecitazioni[]of every block; the valuesformaleandestensione_dichiarataofgaranzie[].gradoand ofrapporto.gradi[].grado, and the countrapporto.conteggi.estensione_dichiarata, alongsideverbale,formaleandnon_riconosciuta; the countsrapporto.conteggi.forme_mancanti(thekof section 12) andrapporto.conteggi.non_eseguite_piano(thekof section 13);rapporto.ha_bindingandrapporto.ha_verification(true if the file has at least one block of that type); inrapporto.ipotesi[]the fieldtipo(GUARANTEE,ASSUME,DEFINE,SCENARIO,BIND,EXTENSION); the fieldmotivo(ornull) in the entries ofrapporto.non_riconosciute[];rapporto.forme_mancanti[](section 12),rapporto.copertura[](section 13),rapporto.da_giudicare[](section 14) andrapporto.non_eseguiti[](section 15), always present, empty when the section is absent. From version 5 there are no longerrapporto.conteggi.non_lette,rapporto.blocchi_non_letti[]nor the valuenon_lettaofrighe[].tipo, because no block remains unread.esito.rigais the one of the report. Adding a field does not change the version of the form; removing one, or changing its meaning, does. In the rows of the table below with “the report”, with--jsonread “the JSON object”; where standard output is “nothing”, it remains nothing. - Each
--dir FOLDERis written before or afterFILE, in any order with respect to the other options. The argument that follows--diris always the folder, even if it begins with-:--dir --strictlooks for a folder named--strict. - The same string after two
--diroptions is incorrect usage; two different strings for the same folder (aand./a) are admitted and both are searched. A--direqual to the folder of the file is not an error. - Any other argument that begins with
-, including--dir=X, is incorrect usage; a file whose name begins with-is indicated with its path, for example./-x.csc. - The folders serve only for the search of citations (section 9.4): in a file without entities they change nothing other than the first line of the report.
| 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:
- the file never changes, nor do the files it reads for the citations, not even the modification date;
- the degree of every contractual line, every
UNDECIDEDand every line pending approval are in the report; - every rule that remains to be judged (section 14) and every check not executed on the formulas (section 15) are in the report: no formula appears more checked than it is;
- every unrecognised line is in section 5, with its number;
- the same file, with the same cited files and the same folders, always gives the same report, byte for byte, from
whatever folder the command is launched, provided that the
--diroptions name the same folders (a relative--dirnames a different folder from another working folder); - with
--stricta file with even a single unrecognised line gives an error outcome (code 3, or 1 if there are also errors); without--strictan unrecognised line does not change the code; - every citation of an entity of the file is under the entity, if found, or in section 7, with the reason if there is one; a citation with E01 is not searched for and is visible from its error in section 1; a missing citation, or a cited file with errors, does not change the outcome;
- a cited version different from the one found is in the report (
, expected VERSION w); - inside an entity with all parts found, for a CSC that a part uses, that no other part provides and that
the entity does not use from outside (with
USES),bcddsignals E14.
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 ….
--langis written only before the command, as the first two arguments; after the command it is an unknown option, hence incorrect usage of that command. The values are exactlyitanden.- Precedence:
--lang, then the environment variableBCDD_LANG(itoren; empty counts as not set), then English. The variablesLANG,LC_ALLandLANGUAGEare not read. - An invalid value is incorrect usage: code 2, nothing on standard output and on standard error
bcdd: --lang accepts it or en: ARG, in the language that would apply without the option; for the variablebcdd: BCDD_LANG must be it or en, not: X, always in English.bcdd --langwithout a value andbcdd --lang itwithout a command give the general usage line, code 2. - The language changes only the texts for the person: titles and entries of the report, error messages, outputs and
refusals of the commands, usage lines (
uso:/usage:,NOME/NAME,CARTELLA/FOLDER), comments andPURPOSEstring of the skeleton ofnew(section 11), initial comment of a new dialogue file (section 13), letters of the answers ofrefine(s,n,fin Italian;y,n,qin English), names of the compositions (with Pandwithout P, in Italiancon Pandsenza P, section 4.10). Withrefinethe request to the language model is also in the chosen language. The following do not change: keywords, error codes, line and column numbers, the first line of the report (which does not show--lang), the structure of the report, exit codes, literal values of options (--expect nuovo,--modello veloce|accurato), the markers of the dialogue file, theSTATUS RATIFIED BYlines written byratify. - With
--jsonthe object has, immediately after"versione", the additional field"lingua"("it"or"en"); keys and enumerated values do not change, only the text fields for the person change (among othersmessaggio,testo,motivo,esito.riga). The form remains 5. bcdd save, used by bcdd-editor and not described in this document, writes its usage line in the chosen language.

