NAME
Git::Validate - Validate Git Commit Messages
VERSION
version 0.001000
SYNOPSIS
use Git::Validate;
my $validator = Git::Validate->new;
my $errors = $validator->validate_commit('HEAD');
die "$errors\n" if $errors;
Or if you want to be all classy and modern:
for $e (@{$errors->errors}) {
warn $e->line . " longer than " . $e->max_length . " characters!\n"
if $e->isa('Git::Validate::Error::LongLine')
}
DESCRIPTION
While many users apparently don't know it, there are actual correct ways
to write a "git" commit message. For a good summary of why, read this
blog post .
This module does it's best to automatically check commit messages
against The Rules. The current automatic checks are:
* First line should be 50 or fewer characters
* Second line should be blank
* Third and following lines should be less than 72 characters
METHODS
"validate_commit"
my $errors = $validator->validate_commit('HEAD');
returns "ERRORS" for a given commit
"validate_message"
my $errors = $validator->validate_message($commit_message);
returns "ERRORS" for a given message
ERRORS
The object containing errors conveniently "stringifies" and "boolifies".
If you need more information, please please please don't try to parse
the returned strings. Instead, note that the errors returned are a set
of objects. These are the objects you can check for:
* "Git::Validate::Error::LongLine"
* "Git::Validate::Error::MissingBreak"
The objects can be accessed with the "errors" method, which returns an
arrayref. The objects have "line" and "line_number" methods. The
"::LongLine" objects have a "max_length" method as well.
AUTHOR
Arthur Axel "fREW" Schmidt <frioux+cpan@gmail.com>
COPYRIGHT AND LICENSE
This software is copyright (c) 2013 by Arthur Axel "fREW" Schmidt.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.