Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Development
openfoam
Commits
dd30623a
Commit
dd30623a
authored
Jun 23, 2008
by
Mark Olesen
Committed by
graham
Jun 23, 2008
Browse files
Add find-longlines utility (find *.[CH] files that violate 80-cols)
parent
34267e9a
Changes
2
Hide whitespace changes
Inline
Side-by-side
doc/Doxygen/tools/README
View file @
dd30623a
...
...
@@ -11,4 +11,5 @@ Misc Tools
1. find-templateInComments
2. find-its
3. find-junkFiles
4. find-longlines
doc/Doxygen/tools/find-longlines
0 → 100755
View file @
dd30623a
#!/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
);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment