| 1 | package Code::TidyAll::Plugin::PerlCritic; | ||||||||||
| 2 | |||||||||||
| 3 | 2 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 2 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 2 | ▶ | use Moo; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 2 | extends 'Code::TidyAll::Plugin'; | |||||||||
| 9 | |||||||||||
| 10 | 2 | with 'Code::TidyAll::Role::RunsCommand'; | |||||||||
| 11 | |||||||||||
| 12 | 2 | our $VERSION = '0.83'; | |||||||||
| 13 | |||||||||||
| 14 | # On Windows only the batch file is actually executable. | ||||||||||
| 15 | 2 | ▶ | my $cmd = $^O eq 'MSWin32' ? 'perlcritic.bat' : 'perlcritic'; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 16 | 1 | ▶ | sub _build_cmd {$cmd} | ||||||||
|
Subroutine
_build_cmd: called CC=1 SCAR=0.0
| |||||||||||
| 17 | |||||||||||
| 18 | sub validate_file { | ||||||||||
| 19 | 0 | ▶ | my ( $self, $file ) = @_; | ||||||||
|
Subroutine
validate_file: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 20 | |||||||||||
| 21 | 0 | my $output = $self->_run_or_die($file); | |||||||||
| 22 | 0 | ▶ | die "$output\n" unless $output =~ /^.* source OK\n/s; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 23 | |||||||||||
| 24 | 0 | return; | |||||||||
| 25 | } | ||||||||||
| 26 | |||||||||||
| 27 | 2 | 1; | |||||||||
| 28 | |||||||||||
| 29 | # ABSTRACT: Use perlcritic with tidyall | ||||||||||
| 30 | |||||||||||
| 31 | __END__ | ||||||||||
| 32 | |||||||||||
| 33 | =pod | ||||||||||
| 34 | |||||||||||
| 35 | =encoding UTF-8 | ||||||||||
| 36 | |||||||||||
| 37 | =head1 NAME | ||||||||||
| 38 | |||||||||||
| 39 | Code::TidyAll::Plugin::PerlCritic - Use perlcritic with tidyall | ||||||||||
| 40 | |||||||||||
| 41 | =head1 VERSION | ||||||||||
| 42 | |||||||||||
| 43 | version 0.83 | ||||||||||
| 44 | |||||||||||
| 45 | =head1 SYNOPSIS | ||||||||||
| 46 | |||||||||||
| 47 | In configuration: | ||||||||||
| 48 | |||||||||||
| 49 | ; Configure in-line | ||||||||||
| 50 | ; | ||||||||||
| 51 | [PerlCritic] | ||||||||||
| 52 | select = lib/**/*.pm | ||||||||||
| 53 | argv = --severity 5 --exclude=nowarnings | ||||||||||
| 54 | |||||||||||
| 55 | ; or refer to a .perlcriticrc in the same directory | ||||||||||
| 56 | ; | ||||||||||
| 57 | [PerlCritic] | ||||||||||
| 58 | select = lib/**/*.pm | ||||||||||
| 59 | argv = --profile $ROOT/.perlcriticrc | ||||||||||
| 60 | |||||||||||
| 61 | =head1 DESCRIPTION | ||||||||||
| 62 | |||||||||||
| 63 | Runs L<perlcritic>, a Perl validator, and dies if any problems were found. | ||||||||||
| 64 | |||||||||||
| 65 | =head1 INSTALLATION | ||||||||||
| 66 | |||||||||||
| 67 | Install perlcritic from CPAN. | ||||||||||
| 68 | |||||||||||
| 69 | cpanm perlcritic | ||||||||||
| 70 | |||||||||||
| 71 | =head1 CONFIGURATION | ||||||||||
| 72 | |||||||||||
| 73 | This plugin accepts the following configuration options: | ||||||||||
| 74 | |||||||||||
| 75 | =head2 argv | ||||||||||
| 76 | |||||||||||
| 77 | Arguments to pass to C<perlcritic>. | ||||||||||
| 78 | |||||||||||
| 79 | =head1 SUPPORT | ||||||||||
| 80 | |||||||||||
| 81 | Bugs may be submitted at L<https://github.com/houseabsolute/perl-code-tidyall/issues>. | ||||||||||
| 82 | |||||||||||
| 83 | =head1 SOURCE | ||||||||||
| 84 | |||||||||||
| 85 | The source code repository for Code-TidyAll can be found at L<https://github.com/houseabsolute/perl-code-tidyall>. | ||||||||||
| 86 | |||||||||||
| 87 | =head1 AUTHORS | ||||||||||
| 88 | |||||||||||
| 89 | =over 4 | ||||||||||
| 90 | |||||||||||
| 91 | =item * | ||||||||||
| 92 | |||||||||||
| 93 | Jonathan Swartz <swartz@pobox.com> | ||||||||||
| 94 | |||||||||||
| 95 | =item * | ||||||||||
| 96 | |||||||||||
| 97 | Dave Rolsky <autarch@urth.org> | ||||||||||
| 98 | |||||||||||
| 99 | =back | ||||||||||
| 100 | |||||||||||
| 101 | =head1 COPYRIGHT AND LICENSE | ||||||||||
| 102 | |||||||||||
| 103 | This software is copyright (c) 2011 - 2022 by Jonathan Swartz. | ||||||||||
| 104 | |||||||||||
| 105 | This is free software; you can redistribute it and/or modify it under | ||||||||||
| 106 | the same terms as the Perl 5 programming language system itself. | ||||||||||
| 107 | |||||||||||
| 108 | The full text of the license can be found in the | ||||||||||
| 109 | F<LICENSE> file included with this distribution. | ||||||||||
| 110 | |||||||||||
| 111 | =cut | ||||||||||