The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Git::Lint::Check::Message - parent module for message check modules

SYNOPSIS

 use parent 'Git::Lint::Check::Message';

 # inside of the child module, check method
 sub check {
     my $self  = shift;
     my $input = shift;

     my $match = sub {
         my $lines_arref = shift;
         my $summary     = shift @{$lines_arref};
         return 1 if length $summary > SUMMARY_LENGTH;
         return;
     };

     my @issues = $self->parse(
         input => $input,
         match => $match,
         check => $check_message,
     );

     return @issues;
 }

DESCRIPTION

Git::Lint::Check::Message provides methods for Git::Lint message check modules.

This module is not meant to be initialized directly.

ADDING CHECK MODULES

To add check functionality to Git::Lint, additional check modules can be created as child modules to Git::Lint::Check::Message.

For an example to start creating message check modules, see Git::Lint::Check::Message::SummaryLength or any message check module released within this distribution.

CHECK MODULE REQUIREMENTS

Child modules must implement the check method which gathers, formats, and returns a list of issues.

The methods within this module can be used to parse and report the issues in the expected format, but are not required to be used.

The issues returned from message check modules must be a list of hash refs each with a message key and value.

 my @issues = (
     { message => 'summary length (50 characters of less)' }
 );
 

CONSTRUCTOR

new

This method is inherited from Git::Lint::Check.

METHODS

message

Reads the input commit message from file and returns the contents.

ARGUMENTS

file

RETURNS

An array ref of the commit message input.

format_issue

Formats the match information into the expected issue format.

ARGUMENTS

check

The check name or message to format.

RETURNS

A hash ref with the message key and value.

parse

Parses the commit message input for violations using the match subref check.

ARGUMENTS

input

Array ref of the message input to check.

match

Code ref (sub reference) containing the check logic.

check

The check name or message to use for reporting issues.

RETURNS

A list of hashrefs of formatted issues.