svn: /phpdoc/doc-base/trunk/scripts/ check-underdocumented.php
| From: | Philip Olson | Date: | Sat, 12 Feb 2011 19:31:46 +0000 |
| Subject: | svn: /phpdoc/doc-base/trunk/scripts/ check-underdocumented.php | ||
| Groups: | php.doc.cvs | ||
| Request: | Send a blank email to doc-cvs+get-7770@lists.php.net to get a copy of this message | ||
philip Sat, 12 Feb 2011 19:31:46 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=308297
Log:
Added script that checks for underdocumented (warn.undocumended.func) PHP documentation.
Changed paths:
A phpdoc/doc-base/trunk/scripts/check-underdocumented.php
Added: phpdoc/doc-base/trunk/scripts/check-underdocumented.php
===================================================================
--- phpdoc/doc-base/trunk/scripts/check-underdocumented.php (rev 0)
+++ phpdoc/doc-base/trunk/scripts/check-underdocumented.php 2011-02-12 19:31:46 UTC (rev 308297)
@@ -0,0 +1,67 @@
+<?php
+error_reporting(-1);
+/*
+Introduction:
+This script checks for undocumented stuff. Currently this means anything that
+uses that 'warn.undocumented.func' entity, which are underdocumented methods/functions.
+
+Note: This script will eventually be folded into docweb and be deprecated. However, it's
+nice/simple to run it without a docweb setup so works okay for now.
+
+Help:
+$ Run this script.
+*/
+
+// p: path to phpdoc/en
+// h: help
+$opts = getopt('p:h::');
+
+if (!empty($opts['h']) || empty($opts['p'])) {
+ usage();
+}
+
+$phpdoc_path = $opts['p'];
+
+if (!is_dir($phpdoc_path)) {
+ echo "Hey! This ($phpdoc_path) is not a directory!", PHP_EOL;
+ usage();
+ exit;
+}
+
+$undocumented = array();
+$count = 0;
+foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($phpdoc_path)) as $file) {
+
+ $filepath = $file->getPathname();
+ $filename = $file->getBasename();
+
+ if (strpos($filepath, '.svn')) {
+ continue;
+ }
+
+ if (!$file->isFile() || pathinfo($filepath, PATHINFO_EXTENSION) !== 'xml') {
+ continue;
+ }
+
+ $fileid = str_replace($phpdoc_path, '', $filepath);
+ $ext = strtok($fileid, DIRECTORY_SEPARATOR);
+
+ if (file_exists($phpdoc_path . $fileid)) {
+ $contents = file_get_contents($phpdoc_path . $fileid);
+ if (false !== strpos($contents, 'warn.undocumented.func')) {
+ $undocumented[$ext][] = $fileid;
+ ++$count;
+ }
+ continue;
+ }
+}
+
+echo 'List of undocumented functions/methods', PHP_EOL;
+print_r($undocumented);
+echo "Number undocumented: ", $count, PHP_EOL;
+
+function usage() {
+ echo PHP_EOL, 'USAGE:', PHP_EOL;
+ echo 'php ', $_SERVER['SCRIPT_FILENAME'], ' -p
/path/to/phpdoc/en/reference/', PHP_EOL;
+ exit;
+}
\ No newline at end of file
Property changes on: phpdoc/doc-base/trunk/scripts/check-underdocumented.php
___________________________________________________________________
Added: svn:keywords
+ Id Rev Revision Date LastChangedDate LastChangedRevision Author LastChangedBy HeadURL URL
Added: svn:eol-style
+ native