Code of Conduct
Feature Description
Add official support for generator-style system checks:
@register()
def some_check():
if condition:
yield Error()
if other_contition:
yield Warning()
Problem
Currently, you always have to declare an errors list and append new error items, like so:
@register()
def some_check():
errors = []
if condition:
errors.append(Error())
if other_contition:
errors.append(Warning())
return errors
In some places, generators may work. In others, they don't.
While we can argue about the beauty generator-style checks, they are functionally different:
- They don't allocate memory for lists.
- You can only iterate over a generator instance once.
The former is a nice bonus. The latter has a benefit that passing stale check results along, or other state leaks, becomes much harder to fall victim to.
Request or proposal
proposal
Additional Details
No response
Implementation Suggestions
Document a generator-style check and one to the test suite for each check type.
I'd love to keep this lean and clean. If we want to rewrite internal checks, this can be done in a later patch.
Code of Conduct
Feature Description
Add official support for generator-style system checks:
Problem
Currently, you always have to declare an
errorslist and append new error items, like so:In some places, generators may work. In others, they don't.
While we can argue about the beauty generator-style checks, they are functionally different:
The former is a nice bonus. The latter has a benefit that passing stale check results along, or other state leaks, becomes much harder to fall victim to.
Request or proposal
proposal
Additional Details
No response
Implementation Suggestions
Document a generator-style check and one to the test suite for each check type.
I'd love to keep this lean and clean. If we want to rewrite internal checks, this can be done in a later patch.