Skip to content

Bug: _find_yaml_files uses fragile string replacement for yml/yaml matching #356

@kami619

Description

@kami619

Summary

In src/agentready/assessors/dbt.py:108-110:

def _find_yaml_files(directory: Path, pattern: str = "*.yml") -> list[Path]:
    yml_files = list(directory.rglob(pattern))
    yaml_files = list(directory.rglob(pattern.replace("yml", "yaml")))
    return yml_files + yaml_files

pattern.replace("yml", "yaml") replaces ALL occurrences of "yml" in the pattern string. A pattern like *_yml_backup.yml would become *_yaml_backup.yaml, which is incorrect.

Current Impact

Low — currently only called with "*.yml", so it works correctly today.

Suggested Fix

Simplify to always search for both extensions explicitly:

def _find_yaml_files(directory: Path) -> list[Path]:
    return list(directory.rglob("*.yml")) + list(directory.rglob("*.yaml"))

Found in

PR #334 — Feature/add dbt support

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions