Dist-Conformance
view release on metacpan or search on metacpan
lib/Dist/Conformance/Check/ToolConfiguration.pm view on Meta::CPAN
package Dist::Conformance::Check::ToolConfiguration 0.003;
# ABSTRACT: The configuration files of the tools exist
use 5.040;
use warnings FATAL => 'all';
use re '/aasx';
use Mojo::Base 'Dist::Conformance::Check', -signatures;
use Dist::Conformance::Schema();
sub config_schema ($) {
return {
required => ['files'],
properties => { files => { type => 'object', additionalProperties => { %$Dist::Conformance::Schema::PATH, nullable => 1 } } },
};
}
sub check ( $self, $snapshot ) {
my @missing = $self->missing( $snapshot, sort keys %{ $self->config->{files} } );
return ( 'fail', 'missing: ' . join ', ', @missing ) if @missing;
return ( 'pass', 'all present' );
}
sub update ( $self, $update ) {
my $files = $self->config->{files};
for my $path ( $self->missing( $update->snapshot, sort keys %$files ) ) {
if ( defined $files->{$path} ) {
$self->write_template( $update, $path, $files->{$path} );
}
else {
$update->by_hand("Write $path by hand: the flavor names no template for it");
}
}
return;
}
__END__
=pod
=encoding UTF-8
=head1 NAME
Dist::Conformance::Check::ToolConfiguration - The configuration files of the tools exist
=head1 VERSION
version 0.003
=head1 DESCRIPTION
Files that the tools of the harness read, such as perltidy, perlcritic and
tests-covering. The check passes when every file exists, and fails with the
list of those that do not. Their content is the repository's own: a stopword
list grows with the repository, so the check does not compare it with the
template.
The update writes each missing file from its template, and leaves a file that
exists alone.
=head1 METHODS
=head2 check
=head2 update
Writes each missing file from its template.
=head1 IN A FLAVOR
checks:
ToolConfiguration:
files:
.perltidyrc: templates/perltidyrc
.preferred_modules.ini: templates/preferred_modules.ini
.pod_stopwords: templates/pod_stopwords
.tests-covering-map.pl: templates/tests-covering-map.pl
=head1 CONFIGURATION
=over
=item files
( run in 0.628 second using v1.01-cache-2.11-cpan-1236ad508bc )