| 1 | package Code::TidyAll::Plugin::YAML; | ||||||||||
| 2 | 1 | $Code::TidyAll::Plugin::YAML::VERSION = '0.000001'; | |||||||||
| 3 | 1 | ▶ | use YAML; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 1 | ▶ | use Moo; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 1 | extends 'Code::TidyAll::Plugin'; | |||||||||
| 7 | |||||||||||
| 8 | 1 | my @attributes = ( | |||||||||
| 9 | 'AnchorPrefix', 'CompressSeries', | ||||||||||
| 10 | 'DumpCode', 'Indent', | ||||||||||
| 11 | 'QuoteNumericStrings', 'SortKeys', | ||||||||||
| 12 | 'Stringify', 'UseAliases', | ||||||||||
| 13 | 'UseBlock', 'UseCode', | ||||||||||
| 14 | 'UseFold', 'UseHeader', | ||||||||||
| 15 | 'UseVersion', | ||||||||||
| 16 | ); | ||||||||||
| 17 | |||||||||||
| 18 | 1 | foreach my $attr ( @attributes ) { | |||||||||
| 19 | 13 | has $attr => ( is => 'ro', predicate => '_has_' . $attr ); | |||||||||
| 20 | } | ||||||||||
| 21 | |||||||||||
| 22 | 0 | ▶ | sub transform_source { | ||||||||
|
Subroutine
transform_source: not called CC=3 SCAR=16.5
Pod
documented
| |||||||||||
| 23 | 0 | my $self = shift; | |||||||||
| 24 | 0 | my $source = shift; | |||||||||
| 25 | |||||||||||
| 26 | 1 | ▶ | no strict 'refs'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 27 | 0 | foreach my $attr ( @attributes ) { | |||||||||
| 28 | 0 | my $predicate = '_has_' . $attr; | |||||||||
| 29 | 0 | ▶ | if ( $self->$predicate ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 30 | 0 | *{"YAML::$attr"} = \($self->$attr); | |||||||||
| 31 | } | ||||||||||
| 32 | } | ||||||||||
| 33 | 1 | ▶ | use strict 'refs'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 34 | |||||||||||
| 35 | 0 | return Dump( Load( $source ) ); | |||||||||
| 36 | } | ||||||||||
| 37 | |||||||||||
| 38 | 1 | 1; | |||||||||
| 39 | |||||||||||
| 40 | # ABSTRACT: Use the YAML module to tidy YAML documents with tidyall | ||||||||||
| 41 | |||||||||||
| 42 | __END__ | ||||||||||