Damage a file you already have
You do not need a recipe to test with bad data. qadg corrupt takes a CSV file you already have, damages a copy of it and writes the manifest beside it.
Run it
$ qadg corrupt --layers L2,L3,UNI,REV --seed readme customers.csv customers: 1000 rows, 6 columns, nothing declared what any of them holds first_name taken for a column of string values, because no numbering scheme this build carries accepted 1000 values of this column, and its header is one this build reads as naming given names ... card taken for a column of card values, because every one of 1000 values of this column was accepted by the card validator, and by no other scheme carrying a check digit ... customers.corrupted.csv and expectation-manifest.json written to . 46 defects ordered, 15 applied, manifest in expectation-manifest.json ...
Your file stays as it was. The damaged copy is customers.corrupted.csv, written beside the manifest.
What it works out about your columns
Nothing in a plain CSV file says what a column holds, so qadg corrupt looks at the values, and at the header. A column whose every value passes the card validator, and no other scheme with a check digit, is taken for card numbers. For every column it says what it decided and why, as in the lines above, and it lists what it could not work out rather than guessing.
Damage that needs a kind of column your file does not have is listed in the manifest as not applied, with the reason.
Choose what to damage
--layers is required, so you always choose what to attack. What it breaks lists every group and every kind of damage in it. --rows sets the share of rows to damage, 5% unless you say otherwise.
--dry-run shows what it worked out, how many rows it would damage and how, and writes nothing. On a small file a small share can pick no row at all, and both a dry run and a real run say so.
Every flag
| Flag | What it does |
|---|---|
--layers <list> | Which lines of defence to attack, such as L2,L3. Required, because there is no safe default. |
--rows <share> | The share of rows to damage, such as 5%. Defaults to 5%. |
--out <dir> | Write the damaged file and the manifest here. Defaults to the current directory. |
--seed <text> | Draw from this seed. The same seed and the same file give the same damage. |
--delimiter <char> | The character between fields, for reading and for writing back. Defaults to a comma. |
--per-row <how> | exactly_one or any, for how many defects one damaged row carries. |
--exclude-fields <list> | Columns to leave alone, whatever the layers say. |
--locale <name> | Which locale's damage is available. It does not decide what the columns hold, the values do. A locale this build has no data for is refused. |
--manifest <form> | Also write the manifest in this form beside the JSON one: gherkin, csv, markdown. Without it only the JSON is written. |
--overwrite | Write over files that are already there. Without it an existing file stops the run. |
--dry-run | Say what was worked out and what would be damaged, and write nothing. |
In the window
The Damage a file screen does the same: open a CSV file, see what each column holds and why, tick what to damage, see what would happen, then run it. It shows the command that does the same, ready to copy.