org_heigl/captainhook_addtime

Add the time since your last commit to the commit-message

2.0.0 2019-02-14 20:07 UTC

This package is auto-updated.

Last update: 2024-03-24 18:48:26 UTC


README

A small addition to CaptainHook that will add the time since your last commit to your commitmessage

That way you can use a different tool to extract the times you spent on a project from the commitmessages

To be sure that the time is added to each commit there is also a check that can be used to verify that a time is added.

GitLab-CI Bild-Status Scrutinizer Code Quality

Installation

Install this package using composer

composer require --dev heiglandreas/captainhook_addtime

Usage

Adding time

In your captainhook.json file you can then add this hook to your prepare-commit-msg-hooks:

{
  "prepare-commit-msg" : {
    "enabled" : true,
    "actions" : [{
      "action" : "\\Org_Heigl\\CaptainHook\\Hooks\\AddTime\\AddTimeAction",
      "options" : {
        "fuzziness": "\\Org_Heigl\\CaptainHook\\Hooks\\AddTime\\Fuzzier\\TenMinutesCeiling"
      }
    }]
  }
}

This will round up to the next 10 minutes.

Verifying time is added

To make sure that each commit contains a time you can add this to your captainhook.json-file:

{
  "commit-msg": {
    "enabled": true,
    "actions": [{
      "action": "\\Org_Heigl\\CaptainHook\\Hooks\\AddTime\\EnsureTime",
      "options": {}
    }]
  }
}

This will require each commit-message to contain something like the following on one line:

Time: 12h15m

There can be whitespace before or after the content but the 'h' and 'm' needs to be lower case and there must not be any whitespace in that time-information.

You can ommit the hours or the minutes. (Ommiting both doesn't really make sense (-; )