feat: Add --severity filter and fix --exclude/--fail-fast#17
Merged
Conversation
Move rule-ID, resource-eligibility, and violation-exclusion filters into a new dbt_lint.filters module. Apply rule-ID filtering before evaluation so --fail-fast no longer masks violations when --select/--exclude is set. Previously, run() filtered violations by rule ID after the engine had already short-circuited on --fail-fast. Excluding the rule that fires first stripped its violation post-hoc and returned an empty result, even though other rules would have fired. filter_rules_by_id now narrows the rule list before dispatch, so the excluded rule never consumes the fail-fast slot. Filter behavior is unit-tested in test_filters.py; engine and run() tests no longer duplicate those assertions. A shared make_rule fixture consolidates three near-identical local factories.
Filter reported violations by minimum severity. `--severity warn` shows warn and error violations; `--severity error` shows only error violations. Default (unset) preserves prior behavior of reporting all severities. `--severity` and `--fail-on` are orthogonal: --severity controls what is reported, --fail-on controls the exit code.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
--severity warn|errortocheck. Filters reported violations by threshold (warn-and-above, or errors-only). Orthogonal to--fail-on:--severitygates what is reported;--fail-ongates the exit code.--exclude X --fail-fast(and--select Y --fail-fast) producing empty results when other rules would have fired. Rule-ID filtering now runs before evaluation rather than after, so--fail-faststops at the first violation among the remaining rules instead of one that gets stripped post-hoc.filters.pymodule hosting the resource-exclusion, rule-ID, and severity filters. Engine and_lint.run()import from it. No user-facing behavior change beyond the bug fix.