-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add rule catalog #24
Add rule catalog #24
Conversation
template = f"""## `{rule_name}` | ||
|
||
{rule_description} | ||
|
||
??? quote "Source code" | ||
```python | ||
{rule_source_code} | ||
``` | ||
|
||
### Default configuration | ||
|
||
```toml title="pyproject.toml" | ||
{rule_configuration} | ||
``` | ||
""" | ||
return template |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://docs.python.org/3/library/textwrap.html#textwrap.dedent should be suitable here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I first tried that approach, but it ended up creating more issues, when mixing with {rule_source_code}
which is itself indented
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Documentation looks amazing 🤩
@@ -21,7 +21,7 @@ class Config: | |||
|
|||
def __init__(self) -> None: | |||
"""Initialize the Config object.""" | |||
self.rule_namespaces: list[str] = ["dbt_score_rules"] | |||
self.rule_namespaces: list[str] = ["dbt_score.rules", "dbt_score_rules"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What I liked about the previous implementation is that dbt_score.rules
was always included, also when additional rule_namespaces
were supplied. Now when users want to add a namespace (and not lose dbt_score.rules
) they will have to add it as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's correct. The advantage of this approach is that users are able to remove dbt_score.rules
altogether - it puts everything at the same level.
Do you think that'd be an issue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be confusing, but let's document it well 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀
a9be9c3
to
5485ba8
Compare
Add the
list
CLI command, which is able to:To that end:
Config
to have its values overloaded. CLI values overwritepyproject.toml
values.__main__.py
(which sets up logging).-n/--namespace
option to CLI commands, to overwrite the rule namespaces.RuleRegistry
, to instantiate rules automatically, and only look for the namespace list in the provided config.