Git::Lint::Check::Commit - parent module for commit check modules
use parent 'Git::Lint::Check::Commit'; # inside of the child module, check method sub check { my $self = shift; my $input = shift; my $match = sub { my $line = shift; return 1 if $line =~ /\s$/; return; }; my @issues = $self->parse( input => $input, match => $match, check => $check_name ); return @issues; }
Git::Lint::Check::Commit provides methods for Git::Lint commit check modules.
Git::Lint::Check::Commit
This module is not meant to be initialized directly.
To add check functionality to Git::Lint, additional check modules can be created as child modules to Git::Lint::Check::Commit.
For an example to start creating commit check modules, see Git::Lint::Check::Commit::Whitespace or any message check module released within this distribution.
Child modules must implement the check method which gathers, formats, and returns a list of issues.
check
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 commit check modules must be a list of hash refs each with filename and message keys and values.
my @issues = ( { 'filename' => 'catalog.txt', 'message' => 'trailing whitespace (line 1)', }, { 'filename' => 'catalog.txt', 'message' => 'trailing whitespace (line 2)', }, );
This method is inherited from Git::Lint::Check.
Gathers, parses, and returns the commit diff.
None.
An array ref of the diff of the commit.
Formats the match information into the expected issue format.
The name of the file from the commit diff.
The check name or message to format.
The line number being checked.
A hash ref with filename and message key and value.
Parses the filename out of a single line of git diff output.
The git diff line to be checked for filename is passed as unnamed input.
The filename, if found.
Parses the diff input for violations using the match subref check.
Array ref of the commit diff input to check.
Code ref (sub reference) containing the check logic.
The check name or message to use for reporting issues.
A list of hashrefs of formatted issues.
To install Git::Lint, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Git::Lint
CPAN shell
perl -MCPAN -e shell install Git::Lint
For more information on module installation, please visit the detailed CPAN module installation guide.