all2md.linter.registry
Rule registry for the linter.
Mirrors the singleton pattern used by all2md.transforms.registry.TransformRegistry:
__new__-based singleton, lazy plugin discovery via entry points, and a
small lookup/listing API. Built-in rules register themselves when
all2md.linter.rules (the rule package) is imported.
- class all2md.linter.registry.RuleRegistry
Bases:
objectSingleton registry mapping rule codes to
LintRuleclasses.Return the process-wide singleton instance.
- static __new__(cls) RuleRegistry
Return the process-wide singleton instance.
- unregister(code: str) bool
Remove a registered rule by code. Returns True if found.
- has_rule(code: str) bool
Return True if
codeis registered.
- list_rules(category: str | None = None) list[str]
List all registered rule codes, optionally filtered by category.
- clear() None
Remove every registered rule and reset initialisation state.
Primarily intended for tests that need a clean slate.
- discover_plugins() int
Load rule classes from the
all2md.lint_rulesentry point group.Each entry point is expected to return a
LintRulesubclass. Failures are logged but do not abort discovery.