App-githook-perltidy

 view release on metacpan or  search on metacpan

lib/App/githook/perltidy/pre_commit.pm  view on Meta::CPAN

        die "An unknown perltidy error occurred.";
    }
}

sub tidy_pod {
    my $self     = shift;
    my $tmp_file = shift || die 'tidy_pod($TMP_FILE, $file)';
    my $file     = shift || die 'tidy_pod($tmp_file, $FILE)';
    my $where    = shift;

    state $req = require Pod::Tidy;
    $status = "(podtidy) ($where)";

    Pod::Tidy::tidy_files(
        files     => [$tmp_file],
        recursive => 0,
        verbose   => 0,
        inplace   => 1,
        nobackup  => 1,
        columns   => 72,
        %{ $self->podtidyrc_opts },
    );
}

sub critic_perl {
    my $self     = shift;
    my $tmp_file = shift || die 'critic_perl($TMP_FILE, $file)';
    my $file     = shift || die 'critic_perl($tmp_file, $FILE)';
    my $where    = shift;

    state $req = require Perl::Critic;
    $status = "(perlcritic) ($where)";

    my @violations =
      Perl::Critic::critique( { -profile => $self->perlcriticrc->stringify },
        $tmp_file->stringify );

    if (@violations) {
        $status .= ":\n";
        die join( '', @violations );
    }



( run in 0.227 second using v1.01-cache-2.11-cpan-0d8aa00de5b )