Skip to content

[feature] path in files: section should be relative to config file #2101

@olson-dan

Description

@olson-dan

⭐ Suggestion

Allow $CONFIG_DIR or similar expansion in the files: section.

💻 Use Cases

I am in a monorepo with a top-level sgconfig.yml. I would like to have rules that only apply to specific subdirectories. I have not been able to find a way to do this that works both when ast-grep scan is invoked from the top-level folder containing the sgconfig.yml and when it's invoked from a subfolder.

As far as I can tell from experimentation, the files section appears to be treated as relative to the cwd from which ast-grep was invoked rather than the dir containing the sgconfig.yml file, whereas I need the opposite behavior. A possible solution is to provide a $CONFIG_DIR variable that is expanded to the absolute path of the directory containing the sgconfig.yml, but this is just one idea and there may be several other potential solutions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions