File Coverage

blib/lib/Code/TidyAll/Plugin/SortLines.pm
Criterion Covered Total %
statement 12 12 100.0
branch n/a
condition n/a
subroutine 4 4 100.0
pod 1 1 100.0
total 17 17 100.0


line stmt bran cond sub pod time code
1              
2             use strict;
3 1     1   415 use warnings;
  1         2  
  1         26  
4 1     1   4  
  1         2  
  1         27  
5             use Moo;
6 1     1   4  
  1         2  
  1         5  
7             extends 'Code::TidyAll::Plugin';
8              
9             our $VERSION = '0.82';
10              
11             my ( $self, $source ) = @_;
12              
13 2     2 1 4 return join( "\n", sort( grep {/\S/} split( /\n/, $source ) ) ) . "\n";
14             }
15 2         6  
  6         23  
16             1;
17              
18             # ABSTRACT: Sort the lines in a file
19              
20              
21             =pod
22              
23             =encoding UTF-8
24              
25             =head1 NAME
26              
27             Code::TidyAll::Plugin::SortLines - Sort the lines in a file
28              
29             =head1 VERSION
30              
31             version 0.82
32              
33             =head1 SYNOPSIS
34              
35             # In configuration:
36              
37             [SortLines]
38             select = .ispell* **/.gitignore
39              
40             =head1 DESCRIPTION
41              
42             Sorts the lines of a file; whitespace lines are discarded. Useful for files
43             containing one entry per line, such as C<.svnignore>, C<.gitignore>, and
44             C<.ispell*>.
45              
46             =head1 SUPPORT
47              
48             Bugs may be submitted at L<https://github.com/houseabsolute/perl-code-tidyall/issues>.
49              
50             =head1 SOURCE
51              
52             The source code repository for Code-TidyAll can be found at L<https://github.com/houseabsolute/perl-code-tidyall>.
53              
54             =head1 AUTHORS
55              
56             =over 4
57              
58             =item *
59              
60             Jonathan Swartz <swartz@pobox.com>
61              
62             =item *
63              
64             Dave Rolsky <autarch@urth.org>
65              
66             =back
67              
68             =head1 COPYRIGHT AND LICENSE
69              
70             This software is copyright (c) 2011 - 2022 by Jonathan Swartz.
71              
72             This is free software; you can redistribute it and/or modify it under
73             the same terms as the Perl 5 programming language system itself.
74              
75             The full text of the license can be found in the
76             F<LICENSE> file included with this distribution.
77              
78             =cut