Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
syou6162 committed Jan 23, 2025
2 parents ed72054 + 93ed691 commit 81c285e
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 68 deletions.
3 changes: 3 additions & 0 deletions .changes/unreleased/Added-20250118-014336.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
kind: Added
body: Match on corresponding node when passing yaml file path(s) in positional selectors ie like with pre-commit
time: 2025-01-18T01:43:36.154626-07:00
3 changes: 0 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,3 @@ scan-new-baseline: .uv-installed-$(PY_VERSION)

scan-without-baseline: .uv-installed-$(PY_VERSION)
@uvx bandit -r src

requirements.txt: .uv-installed-$(PY_VERSION)
@uv export -o requirements.txt --no-hashes --frozen
63 changes: 0 additions & 63 deletions requirements.txt

This file was deleted.

7 changes: 5 additions & 2 deletions src/dbt_osmosis/core/osmosis.py
Original file line number Diff line number Diff line change
Expand Up @@ -665,17 +665,20 @@ def _is_fqn_match(node: ResultNode, fqns: list[str]) -> bool:
def _is_file_match(node: ResultNode, paths: list[Path | str], root: Path | str) -> bool:
"""Check if a node's file path matches any of the provided file paths or names."""
node_path = Path(root, node.original_file_path).resolve()
yaml_path = None
if node.patch_path:
yaml_path = Path(root, node.patch_path.partition("://")[-1]).resolve()
for model_or_dir in paths:
model_or_dir = Path(model_or_dir).resolve()
if node.name == model_or_dir.stem:
logger.debug(":white_check_mark: Name match => %s", model_or_dir)
return True
if model_or_dir.is_dir():
if model_or_dir in node_path.parents:
if model_or_dir in node_path.parents or yaml_path and model_or_dir in yaml_path.parents:
logger.debug(":white_check_mark: Directory path match => %s", model_or_dir)
return True
if model_or_dir.is_file():
if model_or_dir.samefile(node_path):
if model_or_dir.samefile(node_path) or yaml_path and model_or_dir.samefile(yaml_path):
logger.debug(":white_check_mark: File path match => %s", model_or_dir)
return True
return False
Expand Down

0 comments on commit 81c285e

Please sign in to comment.