File: summarize_errors.pl

package info (click to toggle)
magma 2.9.0%2Bds-2
  • links: PTS, VCS
  • area: contrib
  • in suites: trixie
  • size: 83,212 kB
  • sloc: cpp: 709,115; fortran: 121,916; ansic: 32,343; python: 25,603; f90: 15,208; makefile: 942; xml: 253; csh: 232; sh: 203; perl: 104
file content (111 lines) | stat: -rwxr-xr-x 2,736 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#!/usr/bin/env perl
#
# parses Doxygen output_err and prints a more readable summary of it.
# Usage: ./summarize_errors.pl [output_err]
#
# @author Mark Gates

use strict;

my $file     = '';
my $func     = '';
my @notfound = ();
my @notdoc   = ();
my $notdoc   = 0;
my $count    = 0;

print <<EOT;
Notes:

"not found"      means \@param FOO exists in the doxygen documentation,
                 but the function has no argument FOO. Often this is a
                 spelling or capitalization error.

"not documented" means a function has an argument FOO,
                 but the doxygen documentation has no \@param FOO for it.

"unresolved reference" means in "\\ref FOO", FOO doesn't exist in any file
                 that Doxygen processed. This is expected with "make fast",
                 but not with "make".

"unrecognized"   means this script didn't recognize that line of Doxygen's output.
--------------------------------------------------
EOT


# --------------------------------------------------
sub output
{
	if ( $file ) {
		$count += 1;
		print "$file: $func()\n";
		if ( @notfound ) {
			print "    not found:      ", join( ", ", @notfound ), "\n";
		}
		if ( @notdoc ) {
			print "    not documented: ", join( ", ", @notdoc   ), "\n";
		}
		print "\n";
	}
	$file     = '';
	@notfound = ();
	@notdoc   = ();
}


# --------------------------------------------------
sub pathsplit
{
	my( $path ) = @_;
	my($dir, $file) = $path =~ m|^(\S+)/([^ /]+)$|;
	return ($dir, $file);
}


# --------------------------------------------------
my $errfile = shift || 'output_err';
open( FILE, $errfile ) or die( $! );
while( <FILE> ) {
	if ( $notdoc and m/^ +parameter '(\w+)'/ ) {
		#print "$.: param\n";
		push @notdoc, $1;
	}
	elsif ( m/^(\S+):\d+: warning: unable to resolve reference to `(\w+)'/ ) {
		print "    unresolved reference:     $2\n";
	}
	elsif ( m/^(\S+):\d+: warning: argument '(\w+)' of command \@param is not found in the argument list of (\w+)/ ) {
		#print "$.: not found\n";
		my $path = $1;
		my $arg  = $2;
		my $newfunc = $3;
		my ($dir, $newfile) = pathsplit( $path );
		if ( $newfile ne $file or $newfunc ne $func ) {
			output();
			$file = $newfile;
			$func = $newfunc;
		}
		push @notfound, $arg;
		$notdoc = 0;
	}
	elsif ( m/^(\S+):\d+: warning: The following parameters of (\w+).* are not documented:/ ) {
		#print "$.: not doc\n";
		my $path = $1;
		my $newfunc = $2;
		my ($dir, $newfile) = pathsplit( $path );
		if ( $newfile ne $file or $newfunc ne $func ) {
			output();
			$file = $newfile;
			$func = $newfunc;
		}
		$notdoc = 1;
		# see if ( $notdoc ... ) above to accumulate @notdoc
	}
	else {
		print "Unrecognized: $.: $_";
	}
}

if ( $file ) {
	output();
}
#print "count $count\n";