Policies/CodeOfConduct/ContributorCovenant.pm

filter: Statementstmt 47.0% 16 / 34 Branchbran 0.0% 0 / 8 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 55.5% 5 / 9 Podpod 100% 3 / 3 totaltotal 38.1% 24 / 63 CC 8 SCAR 36.0
CC
8
Cov
33%
create
72.0
new
2.0
get_available_classes_and_versions
2.0
CRAP 36.7
« Policies/License.pm ↑ Summary Policies/AIDisclosure/Basic.pm »
1 ## no critic (ControlStructures::ProhibitPostfixControls)
2 package Software::Policies::CodeOfConduct::ContributorCovenant;
3  
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use 5.010;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 # ABSTRACT: Create a policy file: Code of Conduct / Contributor Covenant
9  
10 1 our $VERSION = '0.006';
11  
12 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 1 ▶use Software::Policy::CodeOfConduct;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 0 ▶sub new {
Subroutine new: not called CC=1 SCAR=6.9
Pod documented
16 0 my ($class) = @_;
17 0 return bless {}, $class;
18 }
19  
20 0 ▶sub create {
Subroutine create: not called CC=8 SCAR=42.8
Pod documented
21 0 my ( $self, %args ) = @_;
22 0 ▶ my $version = $args{'version'} // '1.4';
Condition0%0/2
$args{"version"} // "1.4"
l!l
00
MC/DC0%0/1
$args{"version"} // "1.4"
$args{"version"}
Truth table0%0/2
A
A= $args{"version"}
Aresult
11
00
23 0 ▶ my $format = $args{'format'} // 'markdown';
Condition0%0/2
$args{"format"} // "markdown"
l!l
00
MC/DC0%0/1
$args{"format"} // "markdown"
$args{"format"}
Truth table0%0/2
A
A= $args{"format"}
Aresult
11
00
24 0 my %attributes;
25 0 ▶ my $attrs = $args{'attributes'} // {};
Condition0%0/2
$args{"attributes"} // {}
l!l
00
MC/DC0%0/1
$args{"attributes"} // {}
$args{"attributes"}
Truth table0%0/2
A
A= $args{"attributes"}
Aresult
11
00
26 0 $attributes{'policy'} = 'Contributor_Covenant_' . $version;
27 0 ▶ $attributes{'name'} = $attrs->{'name'} if $attrs->{'name'};
Branch: 1 branch
BranchTrueFalseTotal
if $attrs->{"name"} 0 0 0
28 0 ▶ $attributes{'contact'} = $attrs->{'authors'}->[0] if $attrs->{'authors'};
Branch: 1 branch
BranchTrueFalseTotal
if $attrs->{"authors"} 0 0 0
29 0 ▶ croak q{Missing attribute 'name'} if ( !defined $attributes{'name'} );
Branch: 1 branch
BranchTrueFalseTotal
unless defined $attributes{"name"} 0 0 0
30 0 ▶ croak q{Missing attribute 'contact'} if ( !defined $attributes{'contact'} );
Branch: 1 branch
BranchTrueFalseTotal
unless defined $attributes{"contact"} 0 0 0
31  
32 0 my $p = Software::Policy::CodeOfConduct->new(
33  
34 # policy => 'Contributor_Covenant_1.4',
35 # name => 'Foo',
36 # contact => 'team-foo@example.com',
37 # filename => 'CODE_OF_CONDUCT.md',
38 %attributes,
39 );
40  
41 return (
42 0 policy => 'CodeOfConduct',
43 class => 'ContributorCovenant',
44 version => $version,
45 text => $p->fulltext . "\n",
46 filename => _filename($format),
47 format => $format,
48 );
49 }
50  
51 0 ▶sub get_available_classes_and_versions {
Subroutine get_available_classes_and_versions: not called CC=1 SCAR=6.9
Pod documented
52 return {
53 0 'ContributorCovenant' => {
54 versions => {
55 '1.4' => 1,
56 '2.0' => 1,
57 '2.1' => 1,
58 },
59 formats => {
60 'markdown' => 1,
61 },
62 },
63 };
64 }
65  
66 0 ▶sub _filename {
Subroutine _filename: not called CC=1 SCAR=6.9
67 0 my ($format) = @_;
68 0 my %formats = ( 'markdown' => 'CODE_OF_CONDUCT.md', );
69 0 return $formats{$format};
70 }
71 1 1;
72  
73 __END__
« Policies/License.pm ↑ Summary Policies/AIDisclosure/Basic.pm »