« blib/lib/Code/TidyAll/Role/GenericExecutable.pm
↑ Summary
blib/lib/Code/TidyAll/CacheModel/Shared.pm »
| 1 | package Code::TidyAll::Role::HasIgnore; | ||||||||||
| 2 | |||||||||||
| 3 | 35 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 35 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 35 | ▶ | use Code::TidyAll::Util::Zglob qw(zglobs_to_regex); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 35 | ▶ | use Specio::Library::Builtins; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 35 | ▶ | use Specio::Library::String; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | |||||||||||
| 10 | 35 | ▶ | use Moo::Role; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | |||||||||||
| 12 | 35 | our $VERSION = '0.83'; | |||||||||
| 13 | |||||||||||
| 14 | has ignore => ( | ||||||||||
| 15 | is => 'ro', | ||||||||||
| 16 | isa => t( 'ArrayRef', of => t('NonEmptyStr') ), | ||||||||||
| 17 | 138 | ▶ | default => sub { [] }, | ||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||
| 18 | 35 | ); | |||||||||
| 19 | |||||||||||
| 20 | 35 | has ignore_regex => ( | |||||||||
| 21 | is => 'lazy', | ||||||||||
| 22 | isa => t('RegexpRef'), | ||||||||||
| 23 | ); | ||||||||||
| 24 | |||||||||||
| 25 | 35 | has ignores => ( | |||||||||
| 26 | is => 'lazy', | ||||||||||
| 27 | isa => t( 'ArrayRef', of => t('NonEmptyStr') ), | ||||||||||
| 28 | ); | ||||||||||
| 29 | |||||||||||
| 30 | has select => ( | ||||||||||
| 31 | is => 'ro', | ||||||||||
| 32 | isa => t( 'ArrayRef', of => t('NonEmptyStr') ), | ||||||||||
| 33 | 84 | ▶ | default => sub { [] }, | ||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||
| 34 | 35 | ); | |||||||||
| 35 | |||||||||||
| 36 | sub _build_ignores { | ||||||||||
| 37 | 169 | ▶ | my ($self) = @_; | ||||||||
|
Subroutine
_build_ignores: called CC=1 SCAR=0.0
| |||||||||||
| 38 | 169 | return $self->_parse_zglob_list( $self->ignore ); | |||||||||
| 39 | } | ||||||||||
| 40 | |||||||||||
| 41 | sub _parse_zglob_list { | ||||||||||
| 42 | 264 | ▶ | my ( $self, $zglobs ) = @_; | ||||||||
|
Subroutine
_parse_zglob_list: called CC=2 SCAR=7.2
| |||||||||||
| 43 | 264 | ▶ | if ( my ($bad_zglob) = ( grep {m{^/}} @{$zglobs} ) ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 44 | 0 | die qq{zglob '$bad_zglob' should not begin with slash}; | |||||||||
| 45 | } | ||||||||||
| 46 | 264 | return $zglobs; | |||||||||
| 47 | } | ||||||||||
| 48 | |||||||||||
| 49 | sub _build_ignore_regex { | ||||||||||
| 50 | 121 | ▶ | my ($self) = @_; | ||||||||
|
Subroutine
_build_ignore_regex: called CC=1 SCAR=0.0
| |||||||||||
| 51 | 121 | return zglobs_to_regex( @{ $self->ignores } ); | |||||||||
| 52 | } | ||||||||||
| 53 | |||||||||||
| 54 | 35 | 1; | |||||||||
| 55 | |||||||||||
| 56 | # ABSTRACT: A role for any class that has a list of ignored paths specified in zglob syntax | ||||||||||
| 57 | |||||||||||
| 58 | __END__ | ||||||||||
| 59 | |||||||||||
| 60 | =pod | ||||||||||
| 61 | |||||||||||
| 62 | =encoding UTF-8 | ||||||||||
| 63 | |||||||||||
| 64 | =head1 NAME | ||||||||||
| 65 | |||||||||||
| 66 | Code::TidyAll::Role::HasIgnore - A role for any class that has a list of ignored paths specified in zglob syntax | ||||||||||
| 67 | |||||||||||
| 68 | =head1 VERSION | ||||||||||
| 69 | |||||||||||
| 70 | version 0.83 | ||||||||||
| 71 | |||||||||||
| 72 | =head1 SUPPORT | ||||||||||
| 73 | |||||||||||
| 74 | Bugs may be submitted at L<https://github.com/houseabsolute/perl-code-tidyall/issues>. | ||||||||||
| 75 | |||||||||||
| 76 | =head1 SOURCE | ||||||||||
| 77 | |||||||||||
| 78 | The source code repository for Code-TidyAll can be found at L<https://github.com/houseabsolute/perl-code-tidyall>. | ||||||||||
| 79 | |||||||||||
| 80 | =head1 AUTHORS | ||||||||||
| 81 | |||||||||||
| 82 | =over 4 | ||||||||||
| 83 | |||||||||||
| 84 | =item * | ||||||||||
| 85 | |||||||||||
| 86 | Jonathan Swartz <swartz@pobox.com> | ||||||||||
| 87 | |||||||||||
| 88 | =item * | ||||||||||
| 89 | |||||||||||
| 90 | Dave Rolsky <autarch@urth.org> | ||||||||||
| 91 | |||||||||||
| 92 | =back | ||||||||||
| 93 | |||||||||||
| 94 | =head1 COPYRIGHT AND LICENSE | ||||||||||
| 95 | |||||||||||
| 96 | This software is copyright (c) 2011 - 2022 by Jonathan Swartz. | ||||||||||
| 97 | |||||||||||
| 98 | This is free software; you can redistribute it and/or modify it under | ||||||||||
| 99 | the same terms as the Perl 5 programming language system itself. | ||||||||||
| 100 | |||||||||||
| 101 | The full text of the license can be found in the | ||||||||||
| 102 | F<LICENSE> file included with this distribution. | ||||||||||
| 103 | |||||||||||
| 104 | =cut | ||||||||||