feat!: Adopt subcommand CLI with suppressions and explain mode#16
Merged
Conversation
"Baseline" implied an accepted state; "suppressions" describes what the file actually is: a list of violations being suppressed. Internal renames: - baseline.py -> suppressions.py - generate_baseline / merge_baseline / load_baseline / _resolve_baseline / _emit_baseline -> *_suppressions - BASELINE_FILENAME -> SUPPRESSIONS_FILENAME - run() parameter baseline_path -> suppressions_path User-facing renames: - --baseline PATH -> --suppressions PATH - --generate-baseline -> --write-suppressions - Default filename dbt-lint-baseline.yml -> .dbt-lint-suppressions.yml Behavior preserved. --write-suppressions still writes via --output and returns exit 0; auto-discovery still walks the discovered config directory. BREAKING CHANGE: --baseline and --generate-baseline removed; default suppressions filename changed.
Replace the single top-level command with a click.group exposing two explicit subcommands: `check` for linting and `rule` for listing rules. Bare `dbt-lint`, no-arg `check`, and no-arg `rule` print help. `rule` requires either a rule ID or `--all`. Add walk-up config discovery from cwd. Resolution order is explicit `--config`, then `pyproject.toml [tool.dbt_lint]`, then `dbt-lint.yml`, then defaults; first match wins. The TOML section uses underscores to match the package name; the YAML file uses hyphens to match the CLI binary. Add `--isolated` to bypass config discovery and suppressions auto-load in favor of defaults. Add `--exit-zero` to `check` for forcing exit code 0 regardless of violations. Rename `--format` to `--output-format` across subcommands. Remove `--list-rules`, `--generate-baseline`, top- level `--output`, and `--baseline PATH`. `check --write-suppressions` now writes the YAML to stdout (redirect with `>`) and skips suppressions auto-load during the producing run so the regenerated file captures the full current violation set. Rename the config-file convention from `dbt_lint.yml` to `dbt-lint.yml` for hyphen consistency with the CLI binary. BREAKING CHANGE: CLI surface reshaped. Migration: - `dbt-lint manifest.json` -> `dbt-lint check manifest.json` - `dbt-lint --list-rules` -> `dbt-lint rule --all` - `--generate-baseline ... --output PATH` -> `check --write-suppressions > PATH` - `--baseline PATH` -> `--suppressions PATH` - `--format` -> `--output-format` - `dbt_lint.yml` -> `dbt-lint.yml` (or migrate to `[tool.dbt_lint]` in `pyproject.toml`)
Render description, rationale, remediation, exceptions, and examples for a single rule. Empty sections are omitted; --output-format json dumps the RuleInfo dataclass. Wire --config and --isolated into the rule subcommand so custom rules declared in config appear in `rule --all` and `rule <id>`. Promote _assemble_rules to public collect_rules and add UnknownRuleError so the rule subcommand has one LintError surface to catch. Restrict `rule --output-format` to text|json; concise and grouped are violation layouts with no meaning for rule metadata.
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.
check,rule, andsuppresssubcommands. Add--config,--isolated, andpyproject.toml-style config sources.rule <id>renders description, rationale, remediation, exceptions, and examples;--output-format jsondumps the rule metadata.Breaking changes: top-level options moved under
check;baseline.ymland related keys renamed tosuppressions.