|
6 | 6 |
|
7 | 7 | from returns.maybe import Maybe, Nothing, Some |
8 | 8 |
|
9 | | -from .result import make_failure, make_skipped, make_success |
| 9 | +from .result import make_report, make_skipped |
10 | 10 |
|
11 | 11 | if TYPE_CHECKING: |
12 | 12 | from .context import SanityContext |
@@ -48,15 +48,22 @@ def __call__(self, context: SanityContext) -> Report: |
48 | 48 | return make_skipped(self.id, self.name, self.severity, self.description, skip) |
49 | 49 |
|
50 | 50 | reasons = self.check(context) |
51 | | - if reasons: |
52 | | - return make_failure(self.id, self.name, self.severity, self.description, reasons) |
53 | | - else: |
54 | | - return make_success(self.id, self.name, self.severity, self.description) |
| 51 | + return make_report( |
| 52 | + self.id, self.name, self.severity, self.description, reasons, strict=context.strict |
| 53 | + ) |
55 | 54 |
|
56 | 55 | def can_skip(self, _: SanityContext) -> Maybe[Reason]: |
57 | 56 | """Return a skip reason if the checker should be skipped.""" |
58 | 57 | return Nothing |
59 | 58 |
|
60 | 59 | @abstractmethod |
61 | | - def check(self, context: SanityContext) -> list[Reason]: |
| 60 | + def check(self, context: SanityContext) -> list[Reason] | None: |
| 61 | + """Return a list of reasons if the checker fails, or None if it passes. |
| 62 | +
|
| 63 | + Args: |
| 64 | + context (SanityContext): The sanity context. |
| 65 | +
|
| 66 | + Returns: |
| 67 | + A list of reasons if the checker fails, or None if it passes. |
| 68 | + """ |
62 | 69 | pass |
0 commit comments