From ca6133868767e7ef7ff7015a3ff34392eb956d80 Mon Sep 17 00:00:00 2001 From: Jochem van Dooren Date: Tue, 23 Apr 2024 11:37:59 +0200 Subject: [PATCH] Prevent Rule from being discovered by rule registry (#12) - Prevent `Rule` from being added to the set of rules. - At the same time, fix a small documentation typo. --- docs/reference/scoring.md | 2 +- src/dbt_score/rule_registry.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/reference/scoring.md b/docs/reference/scoring.md index 4178a49..f69b735 100644 --- a/docs/reference/scoring.md +++ b/docs/reference/scoring.md @@ -1,3 +1,3 @@ -# CLI +# Scoring ::: dbt_score.scoring diff --git a/src/dbt_score/rule_registry.py b/src/dbt_score/rule_registry.py index 4a68280..8e001ff 100644 --- a/src/dbt_score/rule_registry.py +++ b/src/dbt_score/rule_registry.py @@ -49,7 +49,7 @@ def _load(self, namespace_name: str) -> None: module = importlib.import_module(module_name) for obj_name in dir(module): obj = module.__dict__[obj_name] - if type(obj) is type and issubclass(obj, Rule): + if type(obj) is type and issubclass(obj, Rule) and obj is not Rule: self._add_rule(obj_name, obj) def _add_rule(self, name: str, rule: Type[Rule]) -> None: