The Captain's favorite hooks

Here ye can find a treasure full with the Captain's favorite hooks ready for ye to get copy and pasted into yer own captainhook.json files.

Commit message validation

  "commit-msg": {
    "enabled": true,
    "actions": [
      {
        "action": "\\CaptainHook\\App\\Hook\\Message\\Action\\Beams",
        "options": {
          "subjectLength": 50,
          "bodyLineLength": 72
        },
        "conditions": []
      }
  }

Soft quality checks on commit

  "pre-commit": {
    "enabled": true,
    "actions": [
      {
        "action": "\\CaptainHook\\App\\Hook\\PHP\\Action\\Linting",
        "options": [],
        "conditions": []
      },
      {
        "action": "tools/phpcs --colors --standard=psr12 {$STAGED_FILES|of-type:php|separated-by: }",
        "options": [],
        "conditions": [
          {
            "exec": "\\CaptainHook\\App\\Hook\\Condition\\FileStaged\\OfType",
            "args": ["php"]
          }
        ]
      }
  }

Hard quality checks on push

  "pre-push": {
    "enabled": true,
    "actions": [
      {
        "action": "tools/phpunit --no-coverage",
        "options": [],
        "conditions": []
      },
      {
        "action": "tools/phpstan analyse",
        "options": [],
        "conditions": []
      }
  }

Convenience hooks

  "post-change": {
    "enabled": true,
    "actions": [
      {
        "action": "tools/phive install --copy --force-accept-unsigned",
        "options": [],
        "conditions": [
          {
            "exec": "\\CaptainHook\\App\\Hook\\Condition\\FileChanged\\Any",
            "args": [
              [
                "phive.xml"
              ]
            ]
          }
        ]
      },
      {
        "action": "tools/composer install",
        "options": [],
        "conditions": [
          {
            "exec": "\\CaptainHook\\App\\Hook\\Condition\\FileChanged\\Any",
            "args": [
              [
                "composer.json",
                "composer.lock"
              ]
            ]
          }
        ]
      }
  }