| 1 | package Dist::Conformance::Config 0.006; | ||||||||||||
| 2 | |||||||||||||
| 3 | # ABSTRACT: .conformance.yml, which picks the flavor of a repository and its source | ||||||||||||
| 4 | |||||||||||||
| 5 | 2 | ▶ | use 5.040; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 6 | 2 | ▶ | use warnings FATAL => 'all'; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 7 | 2 | ▶ | use re '/aasx'; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 8 | |||||||||||||
| 9 | 2 | ▶ | use Dist::Conformance::Schema(); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 10 | |||||||||||||
| 11 | |||||||||||||
| 12 | 2 | our $FILE = '.conformance.yml'; | |||||||||||
| 13 | |||||||||||||
| 14 | 2 | my $NOT_AN_OPTION = { type => 'string', minLength => 1, pattern => '\A[^-]' }; | |||||||||||
| 15 | |||||||||||||
| 16 | 2 | our %SCHEMA = ( | |||||||||||
| 17 | type => 'object', | ||||||||||||
| 18 | required => [qw{flavor source}], | ||||||||||||
| 19 | additionalProperties => 0, | ||||||||||||
| 20 | properties => { | ||||||||||||
| 21 | flavor => $Dist::Conformance::Schema::NAME, | ||||||||||||
| 22 | source => { | ||||||||||||
| 23 | oneOf => [ | ||||||||||||
| 24 | { | ||||||||||||
| 25 | type => 'object', | ||||||||||||
| 26 | required => ['git'], | ||||||||||||
| 27 | additionalProperties => 0, | ||||||||||||
| 28 | properties => { git => $NOT_AN_OPTION, ref => $NOT_AN_OPTION, path => $Dist::Conformance::Schema::PATH }, | ||||||||||||
| 29 | }, | ||||||||||||
| 30 | { | ||||||||||||
| 31 | type => 'object', | ||||||||||||
| 32 | required => ['directory'], | ||||||||||||
| 33 | additionalProperties => 0, | ||||||||||||
| 34 | properties => { directory => { type => 'string', minLength => 1 }, path => $Dist::Conformance::Schema::PATH }, | ||||||||||||
| 35 | }, | ||||||||||||
| 36 | ], | ||||||||||||
| 37 | }, | ||||||||||||
| 38 | skip => { type => 'array', items => $Dist::Conformance::Schema::NAME, default => [] }, | ||||||||||||
| 39 | checks => { type => 'object', additionalProperties => { type => 'object' }, default => {} }, | ||||||||||||
| 40 | variables => { type => 'object', additionalProperties => { type => 'string' }, default => {} }, | ||||||||||||
| 41 | }, | ||||||||||||
| 42 | ); | ||||||||||||
| 43 | |||||||||||||
| 44 | |||||||||||||
| 45 | 0 | ▶ | sub load ($snapshot) { | ||||||||||
|
Subroutine
load: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||
| 46 | 0 | ▶ | my $text = $snapshot->content($FILE) // die("The repository has no $FILE, so it names no flavor\n"); | ||||||||||
|
Condition0%0/2
$snapshot->content($Dist::Conformance::Config::FILE) // die("The repository has no $Dist::Conformance::Config::FILE, so it names no flavor\n")
MC/DC0%0/1
$snapshot->content($Dist::Conformance::Config::FILE) // die("The repository has no $Dist::Conformance::Config::FILE, so it names no flavor\n")
$snapshot->content($Dist::Conformance::Config::FILE)
Truth table0%0/2
A
A= $snapshot->content($Dist::Conformance::Config::FILE)
| |||||||||||||
| 47 | 0 | return validate( Dist::Conformance::Schema::parse_yaml( $text, $FILE ) ); | |||||||||||
| 48 | } | ||||||||||||
| 49 | |||||||||||||
| 50 | |||||||||||||
| 51 | 0 | ▶ | sub validate ($data) { | ||||||||||
|
Subroutine
validate: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 52 | 0 | return Dist::Conformance::Schema::validate( $data, \%SCHEMA, $FILE ); | |||||||||||
| 53 | } | ||||||||||||
| 54 | |||||||||||||
| 55 | __END__ | ||||||||||||