blib/lib/Git/MoreHooks/CheckCommitBase.pm

filter: Statementstmt 60.7% 34 / 56 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 53.3% 8 / 15 Podpod 100% 6 / 6 totaltotal 62.3% 48 / 77 CC 1 SCAR 3.8
CC
1
Cov
61%
_call_user_hook
2.0
pre_commit_callback
2.0
update_callback
2.0
CRAP 1.5
« blib/lib/Git/MoreHooks.pm ↑ Summary
1 package Git::MoreHooks::CheckCommitBase;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 # ABSTRACT: CheckCommit base file
8  
9 1 our $VERSION = '0.021';
10  
11  
12 1 ▶use Git::Hooks 2.014000; # v2.14.0: oldest release on CPAN
Subroutine BEGIN: called CC=1 SCAR=0.0
13 1 ▶use Path::Tiny;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 1 ▶use Log::Any qw{$log};
Subroutine BEGIN: called CC=1 SCAR=0.0
15 1 ▶use Params::Validate qw(:all);
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17  
18 1 our $USER_HOOK;
19  
20 1 ▶sub import {
Subroutine import: called CC=1 SCAR=0.0
21 1 my ( $package, $user_hook ) = @_;
22 1 $package .= q{};
23 1 $USER_HOOK = $user_hook;
24 1 return;
25 }
26  
27 0 ▶sub _call_user_hook {
Subroutine _call_user_hook: not called CC=1 SCAR=6.9
28 0 return &{$USER_HOOK}(@_);
29 }
30  
31 0 ▶sub pre_commit_callback {
Subroutine pre_commit_callback: not called CC=1 SCAR=6.9
Pod documented
32 0 my ($git) = @_;
33 0 my %opts = ( 'old_commit' => ':0', 'new_commit' => undef, 'gerrit-opts' => undef );
34 0 return _call_user_hook( $git, 'pre-commit', \%opts );
35 }
36  
37 # This routine can act both as an update or a pre-receive hook.
38 0 ▶sub update_callback {
Subroutine update_callback: not called CC=1 SCAR=6.9
Pod documented
39 0 $log->tracef( 'Entering update_callback(%s)', ( join q{:}, @_ ) );
40 0 my ($git) = @_;
41 0 my %opts = ( 'old_commit' => ':0', 'new_commit' => 0, 'gerrit-opts' => undef );
42 0 return _call_user_hook( $git, 'update', \%opts );
43 }
44  
45 0 ▶sub pre_receive_callback {
Subroutine pre_receive_callback: not called CC=1 SCAR=6.9
Pod documented
46 0 $log->tracef( 'Entering pre_receive_callback(%s)', ( join q{:}, @_ ) );
47 0 my ($git) = @_;
48 0 my %opts = ( 'old_commit' => ':0', 'new_commit' => 0, 'gerrit-opts' => undef );
49 0 return _call_user_hook( $git, 'pre-receive', \%opts );
50 }
51  
52 0 ▶sub ref_update_callback {
Subroutine ref_update_callback: not called CC=1 SCAR=6.9
Pod documented
53 0 my ($git) = @_;
54 0 my %opts = ( 'old_commit' => ':0', 'new_commit' => 0, 'gerrit-opts' => undef );
55 0 return _call_user_hook( $git, 'ref-update', \%opts );
56 }
57  
58 0 ▶sub patchset_created_callback {
Subroutine patchset_created_callback: not called CC=1 SCAR=6.9
Pod documented
59 0 my ( $git, $opts ) = @_;
60 0 my %opts = ( 'old_commit' => ':0', 'new_commit' => 0, 'gerrit-opts' => $opts );
61 0 return _call_user_hook( $git, 'patchset-created', \%opts );
62 }
63  
64 0 ▶sub draft_published_callback {
Subroutine draft_published_callback: not called CC=1 SCAR=6.9
Pod documented
65 0 my ( $git, $opts ) = @_;
66 0 my %opts = ( 'old_commit' => ':0', 'new_commit' => 0, 'gerrit-opts' => $opts );
67 0 return _call_user_hook( $git, 'draft-published', \%opts );
68 }
69  
70 # Install hooks
71 1 PRE_COMMIT \&pre_commit_callback;
72 1 UPDATE \&update_callback;
73 1 PRE_RECEIVE \&pre_receive_callback;
74 1 REF_UPDATE \&ref_update_callback;
75 1 PATCHSET_CREATED \&patchset_created_callback;
76 1 DRAFT_PUBLISHED \&draft_published_callback;
77  
78 1 1;
79  
80 __END__
« blib/lib/Git/MoreHooks.pm ↑ Summary