2 ################################################################################
3 # Version: MPL 1.1 / GPLv3+ / LGPLv3+
5 # The contents of this file are subject to the Mozilla Public License Version
6 # 1.1 (the "License"); you may not use this file except in compliance with
7 # the License or as specified alternatively below. You may obtain a copy of
8 # the License at http://www.mozilla.org/MPL/
10 # Software distributed under the License is distributed on an "AS IS" basis,
11 # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 # for the specific language governing rights and limitations under the
15 # The Initial Developer of the Original Code is
16 # Michael Koch <miko@gmx.ch>
18 # Major Contributor(s):
21 # For minor contributions see the git repository.
23 # Alternatively, the contents of this file may be used under the terms of
24 # either the GNU General Public License Version 3 or later (the "GPLv3+"), or
25 # the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
26 # in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
27 # instead of those above.
28 ################################################################################
29 # Usage: "Usage: doubleNewlines.pl <directory>"
30 # It is possible to enter more than one directory separated by spaces.
31 # Instead of a directory you can also use one or more files as arguments.
32 ################################################################################
42 die "Usage: doubleNewlines.pl <directory>\n" unless (@ARGV);
44 # if path is relative, make it absolute
49 print "Following code files (.hxx and .cxx) are suspicious:\n";
50 find
(\
&processFile
, @ARGV); # processes all files in dir and subdirs
51 print "Found $total suspicious files.\n";
54 my $file = $File::Find
::name
;
55 return unless $file =~ /(.cxx$)|(.hxx$)/;
56 open FILE
, $file or die "Can't open '$file': $!";
57 my $lines = join '', <FILE
>;
58 if ($lines =~ /(\n{2,}.+){10}/) { # ten consecutive occurrences of [empty line(s) - code line)]
59 my $relPath = substr($file, index($file, "clone")+6); # relative path beginning with repo name