blib/lib/Code/TidyAll/Plugin/UniqueLines.pm untested

filter: Statementstmt 0.0% 0 / 21 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 28 CC 1 SCAR 6.9
CC
1
Cov
0%
transform_source
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 use strict;
2 use warnings;
3  
4 use 5.006;
5  
6 package Code::TidyAll::Plugin::UniqueLines;
7 $Code::TidyAll::Plugin::UniqueLines::VERSION = '0.000003';
8 use Moo;
9 extends 'Code::TidyAll::Plugin';
10  
11 use List::Util 1.45 qw( uniq );
12  
13 sub transform_source {
14 my ( $self, $source ) = @_;
15  
16 return join( "\n", uniq( grep { /\S/ } split( /\n/, $source ) ) ) . "\n";
17 }
18  
19 1;
20  
21 =pod
22  
23 =encoding UTF-8
24  
25 =head1 NAME
26  
27 Code::TidyAll::Plugin::UniqueLines - Remove duplicate lines from a file
28  
29 =head1 VERSION
30  
31 version 0.000003
32  
33 =head1 SYNOPSIS
34  
35 # In configuration:
36  
37 [UniqueLines]
38 select = .ispell* **/.gitignore
39  
40 =head1 DESCRIPTION
41  
42 Discards duplicate lines from a file. Useful for files containing one entry
43 per line, such as C<.svnignore>, C<.gitignore>, and C<.ispell*>.
44  
45 =head1 ACKNOWLEDGEMENTS
46  
47 This code was essentially pilfered from L<Code::TidyAll::Plugin::SortLines>
48  
49 =head1 AUTHOR
50  
51 Olaf Alders <olaf@wundercounter.com>
52  
53 =head1 COPYRIGHT AND LICENSE
54  
55 This software is copyright (c) 2014-2017 by Olaf Alders.
56  
57 This is free software; you can redistribute it and/or modify it under
58 the same terms as the Perl 5 programming language system itself.
59  
60 =cut
61  
62 __END__