Kusarigama/Plugin/ProjectAlias.pm

filter: Statementstmt 90.9% 20 / 22 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 80.0% 4 / 5 Podpod 0.0% 0 / 2 totaltotal 80.6% 25 / 31 CC 2 SCAR 4.1
CC
2
Cov
88%
on_add
2.0
on_modify
2.0
BEGIN
1.0
CRAP 1.5
« Kusarigama/App/Add.pm ↑ Summary Kusarigama/Plugin/Command/Morning.pm »
1 package Taskwarrior::Kusarigama::Plugin::ProjectAlias;
2 2 our $AUTHORITY = 'cpan:YANICK';
3 #ABSTRACT: turn @foo into project:foo
4 2 $Taskwarrior::Kusarigama::Plugin::ProjectAlias::VERSION = '0.11.0';
5  
6 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 2 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 2 extends 'Taskwarrior::Kusarigama::Plugin';
12  
13 2 with 'Taskwarrior::Kusarigama::Hook::OnAdd';
14 2 with 'Taskwarrior::Kusarigama::Hook::OnModify';
15  
16 sub on_add {
17 8 ▶ my( $self, $task ) = @_;
Subroutine on_add: called CC=2 SCAR=7.0
Pod undocumented
18  
19 8 my $desc = $task->{description};
20  
21 8 ▶ $desc =~ s/(^|\s)\@(\w+)\s*/$1/ or return;
Branch: 1 branch
BranchTrueFalseTotal
$desc =~ s/(^|\s)\@(\w+)\s*/$1/ or return 0 8 8
22  
23 8 $task->{project} = $2;
24  
25 8 $task->{description} = $desc;
26 }
27  
28 sub on_modify {
29 0 ▶ my $self = shift;
Subroutine on_modify: not called CC=1 SCAR=6.9
Pod undocumented
30 0 $self->on_add(@_);
31 }
32  
33 2 1;
34  
35 __END__
36  
37 =pod
38  
39 =encoding UTF-8
40  
41 =head1 NAME
42  
43 Taskwarrior::Kusarigama::Plugin::ProjectAlias - turn @foo into project:foo
44  
45 =head1 VERSION
46  
47 version 0.11.0
48  
49 =head1 SYNOPSIS
50  
51 $ task add do something @projectA
52  
53 =head1 DESCRIPTION
54  
55 Expands C<@foo> into C<project:foo>.
56  
57 =head1 AUTHOR
58  
59 Yanick Champoux <yanick@cpan.org>
60  
61 =head1 COPYRIGHT AND LICENSE
62  
63 This software is copyright (c) 2018, 2017 by Yanick Champoux.
64  
65 This is free software; you can redistribute it and/or modify it under
66 the same terms as the Perl 5 programming language system itself.
67  
68 =cut
« Kusarigama/App/Add.pm ↑ Summary Kusarigama/Plugin/Command/Morning.pm »