File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -93,8 +93,24 @@ With `-f; --fix` option enables to fix issues automatically:
9393` ` ` shell
9494# Fix issues automatically
9595t4sanity < DATA_ROOT> --fix
96+
97+ >>>Sanity checking...: 1it [00:00, 9.70it/s]
98+
99+ === DatasetID: dataset1 ===
100+ ...
101+ REC007: --> FIXED🎉
102+ - All categories either must have an ' index' set or all have a ' null' index.
103+ ...
104+
105+ +-----------+---------+--------+--------+---------+----------+-------+
106+ | DatasetID | Version | Passed | Failed | Skipped | Warnings | Fixed |
107+ +-----------+---------+--------+--------+---------+----------+-------+
108+ | dataset1 | 0 | 49 | 0 | 2 | 3 | 1 |
109+ +-----------+---------+--------+--------+---------+----------+-------+
96110` ` `
97111
112+ The generated report contains failure or warning reasons, but it' s considered as passed if the fix was successful.
113+
98114### Exit Status Logic
99115
100116`t4sanity` CLI returns the exit code based on the following conditions:
Original file line number Diff line number Diff line change @@ -22,12 +22,28 @@ save_json(serialize_dataclass(result), "result.json")
2222
2323### How to Add New Checkers
2424
25+ The following diagram shows the logic of the checkers:
26+
27+ ``` mermaid
28+ flowchart LR
29+ Start --> A{Can skip?}
30+ A --> |Yes| B[Skip check and <br/>returns skipped report]
31+ A --> |No| C[Perform check]
32+ C --> D{Failed and --fix=True?}
33+ D --> |Yes| E[Fix issues]
34+ E --> F[Return report]
35+ D --> |No| F
36+ ```
37+
2538All checkers must follow:
2639
2740- Implement a class that inherits from ` Checker ` class.
2841- Its ID must be unique and belong to one of ` RuleGroup ` enum.
29- - Override the ` check() -> list[Reason] | None ` method to perform the specific check.
3042- Register the checker using ` CHECKERS.register() ` decorator.
43+ - Override the ` check(...) -> list[Reason] | None ` method to perform the specific check.
44+ - [ OPTIONAL] The following methods can be overridden if needed:
45+ - Override ` can_skip(...) -> Maybe[Reason] ` method to determine whether the checker can be skipped.
46+ - Override ` fix(...) -> bool ` method to fix the issue if possible.
3147
3248``` python title="str000.py"
3349from __future__ import annotations
You can’t perform that action at this time.
0 commit comments