Skip to content

[5.28] CollectorIO and skipped actions #309

Description

@llaville

I'm late on release the first version of my plugin because I've found a bad behavior with Capt'N 5.28 when using IO\CollectorIO and action skipped.

As it is not blocking, I'll come back later to explain in details what I found !

In summary, Capt'N won't prints messages queued in CollectorIO at end of process, if you manage an action with a condition that tell to skip it into a beforeAction function of a plugin.

Context and behavior found because I wanted my plugin to avoid User to code the Condition step into their captainhook.json

For example :

Rather than writing such configuration (that is valid and acceptable by my plugin)

{
    "config": {
        "allow-failure": false,
        "bootstrap": "examples/vendor-bin-autoloader.php",
        "ansi-colors": true,
        "git-directory": ".git",
        "fail-on-first-error": false,
        "verbosity": "normal",
        "plugins": [
            {
                "plugin": "\\Bartlett\\CaptainHookBinPlugin\\BinPlugin"
            }
        ]
    },
    "pre-commit": {
        "enabled": true,
        "actions": [
            {
                "action": "{$ENV|value-of:VENDOR_BIN_DIR|default:vendor/bin/}phpcs --standard=.github/linters/.phpcs.xml.dist --warning-severity=0 --colors {$STAGED_FILES|of-type:php|separated-by: }",
                "config": {
                    "label": "Checks Coding Standard (with PHP_CodeSniffer)"
                },
                "conditions": [
                    {
                        "exec": "\\Bartlett\\CaptainHookBinPlugin\\Condition\\PackageInstalled",
                        "args": ["squizlabs/php_codesniffer", "^3.3 || ^4.0"]
                    }
                ]
            }
        ]
    }
}

I wanted to just write

{
    "config": {
        "allow-failure": false,
        "bootstrap": "examples/vendor-bin-autoloader.php",
        "ansi-colors": true,
        "git-directory": ".git",
        "fail-on-first-error": false,
        "verbosity": "normal",
        "plugins": [
            {
                "plugin": "\\Bartlett\\CaptainHookBinPlugin\\BinPlugin"
            }
        ]
    },
    "pre-commit": {
        "enabled": true,
        "actions": [
            {
                "action": "{$ENV|value-of:VENDOR_BIN_DIR|default:vendor/bin/}phpcs --standard=.github/linters/.phpcs.xml.dist --warning-severity=0 --colors {$STAGED_FILES|of-type:php|separated-by: }",
                "config": {
                    "label": "Checks Coding Standard (with PHP_CodeSniffer)"
                },
                "options": {
                    "package-require": [
                        "squizlabs/php_codesniffer",
                        "^3.3 || ^4.0"
                    ]
                },
            }
        ]
    }
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions