Skip to content

[5.28] configure CaptainHook with existing config file #305

@llaville

Description

@llaville

When we use a captainhook.json config file with a structure that includes other files, like this one :

{
    "config": {
        "verbosity": "normal",
        "allow-failure": false,
        "ansi-colors": true,
        "git-directory": ".git",
        "fail-on-first-error": false,
        "bootstrap": "examples/vendor-bin-autoloader.php",
        "plugins": [],
        "includes": [
            "examples/pre-push.mago.json"
        ]
    }
}

I've noticed that, even if we reply NO to all questions to the following command :

vendor/bin/captainhook configure --extend
  Do you want to validate your commit messages? [y,n] n
  Do you want to check your files for syntax errors? [y,n] n
  Do you want to run phpunit before committing? [y,n] n
  Do you want to run phpcs before committing? [y,n] n
Configuration created successfully
Run 'vendor/bin/captainhook install' to activate your hook configuration

Empty entries was un-necessary added to the main config file.

{
    "config": {
        "verbosity": "normal",
        "allow-failure": false,
        "ansi-colors": true,
        "git-directory": ".git",
        "fail-on-first-error": false,
        "bootstrap": "examples/vendor-bin-autoloader.php",
        "plugins": [],
        "includes": [
            "examples/pre-push.mago.json"
        ]
    },
   "commit-msg": {
        "enabled": true,
        "actions": []
    },
    "pre-push": {
        "enabled": true,
        "actions": []
    },
    "pre-commit": {
        "enabled": true,
        "actions": []
    }
}

That may suggest if you only read it's contents that no actions are available for these hooks !

This is without including other files: Thanks to config:info that help to understand that actions (included) are well recognized.

I suggest to avoid adding empty entries when no actions are suggested by final user answers

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions