| 1 | package App::GitHooks::Plugin; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 38 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 38 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | # External dependencies. | ||||||||||||||||||||||||||||
| 7 | 38 | ▶ | use Carp; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | =head1 NAME | ||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | App::GitHooks::Plugin - Base class for plugins. | ||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | =head1 VERSION | ||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | Version 1.7.3 | ||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | =cut | ||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | 38 | our $VERSION = '1.7.3'; | |||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | 38 | our $SUPPORTED_SUBS = | |||||||||||||||||||||||||||
| 24 | [ | ||||||||||||||||||||||||||||
| 25 | qw( | ||||||||||||||||||||||||||||
| 26 | applypatch_msg | ||||||||||||||||||||||||||||
| 27 | commit_msg | ||||||||||||||||||||||||||||
| 28 | post_applypatch | ||||||||||||||||||||||||||||
| 29 | post_checkout | ||||||||||||||||||||||||||||
| 30 | post_commit | ||||||||||||||||||||||||||||
| 31 | post_merge | ||||||||||||||||||||||||||||
| 32 | post_receive | ||||||||||||||||||||||||||||
| 33 | post_rewrite | ||||||||||||||||||||||||||||
| 34 | post_update | ||||||||||||||||||||||||||||
| 35 | pre_applypatch | ||||||||||||||||||||||||||||
| 36 | pre_auto_gc | ||||||||||||||||||||||||||||
| 37 | pre_commit | ||||||||||||||||||||||||||||
| 38 | pre_commit_file | ||||||||||||||||||||||||||||
| 39 | pre_push | ||||||||||||||||||||||||||||
| 40 | pre_rebase | ||||||||||||||||||||||||||||
| 41 | pre_receive | ||||||||||||||||||||||||||||
| 42 | prepare_commit_msg | ||||||||||||||||||||||||||||
| 43 | update | ||||||||||||||||||||||||||||
| 44 | ) | ||||||||||||||||||||||||||||
| 45 | ]; | ||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | =head1 METHODS | ||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | =head2 get_file_check_description() | ||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | Return a description of the check performed on files by the plugin and that | ||||||||||||||||||||||||||||
| 53 | will be displayed to the user, if applicable, along with an indication of the | ||||||||||||||||||||||||||||
| 54 | success or failure of the plugin. | ||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | my $description = $plugin_class->get_file_check_description(); | ||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | =cut | ||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | sub get_file_check_description | ||||||||||||||||||||||||||||
| 61 | { | ||||||||||||||||||||||||||||
| 62 | 1 | ▶ | croak 'You must define a get_file_check_description() subroutine in the plugin'; | ||||||||||||||||||||||||||
|
Subroutine
get_file_check_description: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 63 | } | ||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | =head2 get_name() | ||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||
| 68 | Return the name of the plugin. For example, for C<App::GitHooks::Plugin::Test>, | ||||||||||||||||||||||||||||
| 69 | the name will be C<Test>. | ||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||
| 71 | my $name = $plugin->get_name(); | ||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||
| 73 | =cut | ||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||
| 75 | sub get_name | ||||||||||||||||||||||||||||
| 76 | { | ||||||||||||||||||||||||||||
| 77 | 5 | ▶ | my ( $class ) = @_; | ||||||||||||||||||||||||||
|
Subroutine
get_name: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||
| 78 | 5 | ▶ | croak 'You need to call this method on a class' | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
not defined $class or $class eq ""
MC/DC100%2/2
not defined $class or $class eq ""
not defined $class
$class eq ""
Truth table100%3/3
not(A) or B
A= not defined $classB= $class eq ""
| |||||||||||||||||||||||||||||
| 79 | if !defined( $class ) || ( $class eq '' );; | ||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||
| 81 | 3 | my $base_path = __PACKAGE__ . '::'; | |||||||||||||||||||||||||||
| 82 | 3 | ▶ | croak "Not a valid plugin class: >$class<" | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 83 | if $class !~ /^\Q$base_path\E/; | ||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||
| 85 | 2 | $class =~ s/^$base_path//; | |||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||
| 87 | 2 | return $class; | |||||||||||||||||||||||||||
| 88 | } | ||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||
| 91 | =head1 BUGS | ||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||
| 93 | Please report any bugs or feature requests through the web interface at | ||||||||||||||||||||||||||||
| 94 | L<https://github.com/guillaumeaubert/App-GitHooks/issues/new>. | ||||||||||||||||||||||||||||
| 95 | I will be notified, and then you'll automatically be notified of progress on | ||||||||||||||||||||||||||||
| 96 | your bug as I make changes. | ||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||
| 99 | =head1 SUPPORT | ||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||
| 101 | You can find documentation for this module with the perldoc command. | ||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||
| 103 | perldoc App::GitHooks::Plugin | ||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||
| 106 | You can also look for information at: | ||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||
| 108 | =over | ||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||
| 110 | =item * GitHub's request tracker | ||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||
| 112 | L<https://github.com/guillaumeaubert/App-GitHooks/issues> | ||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||
| 114 | =item * AnnoCPAN: Annotated CPAN documentation | ||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||
| 116 | L<http://annocpan.org/dist/app-githooks> | ||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||
| 118 | =item * CPAN Ratings | ||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||
| 120 | L<http://cpanratings.perl.org/d/app-githooks> | ||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||
| 122 | =item * MetaCPAN | ||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||
| 124 | L<https://metacpan.org/release/App-GitHooks> | ||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||
| 126 | =back | ||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||
| 129 | =head1 AUTHOR | ||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||
| 131 | L<Guillaume Aubert|https://metacpan.org/author/AUBERTG>, | ||||||||||||||||||||||||||||
| 132 | C<< <aubertg at cpan.org> >>. | ||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||
| 135 | =head1 COPYRIGHT & LICENSE | ||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||
| 137 | Copyright 2013-2015 Guillaume Aubert. | ||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||
| 139 | This program is free software: you can redistribute it and/or modify it under | ||||||||||||||||||||||||||||
| 140 | the terms of the GNU General Public License version 3 as published by the Free | ||||||||||||||||||||||||||||
| 141 | Software Foundation. | ||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||
| 143 | This program is distributed in the hope that it will be useful, but WITHOUT ANY | ||||||||||||||||||||||||||||
| 144 | WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A | ||||||||||||||||||||||||||||
| 145 | PARTICULAR PURPOSE. See the GNU General Public License for more details. | ||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||
| 147 | You should have received a copy of the GNU General Public License along with | ||||||||||||||||||||||||||||
| 148 | this program. If not, see http://www.gnu.org/licenses/ | ||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||
| 150 | =cut | ||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||
| 152 | 38 | 1; | |||||||||||||||||||||||||||