Skip to content

Commit

Permalink
Merge branch 'master' into report-memory-improvements
Browse files Browse the repository at this point in the history
Conflicts:
	CodeSniffer/Reports/VersionControl.php
	package.xml
  • Loading branch information
gsherwood committed Nov 25, 2013
2 parents 580e888 + d26daa8 commit a362d45
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 6 deletions.
3 changes: 3 additions & 0 deletions CodeSniffer/CLI.php
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,9 @@ public function process($values=array())
{
if (empty($values) === true) {
$values = $this->getCommandLineValues();
} else {
$values = array_merge($this->getDefaults(), $values);
$this->values = $values;
}

if ($values['generator'] !== '') {
Expand Down
13 changes: 8 additions & 5 deletions CodeSniffer/Reports/VersionControl.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,12 @@ public function generateFileReport(
$blames = $this->getBlameContent($report['filename']);

foreach ($report['messages'] as $line => $lineErrors) {
$author = $this->getAuthor($blames[($line - 1)]);
if ($author === false) {
continue;
$author = 'Unknown';
if (isset($blames[($line - 1)]) === true) {
$blameAuthor = $this->getAuthor($blames[($line - 1)]);
if ($blameAuthor !== false) {
$author = $blameAuthor;
}
}

if (isset($this->_authorCache[$author]) === false) {
Expand Down Expand Up @@ -117,8 +120,8 @@ public function generateFileReport(
// all the lines that do not have errors.
foreach ($blames as $line) {
$author = $this->getAuthor($line);
if (false === $author) {
continue;
if ($author === false) {
$author = 'Unknown';
}

if (isset($this->_authorCache[$author]) === false) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -782,8 +782,9 @@ protected function processVersion($errorPos)
} else if (strstr($content, 'CVS:') === false
&& strstr($content, 'SVN:') === false
&& strstr($content, 'GIT:') === false
&& strstr($content, 'HG:') === false
) {
$error = 'Invalid version "%s" in file comment; consider "CVS: <cvs_id>" or "SVN: <svn_id>" or "GIT: <git_id>" instead';
$error = 'Invalid version "%s" in file comment; consider "CVS: <cvs_id>" or "SVN: <svn_id>" or "GIT: <git_id>" or "HG: <hg_id>" instead';
$data = array($content);
$this->currentFile->addWarning($error, $errorPos, 'InvalidVersion', $data);
}
Expand Down
40 changes: 40 additions & 0 deletions package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,17 @@ http://pear.php.net/dtd/package-2.0.xsd">
- Comment parser now supports non-English characters when splitting comment lines into words
-- Thanks to Nik Sun for the patch
- Exit statements are now recognised as valid closers for CASE and DEFAULT blocks
-- Thanks to Maksim Kochkin for the patch
- PHP_CodeSniffer_CLI::process() can now be passed an incomplete array of CLI values
-- Missing values will be set to the CLI defaults
-- Thanks to Maksim Kochkin for the patch
- Fixed bug #20093 : Bug with ternary operator token
- Fixed bug #20097 : CLI.php throws error in php 5.2
- Fixed bug #20100 : incorrect Function mysql() has been deprecated report
- Fixed bug #20119 : PHP warning: invalid argument to str_repeat() in SVN blame report with -s
- Fixed bug #20123 : PSR2 complains about an empty second statement in for-loop
- Fixed bug #20131 : PHP errors in svnblame report, if there are files not under version control
- Fixed bug #20133 : Allow "HG: hg_id" as value for @version tag
</notes>
<contents>
<dir name="/">
Expand Down Expand Up @@ -2458,6 +2465,39 @@ http://pear.php.net/dtd/package-2.0.xsd">
- Multi-file sniff support has been removed because they are too memory intensive
-- If you have a custom multi-file sniff, you can convert it into a standard sniff quite easily
-- See CodeSniffer/Standards/Generic/Sniffs/Classes/DuplicateClassNameSniff.php for an example
</notes>
</release>
<release>
<version>
<release>1.4.8</release>
<api>1.4.8</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<date>2013-11-26</date>
<license uri="https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt">BSD License</license>
<notes>
- Generic ScopeIndentSniff now allows for ignored tokens to be set via ruleset.xml files
-- E.g., to ignore comments, override a property using:
-- name="ignoreIndentationTokens" type="array" value="T_COMMENT,T_DOC_COMMENT"
- PSR2 standard now ignores comments when checking indentation rules
- Squiz OperatorSpacingSniff no longer throws errors for the ?: short ternary operator
-- Thanks to Antoine Musso for the patch
- Comment parser now supports non-English characters when splitting comment lines into words
-- Thanks to Nik Sun for the patch
- Exit statements are now recognised as valid closers for CASE and DEFAULT blocks
-- Thanks to Maksim Kochkin for the patch
- PHP_CodeSniffer_CLI::process() can now be passed an incomplete array of CLI values
-- Missing values will be set to the CLI defaults
-- Thanks to Maksim Kochkin for the patch
- Fixed bug #20097 : CLI.php throws error in php 5.2
- Fixed bug #20100 : incorrect Function mysql() has been deprecated report
- Fixed bug #20119 : PHP warning: invalid argument to str_repeat() in SVN blame report with -s
- Fixed bug #20123 : PSR2 complains about an empty second statement in for-loop
- Fixed bug #20131 : PHP errors in svnblame report, if there are files not under version control
- Fixed bug #20133 : Allow "HG: hg_id" as value for @version tag
</notes>
</release>
<release>
Expand Down

0 comments on commit a362d45

Please sign in to comment.