Skip to content
Snippets Groups Projects
Commit 8c106616 authored by Henry's avatar Henry
Browse files

Remove tools used to update Doxygen documentation

parent 61199386
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/perl -w
use strict;
use File::Find ();
# -----------------------------------------------------------------------------
#
# Script
# find-junkFiles
#
# Description
# Search for "junk" files left over from editor, core, CVS, etc.
#
# - print filename only
#
# -----------------------------------------------------------------------------
sub wanted {
return unless -f $_;
if (
m{^\.?.+~$} ## editor backup
or m{^\#.+\#$} ## editor autosave
or m{^\.\#.+$} ## cvs replace update (eg, ".#test.c.1.3")
or m{^core(\.\d+)?$} ## core dump
) {
print "$File::Find::name\n";
}
}
## Traverse desired filesystems
for my $dir (@ARGV) {
no warnings 'File::Find';
warn "(**) checking '$dir' ...\n";
File::Find::find( { wanted => \&wanted }, $dir );
}
#!/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 "$File::Find::name $. $_\n";
}
}
close ARGV;
}
## Traverse desired filesystems
for my $dir (@ARGV) {
no warnings 'File::Find';
warn "(**) checking '$dir' ...\n";
File::Find::find( { wanted => \&wanted }, $dir );
}
#!/usr/bin/perl -w
use strict;
use File::Find ();
# -----------------------------------------------------------------------------
#
# Script
# find-placeholderDescription
#
# Description
# Search for *.[H] files with a Description that looks like it is
# a placeholder
# eg, Foam::className
#
# - print filename '#' and the description
#
# -----------------------------------------------------------------------------
my $minLength = 16;
my $re_filespec = qr{^.+\.[H]$};
# for the convenience of &wanted calls, including -eval statements:
## use vars qw( *name *dir *prune );
## *name = *File::Find::name;
## *dir = *File::Find::dir;
## *prune = *File::Find::prune;
sub wanted {
unless ( lstat($_) and -f _ and -r _ and not -l _ and /$re_filespec/ ) {
return;
}
my ( $tag, $description );
local @ARGV = $_;
while (<>) {
my $name;
## examine the class/typedef name
if (/^(Class|Typedef)\s*$/) {
$_ = <>;
($tag) = split;
}
if (/^Description\s*$/) {
$_ = <>;
( $description = $_ ) =~ s{^\s+|\s+$}{}g;
# remove trailing punctuation as being noise
$description =~ s{\s*[.,:]+$}{};
last;
}
}
$description ||= '';
## we have 'Class/Typedef' tag
if ( defined $tag ) {
# description looks like a class name
if (
$description =~ m{^\w+(::\w+)+$}
) {
print "$File::Find::name # $description\n";
}
}
}
## Traverse desired filesystems
for my $dir (@ARGV) {
no warnings 'File::Find';
warn "(**) checking '$dir' ...\n";
File::Find::find( { wanted => \&wanted }, $dir );
}
#!/usr/bin/perl -w
use strict;
use File::Find ();
# -----------------------------------------------------------------------------
#
# Script
# find-retagged
#
# Description
# Search for *.[H] files with 'InClass', 'InNamespace' or 'Type'
# starting in the first column.
# In some places these could removed. In other places they should be
# replaced with a 'Typedef'
# - print filename and the tag (InClass|InNamespace|Type)
#
# -----------------------------------------------------------------------------
my $re_filespec = qr{^.+\.[H]$};
# for the convenience of &wanted calls, including -eval statements:
## use vars qw( *name *dir *prune );
## *name = *File::Find::name;
## *dir = *File::Find::dir;
## *prune = *File::Find::prune;
sub wanted {
unless ( lstat($_) and -f _ and -r _ and not -l _ and /$re_filespec/ ) {
return;
}
local @ARGV = $_;
while (<>) {
if (/^(InClass|InNamespace|Type)\s*$/) {
print "$File::Find::name $1 line=$.\n";
}
}
close ARGV;
}
## Traverse desired filesystems
for my $dir (@ARGV) {
no warnings 'File::Find';
warn "(**) checking '$dir' ...\n";
File::Find::find( { wanted => \&wanted }, $dir );
}
#!/usr/bin/perl -w
use strict;
use File::Find ();
# -----------------------------------------------------------------------------
#
# Script
# find-suspiciousTags
#
# Description
# Search for *.[CH] files with 'Class' or 'Namespace' starting in the
# first column but without a class being defined anywhere in the file.
# These are probably incorrect or should be at least be
# changed to 'In Class' / 'In Namespace' for now.
# - print filename and 'InClass' or 'InNamespace'
#
# Find the namespaces used in the files and compare these to what is
# given on the 'Class' information
# - print filename and corrected Class
#
# Check for trailing garbage in the 'Class' information
# - print filename and 'ClassWithTrailingInformation'
#
# -----------------------------------------------------------------------------
my $re_filespec = qr{^.+\.[CH]$};
# for the convenience of &wanted calls, including -eval statements:
## use vars qw( *name *dir *prune );
## *name = *File::Find::name;
## *dir = *File::Find::dir;
## *prune = *File::Find::prune;
sub wanted {
unless ( lstat($_) and -f _ and -r _ and not -l _ and /$re_filespec/ ) {
return;
}
# potential className
( my $fileClass = $_ ) =~ s{\.[A-Za-z]$}{};
my ( $namespace, $currentClass, %classes, %found ) = ('');
local @ARGV = $_;
while (<>) {
my $name;
## look for (class|namespace), deal with repeats
if ( ($name) = /^\s*class\s+(\w+)\s*/ ) {
$classes{$name}++;
}
elsif ( ($name) = /^\s*namespace\s+(\w+)\s*/ ) {
## reset if 'Foam' namespace appears again
$namespace = '' if $name eq "Foam";
$namespace .= $name . "::";
}
elsif (/^(Class|Namespace)\s*/) {
$found{$1}++;
## examine the class name
if (/^Class\s*$/) {
$_ = <>;
my @trailing;
( $currentClass, @trailing ) = split;
if (@trailing) {
$found{-trailing}++;
}
# the next line should be blank
$_ = <>;
$_ ||= '';
if (not /^\s*$/) {
$found{-spacing}++;
}
}
}
}
# always report if the Class has trailing information
if ( delete $found{-trailing} ) {
print "$File::Find::name ClassWithTrailingInformation\n";
}
# always report if the Class has spacing problem
if ( delete $found{-spacing} ) {
print "$File::Find::name ClassWithSpacingIssue\n";
}
if (%classes) {
## we have 'Class' tag
if ( defined $currentClass ) {
if ($namespace) {
my ($currentNamespace) = $currentClass =~ m{^(.+::)};
$currentNamespace ||= '';
if ( $namespace ne $currentNamespace ) {
$currentClass =~ s{^(.+::)}{};
$currentClass ||= $fileClass;
print "$File::Find::name $namespace$currentClass\n";
}
}
elsif ( not $currentClass ) {
## supply a class name
print "$File::Find::name $fileClass\n";
}
}
}
else {
## no classes, all tags are deemed suspicious
for ( sort keys %found ) {
print "$File::Find::name In$_\n";
}
}
}
## Traverse desired filesystems
for my $dir (@ARGV) {
no warnings 'File::Find';
warn "(**) checking '$dir' ...\n";
File::Find::find( { wanted => \&wanted }, $dir );
}
#!/usr/bin/perl -w
use strict;
use File::Find ();
# -----------------------------------------------------------------------------
#
# Script
# find-templateInComments
#
# Description
# Search for *.[CH] files with '<xxx>' tags within the first comment block
# These likely need to be quoted as '\<xxx\>' for Doxygen.
# - print filename and lineNumber
#
# -----------------------------------------------------------------------------
my $re_filespec = qr{^.+\.[CH]$};
# for the convenience of &wanted calls, including -eval statements:
## use vars qw( *name *dir *prune );
## *name = *File::Find::name;
## *dir = *File::Find::dir;
## *prune = *File::Find::prune;
sub wanted {
unless ( lstat($_) and -f _ and -r _ and not -l _ and /$re_filespec/ ) {
return;
}
local @ARGV = $_;
while (<>) {
if (m{^\s*/\*} ... m{\*/})
{
if (m{\<\s*\w+\s*\>}) {
print "$File::Find::name line=$.\n";
}
if (m{\*/}) {
last;
}
}
}
close ARGV;
}
## Traverse desired filesystems
for my $dir (@ARGV) {
no warnings 'File::Find';
warn "(**) checking '$dir' ...\n";
File::Find::find( { wanted => \&wanted }, $dir );
}
#!/usr/bin/perl -w
use strict;
use File::Find ();
# -----------------------------------------------------------------------------
#
# Script
# find-tinyDescription
#
# Description
# Search for *.[H] files with 'Class' starting in the first column
# and a missing Description, or a tiny Description.
# A tiny Description is less than XX letters and does not resemble
# the class name. We'll look for descriptions matching the class name
# in a later pass.
#
# - print filename '#' and the description
#
# -----------------------------------------------------------------------------
my $minLength = 16;
my $re_filespec = qr{^.+\.[H]$};
# for the convenience of &wanted calls, including -eval statements:
## use vars qw( *name *dir *prune );
## *name = *File::Find::name;
## *dir = *File::Find::dir;
## *prune = *File::Find::prune;
sub wanted {
unless ( lstat($_) and -f _ and -r _ and not -l _ and /$re_filespec/ ) {
return;
}
my ( $currentClass, $description );
local @ARGV = $_;
while (<>) {
my $name;
## examine the class name
if (/^Class\s*$/) {
$_ = <>;
($currentClass) = split;
}
if (/^Description\s*$/) {
$_ = <>;
( $description = $_ ) =~ s{^\s+|\s+$}{}g;
# remove trailing punctuation as being noise
$description =~ s{\s*[.,:]+$}{};
last;
}
}
$description ||= '';
## we have 'Class' tag
if ( defined $currentClass ) {
# description doesnt looks like a class name
if (
$description !~ m{^\w+(::\w+)+$}
and
(length $description < $minLength or $description =~ m{^\S+$})
) {
print "$File::Find::name # $description\n";
}
}
}
## Traverse desired filesystems
for my $dir (@ARGV) {
no warnings 'File::Find';
warn "(**) checking '$dir' ...\n";
File::Find::find( { wanted => \&wanted }, $dir );
}
#!/bin/sh
# -----------------------------------------------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
# \\/ M anipulation |
# ------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM.
#
# OpenFOAM is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
#
# You should have received a copy of the GNU General Public License
# along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
#
# Script
# fix-Class
#
# Description
# Process the lists given on the command line.
# Column 1 = fileName, column 2 = Class or action
# See find-suspiciousTags for details.
#
# 1. fix ClassWithTrailingInformation by hand
# 2. InClass and InNamespace fixup
# 3. change
# |Class
# | anything
# ->
# |Class
# | className
#
# -----------------------------------------------------------------------------
# stop if trailing junk has been detected
for fileList
do
[ -f $fileList -a -r $fileList ] || {
echo "cannot read file list: $fileList"
exit 1
}
grep ClassWithTrailingInformation $fileList
if [ $? = 0 ]
then
echo "#"
echo "# fix ClassWithTrailingInformation by hand"
echo "#"
exit 99
fi
done
for fileList
do
# repair InClass, InNamespace
for tag in Class Namespace
do
backup=".repair-In$tag"
for file in $(sed -n -e "s/In$tag *$//p" $fileList)
do
echo "repair In$tag: $file"
perl -i$backup -pe "s/^$tag/In$tag/" $file
done
done
# repair the class names (with namespace)
backup=".repair-reclassify"
cat $fileList | while read fileName className
do
# use classes with '::' separator to avoid too
# many false positives
perl -i$backup -x $0 $fileName $className
done
done
exit 0
# ---------------------------------------------------------------- end-of-file
# embedded Perl program
#!/usr/bin/perl -w
use strict;
# args: fileName className
# - className must contain '::'
my $className = pop;
@ARGV == 1 and ($className ||= '') =~ /::/ or exit 1;
warn "repair: @ARGV $className\n";
while (<>)
{
if (/^Class\s*$/) {
print;
$_ = <>; # get and discard the next line
$_ = " $className\n";
}
print;
}
# ---------------------------------------------------------------- end-of-file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment