|
|
||
|---|---|---|
| .. | ||
| README.md | ||
| __init__.py | ||
| archived.py | ||
| base.py | ||
| brands.py | ||
| description.py | ||
| hacsjson.py | ||
| images.py | ||
| information.py | ||
| integration_manifest.py | ||
| issues.py | ||
| manager.py | ||
| topics.py | ||
README.md
Repository validation
This is where the validation rules that run against the various repository categories live.
Structure
- There is one file pr. rule.
- All rule needs tests to verify every possible outcome for the rule.
- It's better with multiple files than a big rule.
- All rules uses
ActionValidationBaseas the base class. - Only use
validateorasync_validatemethods to define validation rules. - If a rule should fail, raise
ValidationExceptionwith the failure message.
Example
from .base import (
ActionValidationBase,
ValidationBase,
ValidationException,
)
class SuperAwesomeRepository(ActionValidationBase):
category = "integration"
async def async_validate(self):
if self.repository != "super-awesome":
raise ValidationException("The repository is not super-awesome")