diff --git a/doc/Doxygen/tools/README b/doc/Doxygen/tools/README index 0a3a9ceecbdebda2b4685489d2c8a458f56af78a..86c4e8ae734d2080c5ac23d0fed4c7130236bbcd 100644 --- a/doc/Doxygen/tools/README +++ b/doc/Doxygen/tools/README @@ -11,4 +11,5 @@ Misc Tools 1. find-templateInComments 2. find-its 3. find-junkFiles +4. find-longlines diff --git a/doc/Doxygen/tools/find-longlines b/doc/Doxygen/tools/find-longlines new file mode 100755 index 0000000000000000000000000000000000000000..c5294715d8c3a6e878fa1098f99e9bd68e1c73f6 --- /dev/null +++ b/doc/Doxygen/tools/find-longlines @@ -0,0 +1,46 @@ +#!/usr/bin/perl -w +use strict; +use File::Find (); + +# ----------------------------------------------------------------------------- +# +# Script +# find-longlines +# +# Description +# Search for *.[CH] files that exceed the 80-column width +# +# - print filename lineNumber and offending line (with truncation point) +# +# ----------------------------------------------------------------------------- + +my $maxlen = 80; +my $re_filespec = qr{^.+\.[CH]$}; +my $count; + +sub wanted { + unless ( lstat($_) and -f _ and -r _ and not -l _ and /$re_filespec/ ) { + return; + } + + local @ARGV = $_; + while (<>) { + chomp; + s{\s+$}{}; # trim + + if ( $maxlen < length ) { + $count++; + substr( $_, $maxlen, 0 ) = "||->>"; # show truncation point + print "$ARGV $. $_\n"; + } + } + close ARGV; +} + +## Traverse desired filesystems +for my $dir (@ARGV) { + no warnings 'File::Find'; + warn "(**) checking '$dir' ...\n"; + File::Find::find( { wanted => \&wanted }, $dir ); +} +