Skip to content

Ability to run _only_ selected rules #118

@ross-whatnot

Description

@ross-whatnot

As we've been stretching our use cases for dbt-score, I've found a few circumstances where I want to be able to run rules in a more targeted way for certain situations. For a concrete example, we have a couple of checks for "are you ref'ing deprecated models", where we want the behavior to be roughly:

  • a non-required CI check fails if you have modified files that ref deprecated models
  • a required CI check fails if you have added files that ref deprecated models

Currently, I've got a rule for each of these in a dedicated namespace, and execute dbt-score to evaluate that namespace and exclude the other rule (so, the 'modified files' check is run to disable the 'added files' check, and vice versa). But it'd be easier and more flexible in a lot of ways to be able to run dbt-score and have it run just the specific rule(s) I specify at runtime.

My first thought here would be that a behavior could be, roughly:

  • add a --selected-rule flag that takes a list of rules to run, similar to --disabled-rule
  • if that's present, rules in the --selected-rule are run, ignoring any normal configuration that would disable them
  • --selected-rule and --disabled-rule are mutually exclusive, you can't supply both in a given CLI call

That would allow one to have "special" rules that aren't run during a basic CLI call, but call those rules explicitly and flexibly when needed.

I'm happy to take a crack at this, if we can get alignment on the behavior!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions