Perl::Lint::Git - Connect git and Perl::Lint to blame the right people for violations.
Version 1.1.0
use Perl::Lint::Git; my $git_linter = Perl::Lint::Git->new( file => $file, ); my $violations = $git_linter->report_violations( author => $author, # or undef for all since => $date, # to lint only recent changes );
Create a new Perl::Lint::Git object.
my $git_linter = Perl::Lint::Git->new( file => $file, );
Parameters:
'file' (mandatory)
The path to a file in a Git repository.
Return an arrayref of all the authors found in git blame for the file analyzed.
my $authors = $git_linter->get_authors();
Report the violations for a given Git author.
my $violations = $git_linter->report_violations( author => $author, # or undef for all since => $date, # to lint 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 that are older will author to fix an entire legacy file at once if only one line needs to be be ignored. This allows linting only recent changes, instead of forcing your modified.
use_cache (default: 0)
Use a cached version of git diff when available. See Git::Repository::Plugin::Blame::Cache for more information.
git diff
Force reanalyzing the file specified by the current object. This is useful if the file has been modified since the Perl::Lint::Git object has been created.
$git_critic->force_reanalyzing();
Return an arrayref of all the Perl::Lint::Violation objects found by running Perl::Lint 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 Perl::Lint on the file specified by the current object and caches the results to speed reports later.
git blame
$git_critic->_analyze_file();
Arguments:
Use a cached version of git diff when available.
Return whether the file specified by the current object has already been analyzed with "git blame" and "PerlLint".
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();
Perl::Lint
Please report any bugs or feature requests through the web interface at https://github.com/guillaumeaubert/Perl-Lint-Git/issues. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
You can find documentation for this module with the perldoc command.
perldoc Perl::Lint::Git
You can also look for information at:
GitHub (report bugs there)
https://github.com/guillaumeaubert/Perl-Lint-Git/issues
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/Perl-Lint-Git
CPAN Ratings
http://cpanratings.perl.org/d/Perl-Lint-Git
MetaCPAN
https://metacpan.org/release/Perl-Lint-Git
Guillaume Aubert, <aubertg at cpan.org>.
<aubertg at cpan.org>
Copyright 2015-2017 Guillaume Aubert.
This code is free software; you can redistribute it and/or modify it under the same terms as Perl 5 itself.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the LICENSE file for more details.
To install Perl::Lint::Git, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Perl::Lint::Git
CPAN shell
perl -MCPAN -e shell install Perl::Lint::Git
For more information on module installation, please visit the detailed CPAN module installation guide.