box icon indicating copy to clipboard operation
box copied to clipboard

Is `blacklist` setting supposed to act as a pattern ?

Open llaville opened this issue 1 year ago • 5 comments

Hello,

Working on my project https://github.com/llaville/php-compatinfo-db that use Doctrine, I've recently found a possible bug.

I wanted to have control on files/dirs included, so I've removed the force-autodiscovery setting (https://github.com/llaville/php-compatinfo-db/blob/6.12/box.json#L3), and replace it by :

{

    "blacklist": [
        "tests",
        "Test",
        "dist",
        "doc",
        "vendor-bin"
    ],
    "directories": [
        "bin",
        "src",
        "config",
        "data",
        "vendor"
    ],
    "directories-bin": [
        "resources"
    ],
    "files": [
        "autoload.php"
    ]

}

But with blacklist/doc it also excluded to add my vendor/doctrine folder with contains Doctrine DBAL and ORM dependencies.

So the question is : Is blacklist setting supposed to act as a pattern ? or is it a bug ?

If it's not a bug, the BOX documentation should explains it

llaville avatar Nov 07 '24 05:11 llaville

According to this test it is: https://github.com/box-project/box/blob/main/tests/Configuration/ConfigurationFileTest.php#L39

I'm not sure having a cursory look at the code though.

So it should be clarified in the docs.

theofidry avatar Nov 07 '24 08:11 theofidry

@theofidry I don't think the test match my context. I've added doc in blacklist setting (my goal is to avoid documentation folder to be included), but it excludes also part of directory that have the same entry.

doc exclude the vendor/doctrine folder

llaville avatar Nov 07 '24 16:11 llaville

Ah ok I did not get that. Yes indeed it's 100% a bug then, possibly one that's always been there 😅

theofidry avatar Nov 07 '24 17:11 theofidry

As a fallback: maybe using finders would be simpler in your case?

theofidry avatar Nov 07 '24 17:11 theofidry

Alternative (I've adopted) I've removed doc entry from blacklist, and I won't lost doctrine dependencies when I compile the PHAR with Box 4.6.2

llaville avatar Nov 08 '24 05:11 llaville