[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: playground/devtools/krazy/plugins
From: Allen Winter <winter () kde ! org>
Date: 2006-05-10 13:11:36
Message-ID: 1147266696.856879.1943.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 539350 by winterz:
put this back. somehow doxytags.0 got overwritten with doxygenation.
M +38 -71 doxytags.0
--- trunk/playground/devtools/krazy/plugins/doxytags.0 #539349:539350
@@ -1,7 +1,7 @@
#!/usr/bin/perl -w
###############################################################################
# Sanity check plugin for the 'krazy' project. #
-# Copyright (C) 2005-2006 by Allen Winter <winter@kde.org> #
+# Copyright (C) 2006 by Allen Winter <winter@kde.org> #
# #
# This program is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
@@ -19,13 +19,14 @@
# #
###############################################################################
-# Tests KDE source for minimum set of doxygen tags
+# Tests KDE source for unwanted doxygen tags in major releases.
# Program options:
# --help: print one-line help message and exit
# --version: print one-line version information and exit
# --explain: print an explanation with solving instructions, then exit
-# --extension: exit unless this value matches the program name's extension# \
--quiet: suppress all output messages +# --extension: exit unless this \
value matches the program name's extension +# --quiet: suppress all output \
messages # --verbose: print the offending content
# Exits with status=0 if test condition is not present in the source;
@@ -34,8 +35,8 @@
use strict;
use Getopt::Long;
-my($Prog) = "doxygenation";
-my($Version) = "1.1";
+my($Prog) = "doxytags.0";
+my($Version) = "1.0";
my($help) = '';
my($version) = '';
@@ -53,84 +54,50 @@
&Version() if $version;
&Explain() if $explain;
if ($#ARGV != 0){ &Help(); exit 0; }
+if ($extension eq "") {
+ print "Required option --extension not provided.\n" if ($verbose);
+ exit 1;
+}
-# look for @file near the top
-my($f) = $ARGV[0];
-if ($verbose) {
- print "----- header -----\n";
- print `head -n 100 $f| sed 's/ / /g;s/\$/ /g;s#//##g' | tr -d -c ' \
A-Za-z.,/\@1-9()'`."\n";
- print "--- end header ---\n";
+#check extension.
+my($fred,$ext) = split('\.',$Prog);
+if ($ext ne "") {
+ if ($ext ne $extension) {
+ print "Extension mis-match (expecting --extension=$ext).\n" if ($verbose);
+ exit 1;
+ }
}
-open(F, "<$f") || die "Couldn't open $f";
-my(@c) = <F>;
-my($htxt) = join '', @c[0.. ($#c > 99 ? 99 : $#c)];
-my($atfile) = &checkAtFile($htxt);
-my($atauthor) = &checkAtAuthor($htxt);
-close(F);
-my($tags) = "";
+my($f) = $ARGV[0];
+open(F, "$f") || die "Couldn't open $f";
my($cnt) = 0;
-if ($atfile eq "UNKNOWN") {
- $tags .= "\@file ";
- $cnt++;
+my($linecnt) = 0;
+my($line);
+my($lstr) = "";
+while ($line = <F>) {
+ $linecnt++;
+ if ($line =~ m/\@since/ || $line =~ m/\@deprecated/) {
+ $cnt++;
+ if ($cnt == 1) {
+ $lstr = "line\#" . $linecnt;
+ } else {
+ $lstr = $lstr . "," . $linecnt;
+ }
+ print "=> $line" if ($verbose);
+ }
}
-if ($atauthor eq "UNKNOWN") {
- $tags .= "\@author ";
- $cnt++;
-}
+close(F);
-if (! $tags ) {
+if (!$cnt) {
print "okay\n" if (!$quiet);
exit 0;
} else {
- print "missing tags: $tags ($cnt)\n" if (!$quiet);
+ print "$lstr ($cnt)\n" if (!$quiet);
exit $cnt;
}
-sub checkAtFile($)
-{
- my($text) = @_;
- $text =~ s/^\#//g;
- $text =~ y/\t\n\r/ /;
- $text =~ y/ A-Za-z.,@1-9\(\)//cd;
- $text =~ s/\s+/ /g;
-
- my($atfile);
-
- $atfile = "";
- $atfile = "GENERATED FILE" if ($text =~ /(changes made in this file will be \
lost|DO NOT EDIT|DO NOT delete this file|[Gg]enerated by)/);
- if (!$atfile) {
- $atfile = "UNKNOWN" if ($text !~ /\@file/);
- } else {
- $atfile = "GOT IT";
- }
-
- return "$atfile";
-}
-
-sub checkAtAuthor($)
-{
- my($text) = @_;
- $text =~ s/^\#//g;
- $text =~ y/\t\n\r/ /;
- $text =~ y/ A-Za-z.,@1-9\(\)//cd;
- $text =~ s/\s+/ /g;
-
- my($atauthor);
-
- $atauthor = "";
- $atauthor = "GENERATED FILE" if ($text =~ /(changes made in this file will be \
lost|DO NOT EDIT|DO NOT delete this file|[Gg]enerated by)/);
- if (!$atauthor) {
- $atauthor = "UNKNOWN" if ($text !~ /\@author/);
- } else {
- $atauthor = "GOT IT";
- }
-
- return "$atauthor";
-}
-
sub Help {
- print "Check for minimum set of required doxygen tags\n";
+ print "Check for unwanted doxygen tags in major versions\n";
exit 0 if $help;
}
@@ -140,6 +107,6 @@
}
sub Explain {
- print "A (poor) attempt at determing if a specific set of Doxygen tags are present \
in a source file. Not sure how to use this yet. Ignore for now.\n"; + print "The \
\"\@since\" and \"\@deprecated\" doxygen tags should not be used in the API \
documention for major versions (i.e. 4.0). Please remove those tags.\n"; exit 0 if \
$explain; }
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic