Refactor TextWidth commit-msg hook

Based on ABC metric reported by RuboCop.

Change-Id: Ic67b785b8c0589ac167490c2142cbd796e57596c
Reviewed-on: http://gerrit.causes.com/44896
Tested-by: jenkins <jenkins@brigade.com>
Reviewed-by: Shane da Silva <shane.dasilva@brigade.com>