Skip to content

dbt-autofix-fix pre-commit hook silently passes when dbt project is in a subdirectory #371

Description

@shiv-io

The dbt-autofix-fix (and dbt-autofix-check) pre-commit hooks always pass without fixing anything when the dbt project lives in a subdirectory of the repo (e.g. ./dbt/). No error or warning is emitted — the hook reports Passed even though deprecations exist.

Environment

  • dbt-autofix version: v0.20.3
  • Repo layout: monorepo where the dbt project is at ./dbt/ (not the repo root)
  • pre-commit version: 4.5.1
  • Environment variable DBT_PROJECT_DIR set to <repo-root>/dbt

Steps to reproduce

  1. Have a repo where dbt_project.yml lives at ./dbt/dbt_project.yml (not ./dbt_project.yml)
  2. Add the hook to .pre-commit-config.yaml:
   - repo: https://github.com/dbt-labs/dbt-autofix
     rev: v0.20.3
     hooks:
       - id: dbt-autofix-fix
         args: [--path=dbt]
  1. Run pre-commit install to install the hook
  2. Introduce a YAML file with a known deprecation (e.g. dbt_utils.accepted_range test arguments not nested under arguments:)
  3. Run uvx dbt-autofix deprecations --dry-run to return the list of deprecations and confirm the deprecation added above is listed
  4. Run pre-commit run dbt-autofix-fix --all-files

Expected: Hook detects and fixes the deprecation, exits 1, and asks you to re-stage.

Actual: Hook reports Passed with exit code 0. No files are modified.

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