App-GitHooks-Plugin-BlockNOCOMMIT
view release on metacpan or search on metacpan
lib/App/GitHooks/Plugin/BlockNOCOMMIT.pm view on Meta::CPAN
package App::GitHooks::Plugin::BlockNOCOMMIT;
use strict;
use warnings;
use base 'App::GitHooks::Plugin';
# External dependencies.
use Carp;
use Data::Validate::Type;
use File::Slurp ();
# Internal dependencies.
use App::GitHooks::Constants qw( :PLUGIN_RETURN_CODES );
=head1 NAME
App::GitHooks::Plugin::BlockNOCOMMIT - Prevent committing code with #NOCOMMIT mentions.
=head1 DESCRIPTION
Sometimes you want to experiment with code, but you want to make sure that test
code doesn't get committed by accident.
This plugin allows you to use C<#NOCOMMIT> to indicate such code blocks, and
will prevent you from committing those blocks.
For example:
# This is a test that will not work once deployed.
# NOCOMMIT
...
Note that the following variations on the tag are correctly picked up:
=over 4
=item * C<#NOCOMMIT>
=item * C<# NOCOMMIT>
=item * C<# NO COMMIT>
=back
=head1 VERSION
Version 1.1.1
=cut
our $VERSION = '1.1.1';
=head1 METHODS
=head2 get_file_pattern()
Return a pattern to filter the files this plugin should analyze.
my $file_pattern = App::GitHooks::Plugin::BlockNOCOMMIT->get_file_pattern(
app => $app,
);
=cut
sub get_file_pattern
{
# Check all files.
return qr//;
}
=head2 get_file_check_description()
Return a description of the check performed on files by the plugin and that
will be displayed to the user, if applicable, along with an indication of the
success or failure of the plugin.
my $description = App::GitHooks::Plugin::BlockNOCOMMIT->get_file_check_description();
=cut
( run in 0.407 second using v1.01-cache-2.11-cpan-39bf76dae61 )