composer-attribute-collector icon indicating copy to clipboard operation
composer-attribute-collector copied to clipboard

Feature request: include/exclude paths to handle glob

Open BafS opened this issue 1 month ago • 2 comments

For big monoliths, it would be handy to be able to use the glob pattern when including/excluding.

For instance, instead of

{
  "extra": {
    "composer-attribute-collector": {
      "exclude": [
        "apps/admin/tests/",
        "apps/main/tests/",
        "components/colors/tests/",
        "components/http/tests/",
        "components/math/tests/"
      ]
    }
  }
}

we would have

{
  "extra": {
    "composer-attribute-collector": {
      "exclude": [
        "apps/**/tests/",
        "components/**/tests/"
      ]
    }
  }
}

BafS avatar Oct 17 '25 08:10 BafS

Hi @BafS, thanks for the suggestion. Currently, the pattern is passed to preg_quote() to build a RegExp. We have a couple of options:

  1. I convert ** into its RegExp equivalent.
  2. Use a "Glob to RegExp" converter
  3. I allow RegExp in the pattern.
  4. ??

olvlvl avatar Oct 22 '25 13:10 olvlvl

Allowing the regex would cover this, otherwise we could simply use the glob function (https://www.php.net/manual/en/function.glob.php).

BafS avatar Oct 22 '25 19:10 BafS