You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When using pre-commit and committing a change of a file in the root directory that is not related to a dbt model (i.e. change to the .pre-commit-config.yaml), the check_model_has_tests_by_name hook checks across all available models in the manifest.json, this happens even if an exclude argument has been specified.
Also, related to the --exclude argument, the example presented in HOOKS.md shows the following example: args: ["--test-cnt", "1", "--exclude models/demo", "--"]
However, this syntax generates an error, I believe this should be updated to: args: ["--test-cnt", "1", "--exclude", "models/demo", "--"]
Stage and commit the .pre-commit-config.yaml change
pre-commit fails with all models in the project that fail the criteria (i.e. all models that do not have a unique test)
Expected behavior
The expected behavior is that this test checks only for dbt models or corresponding properties yml files that are committed or that using the exclude argument we can specify which files should be excluded. For example using the regex expression "^(?!models/).*" would exclude committed changes that are not part of the models folder.
Version:
v2.0.1
Additional context
In this attached image you can see that check-model-has-test-by-name failed even when .pre-commit-config.yaml file was the only change. This is not specific to change to pre-commit-config file, changes to other files like project.yml also trigger this behavior.
The text was updated successfully, but these errors were encountered:
Describe the bug
When using pre-commit and committing a change of a file in the root directory that is not related to a dbt model (i.e. change to the .pre-commit-config.yaml), the check_model_has_tests_by_name hook checks across all available models in the manifest.json, this happens even if an exclude argument has been specified.
Also, related to the --exclude argument, the example presented in HOOKS.md shows the following example:
args: ["--test-cnt", "1", "--exclude models/demo", "--"]
However, this syntax generates an error, I believe this should be updated to:
args: ["--test-cnt", "1", "--exclude", "models/demo", "--"]
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The expected behavior is that this test checks only for dbt models or corresponding properties yml files that are committed or that using the exclude argument we can specify which files should be excluded. For example using the regex expression "^(?!models/).*" would exclude committed changes that are not part of the models folder.
Version:
v2.0.1
Additional context
In this attached image you can see that check-model-has-test-by-name failed even when .pre-commit-config.yaml file was the only change. This is not specific to change to pre-commit-config file, changes to other files like project.yml also trigger this behavior.
The text was updated successfully, but these errors were encountered: