Perl::Critic::Git - Bond git and Perl::Critic to blame the right people for violations.
Version 1.1.1
use Perl::Critic::Git; my $git_critic = Perl::Critic::Git->new( file => $file, level => $critique_level, # or undef to use default profile ); my $violations = $git_critic->report_violations( author => $author, # or undef for all since => $date, # to critique only recent changes );
Create a new Perl::Critic::Git object.
my $git_critic = Perl::Critic::Git->new( file => $file, level => $critique_level, # or undef to use default profile );
Parameters:
'file'
Mandatory, the path to a file in a Git repository.
'level'
Optional, to set a PerlCritic level. If it is not specified, the default PerlCritic profile for the system will be used.
#TODO: List allowed values from PerlCritic.
Return an arrayref of all the authors found in git blame for the file analyzed.
my $authors = $git_critic->get_authors();
Report the violations for a given Git author.
my $violations = $git_critic->report_violations( author => $author, # or undef for all since => $date, # to critique only recent changes );
'author'
Mandatory, the name of the author to search violations for.
'since'
Optional, a date (format YYYY-MM-DD) for which violations of the PBPs that are older will be ignored. This allows critiquing only recent changes, instead of forcing your author to fix an entire legacy file at once if only one line needs to be modified.
Force reanalyzing the file specified by the current object. This is useful if the file has been modified since the Perl::Critic::Git object has been created.
$git_critic->force_reanalyzing();
Return an arrayref of all the Perl::Critic::Violation objects found by running Perl::Critic on the file specified by the current object.
my $perlcritic_violations = $git_critic->get_perlcritic_violations();
Return an arrayref of Git::Repository::Plugin::Blame::Line objects corresponding to the lines in the file analyzed.
my $blame_lines = $self->get_blame_lines();
Return a Git::Repository::Plugin::Blame::Line object corresponding to the line number passed as parameter.
my $blame_line = $git_critic->get_blame_line( 5 );
Run "git blame" and "PerlCritic" on the file specified by the current object and caches the results to speed reports later.
$git_critic->_analyze_file();
Return whether the file specified by the current object has already been analyzed with "git blame" and "PerlCritic".
my $is_analyzed = $git_critic->_is_analyzed();
Return the path to the file to analyze for the current object.
my $file = $git_critic->_get_file();
Return the critique level selected when creating the current object.
my $critique_level = $git_critic->_get_critique_level();
Guillaume Aubert, <aubertg at cpan.org>.
<aubertg at cpan.org>
Please report any bugs or feature requests to bug-perl-critic-git at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Perl-Critic-Git. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-perl-critic-git at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc Perl::Critic::Git
You can also look for information at:
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Perl-Critic-Git
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/Perl-Critic-Git
CPAN Ratings
http://cpanratings.perl.org/d/Perl-Critic-Git
Search CPAN
http://search.cpan.org/dist/Perl-Critic-Git/
Thanks to ThinkGeek (http://www.thinkgeek.com/) and its corporate overlords at Geeknet (http://www.geek.net/), for footing the bill while I eat pizza and write code for them!
Copyright 2012 Guillaume Aubert.
This program is free software; you can redistribute it and/or modify it under the terms of the Artistic License.
See http://dev.perl.org/licenses/ for more information.
To install Perl::Critic::Git, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Perl::Critic::Git
CPAN shell
perl -MCPAN -e shell install Perl::Critic::Git
For more information on module installation, please visit the detailed CPAN module installation guide.