cvs: pear /PHP_CodeSniffer/CodeSniffer/Standards/Squiz/Sniffs/Commenting FileCommentSniff.php
| From: | Greg Sherwood | Date: | Fri, 12 Jan 2007 02:52:14 +0000 |
| Subject: | cvs: pear /PHP_CodeSniffer/CodeSniffer/Standards/Squiz/Sniffs/Commenting FileCommentSniff.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-44190@lists.php.net to get a copy of this message | ||
squiz Fri Jan 12 02:52:14 2007 UTC
Modified files:
/pear/PHP_CodeSniffer/CodeSniffer/Standards/Squiz/Sniffs/Commenting
FileCommentSniff.php
Log:
Updated error messages to include a '@' sign for tags
http://cvs.php.net/viewvc.cgi/pear/PHP_CodeSniffer/CodeSniffer/Standards/Squiz/Sniffs/Commenting/FileCommentSniff.php?r1=1.5&r2=1.6&diff_format=u
Index: pear/PHP_CodeSniffer/CodeSniffer/Standards/Squiz/Sniffs/Commenting/FileCommentSniff.php
diff -u pear/PHP_CodeSniffer/CodeSniffer/Standards/Squiz/Sniffs/Commenting/FileCommentSniff.php:1.5
pear/PHP_CodeSniffer/CodeSniffer/Standards/Squiz/Sniffs/Commenting/FileCommentSniff.php:1.6
--- pear/PHP_CodeSniffer/CodeSniffer/Standards/Squiz/Sniffs/Commenting/FileCommentSniff.php:1.5 Thu
Jan 11 04:34:59 2007
+++ pear/PHP_CodeSniffer/CodeSniffer/Standards/Squiz/Sniffs/Commenting/FileCommentSniff.php Fri Jan
12 02:52:14 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.5 2007/01/11 04:34:59 squiz Exp $
+ * @version CVS: $Id: FileCommentSniff.php,v 1.6 2007/01/12 02:52:14 squiz Exp $
* @link http://pear.php.net/package/PHP_CodeSniffer
*/
@@ -183,7 +183,7 @@
$unknownTags = $this->commentParser->getUnknown();
foreach ($unknownTags as $errorTag) {
// Unknown tags are not parsed, do not process further.
- $error = ucfirst($errorTag['tag']).' tag is not allowed in file
comment';
+ $error = "@$errorTag[tag] tag is not allowed in file comment";
$phpcsFile->addWarning($error, ($commentStart + $errorTag['line']));
}
@@ -223,7 +223,7 @@
// Required tag missing.
if (in_array($tag, $foundTags) === false) {
- $error = "Missing required $tag tag in file comment";
+ $error = "Missing @$tag tag in file comment";
$this->currentFile->addError($error, $commentEnd);
continue;
}
@@ -249,7 +249,7 @@
// Make sure there is no duplicate tag.
$foundIndexes = array_keys($foundTags, $tag);
if (count($foundIndexes) > 1) {
- $error = "Only 1 $tag tag is allowed in file comment";
+ $error = "Only 1 @$tag tag is allowed in file comment";
$this->currentFile->addError($error, $errorPos);
}
@@ -257,7 +257,7 @@
if ($foundIndexes[0] > $orderIndex) {
$orderIndex = $foundIndexes[0];
} else {
- $error = "The order of $tag tag is wrong in file comment";
+ $error = "The order of @$tag tag is wrong in file comment";
$this->currentFile->addError($error, $errorPos);
}
@@ -292,7 +292,7 @@
if ($indentInfo['space'] !== 0 && $indentInfo['space'] !==
($longestTag + 1)) {
$expected = ($longestTag - strlen($indentInfo['tag']) + 1);
$space = ($indentInfo['space'] -
strlen($indentInfo['tag']));
- $error = ucfirst($indentInfo['tag']).' tag comment indented
incorrectly. ';
+ $error = "@$indentInfo[tag] tag comment indented incorrectly. ";
$error .= "Expected $expected spaces but found $space.";
$this->currentFile->addError($error, $indentInfo['errorPos']);
}
@@ -339,7 +339,7 @@
if ($version !== null) {
$content = $version->getContent();
if (empty($content) === true) {
- $error = 'Content missing for version tag in file comment';
+ $error = 'Content missing for @version tag in file comment';
$this->currentFile->addError($error, $errorPos);
} else if ($content !== '%release_version%') {
if (preg_match('/^([0-9]+)\.([0-9]+)\.([0-9]+)/', $content) === 0) {
@@ -366,7 +366,7 @@
if ($package !== null) {
$content = $package->getContent();
if (empty($content) === true) {
- $error = 'Content missing for package tag in file comment';
+ $error = 'Content missing for @package tag in file comment';
$this->currentFile->addError($error, $errorPos);
} else if ($content !== 'MySource4') {
$error = 'Expected "MySource4" for package name';
@@ -390,7 +390,7 @@
if ($subpackage !== null) {
$content = $subpackage->getContent();
if (empty($content) === true) {
- $error = 'Content missing for subpackage tag in file comment';
+ $error = 'Content missing for @subpackage tag in file comment';
$this->currentFile->addError($error, $errorPos);
} else if (PHP_CodeSniffer::isUnderscoreName($content) !== true) {
// Subpackage name must be properly camel-cased.
@@ -425,7 +425,7 @@
$author = $authors[0];
$content = $author->getContent();
if (empty($content) === true) {
- $error = 'Content missing for author tag in file comment';
+ $error = 'Content missing for @author tag in file comment';
$this->currentFile->addError($error, $errorPos);
} else if ($content !== 'Squiz Pty Ltd <mysource4@squiz.net>') {
$error = 'Expected "Squiz Pty Ltd <mysource4@squiz.net>" for
author tag';
@@ -449,7 +449,7 @@
if ($copyright !== null) {
$content = $copyright->getContent();
if (empty($content) === true) {
- $error = 'Content missing for copyright tag in file comment';
+ $error = 'Content missing for @copyright tag in file comment';
$this->currentFile->addError($error, $errorPos);
} else if (preg_match('/^([0-9]{4})-([0-9]{4})? (Squiz Pty Ltd \(ABN 77 084 670
600\))$/', $content) === 0) {
@@ -475,12 +475,12 @@
$url = $license->getValue();
$content = $license->getComment();
if (empty($url) === true && empty($content) === true) {
- $error = 'Content missing for license tag in file comment';
+ $error = 'Content missing for @license tag in file comment';
$this->currentFile->addError($error, $errorPos);
} else {
// Check for license URL.
if (empty($url) === true) {
- $error = 'License URL missing for license tag in file comment';
+ $error = 'License URL missing for @license tag in file comment';
$this->currentFile->addError($error, $errorPos);
} else if ($url !== 'http://matrix.squiz.net/licence') {
$error = 'Expected "http://matrix.squiz.net/licence" for license
URL';
@@ -489,7 +489,7 @@
// Check for license name.
if (empty($content) === true) {
- $error = 'License name missing for license tag in file comment';
+ $error = 'License name missing for @license tag in file comment';
$this->currentFile->addError($error, $errorPos);
} else if ($content !== 'Squiz.Net Open Source Licence') {
$error = 'Expected "Squiz.Net Open Source Licence" for license
name';