cvs: pear /PHP_CodeSniffer/CodeSniffer/Standards/PEAR/Sniffs/Commenting FileCommentSniff.php
| From: | Greg Sherwood | Date: | Tue, 02 Jan 2007 03:54:05 +0000 |
| Subject: | cvs: pear /PHP_CodeSniffer/CodeSniffer/Standards/PEAR/Sniffs/Commenting FileCommentSniff.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-43925@lists.php.net to get a copy of this message | ||
squiz Tue Jan 2 03:54:05 2007 UTC
Modified files:
/pear/PHP_CodeSniffer/CodeSniffer/Standards/PEAR/Sniffs/Commenting
FileCommentSniff.php
Log:
Added a warning if an unknown tag is found. Foreign characters are now allowed in author tag
comment.
http://cvs.php.net/viewvc.cgi/pear/PHP_CodeSniffer/CodeSniffer/Standards/PEAR/Sniffs/Commenting/FileCommentSniff.php?r1=1.4&r2=1.5&diff_format=u
Index: pear/PHP_CodeSniffer/CodeSniffer/Standards/PEAR/Sniffs/Commenting/FileCommentSniff.php
diff -u pear/PHP_CodeSniffer/CodeSniffer/Standards/PEAR/Sniffs/Commenting/FileCommentSniff.php:1.4
pear/PHP_CodeSniffer/CodeSniffer/Standards/PEAR/Sniffs/Commenting/FileCommentSniff.php:1.5
--- pear/PHP_CodeSniffer/CodeSniffer/Standards/PEAR/Sniffs/Commenting/FileCommentSniff.php:1.4 Tue
Dec 19 04:41:14 2006
+++ pear/PHP_CodeSniffer/CodeSniffer/Standards/PEAR/Sniffs/Commenting/FileCommentSniff.php Tue Jan
2 03:54:05 2007
@@ -10,7 +10,7 @@
* @author Marc McIntyre <mmcintyre@squiz.net>
* @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600)
* @license http://matrix.squiz.net/developer/tools/php_cs/licence
BSD Licence
- * @version CVS: $Id: FileCommentSniff.php,v 1.4 2006/12/19 04:41:14 squiz Exp $
+ * @version CVS: $Id: FileCommentSniff.php,v 1.5 2007/01/02 03:54:05 squiz Exp $
* @link http://pear.php.net/package/PHP_CodeSniffer
*/
@@ -158,6 +158,12 @@
$phpcsFile->addError($error, $commentStart + $newlineCount);
}
+ // Check for unknown/deprecated tags.
+ $unknownTags = $this->_fp->getUnknown();
+ foreach ($unknownTags as $errorTag) {
+ $error = ucfirst($errorTag['tag']).' tag is not allowed in file
comment';
+ $phpcsFile->addWarning($error, $commentStart + $errorTag['line']);
+ }
// Check the PHP Version.
if (strstr(strtolower($long), 'php version') === false) {
@@ -465,8 +471,8 @@
$local = '\da-zA-Z-_+';
// Dot character cannot be the first or last character in the local-part.
$local_middle = $local.'.\w';
- if (preg_match('/^[a-zA-Z]+(([\'\,\.\- ][a-zA-Z
])?[a-zA-Z]*)*\s+<(['.$local.']['.$local_middle.']*['.$local.']@[\da-zA-Z][-.\w]*[\da-zA-Z]\.[a-zA-Z]{2,7})>$/',
$content) === 0) {
- $error = 'Content of the author tag must be in the form "Author
Name <author@example.com>"';
+ if
(preg_match('/^([^<]*)\s+<(['.$local.']['.$local_middle.']*['.$local.']@[\da-zA-Z][-.\w]*[\da-zA-Z]\.[a-zA-Z]{2,7})>$/',
$content) === 0) {
+ $error = 'Content of the author tag must be in the form "Display
Name <username@example.com>"';
$this->_phpcsFile->addError($error, $errorPos);
}
} else {
@@ -559,7 +565,7 @@
$this->_phpcsFile->addError($error, $errorPos);
} else if ((strstr($content, 'CVS:')) === false) {
- $error = "Invalid version \"$content\" in file comment; Consider
\"CVS: \$Id: FileCommentSniff.php,v 1.4 2006/12/19 04:41:14 squiz Exp $\" instead.";
+ $error = "Invalid version \"$content\" in file comment; Consider
\"CVS: <cvs_id>\" instead.";
$this->_phpcsFile->addWarning($error, $errorPos);
}
}