FAQ
Edit report at http://pear.php.net/bugs/bug.php?id=18246&edit=1

ID: 18246
Updated by: gsherwood@squiz.net
Reported By: ntoniazzi at profideo dot com
Summary: Svnblame error on local modification
Status: Open
Type: Bug
Package: PHP_CodeSniffer
Operating System: Linux
Package Version: 1.3.0RC2
PHP Version: 5.3.3
-Assigned To:
+Assigned To: squiz
Roadmap Versions:
New Comment:

-Assigned To:
+Assigned To: squiz
The SVN Blame report is designed to be run on checked out code to give a
daily report (or similar) for developers. You don't want to be running
it on code before you check in, but it still shouldn't give any errors.
I'll get it fixed up.


Previous Comments:
------------------------------------------------------------------------

[2011-02-07 15:36:21] ntoniazzi

Description:
------------
Not sure if it's really a bug or an unproper use of this report. I'm
running the Svnblame report on a local modification of a file (SVN).
The command "svn blame" cannot show modifications (lines added) of
not-yet-commited changes.
Thus, I get those notices :
Notice: Undefined offset: <n> in [...]/VersionControl.php on line 69

It could be possible to retrieve the local username, or simply add a
array_key_exists check.

------------------------------------------------------------------------

Search Discussions

  • Gsherwood at Feb 7, 2011 at 11:29 pm
    Edit report at http://pear.php.net/bugs/bug.php?id=18246&edit=1

    ID: 18246
    Updated by: gsherwood@squiz.net
    Reported By: ntoniazzi at profideo dot com
    Summary: Svnblame error on local modification
    -Status: Assigned
    +Status: Wont fix
    Type: Bug
    Package: PHP_CodeSniffer
    Operating System: Linux
    Package Version: 1.3.0RC2
    PHP Version: 5.3.3
    Assigned To: squiz
    Roadmap Versions:
    New Comment:

    -Status: Assigned
    +Status: Wont fix
    Actually, I don't think I can fix this up. The SVN Blame report will
    never work on a locally modified file because the svn blame command only
    returns the file content from the repo. So none of your changes are in
    there.

    This means that if you've added a line between lines 12 and 13 and you
    have an error there, the error will appear to PHPCS on live 13 but svn
    blame will give me the author of line 13 in the repo. So the report will
    actually be incorrect.

    I suspect the error you are getting is not because the author is not
    know, but because there are now more lines in the file than in the
    repo.

    Sorry, but I wont be fixing this one for now. I can't get any sort of
    accurate result.


    Previous Comments:
    ------------------------------------------------------------------------

    [2011-02-07 23:54:25] squiz

    -Assigned To:
    +Assigned To: squiz
    The SVN Blame report is designed to be run on checked out code to give a
    daily report (or similar) for developers. You don't want to be running
    it on code before you check in, but it still shouldn't give any errors.
    I'll get it fixed up.

    ------------------------------------------------------------------------

    [2011-02-07 15:36:21] ntoniazzi

    Description:
    ------------
    Not sure if it's really a bug or an unproper use of this report. I'm
    running the Svnblame report on a local modification of a file (SVN).
    The command "svn blame" cannot show modifications (lines added) of
    not-yet-commited changes.
    Thus, I get those notices :
    Notice: Undefined offset: <n> in [...]/VersionControl.php on line 69

    It could be possible to retrieve the local username, or simply add a
    array_key_exists check.

    ------------------------------------------------------------------------
  • Ntoniazzi at Feb 8, 2011 at 8:37 am
    Edit report at http://pear.php.net/bugs/bug.php?id=18246&edit=1

    ID: 18246
    Comment by: ntoniazzi@profideo.com
    Reported By: ntoniazzi at profideo dot com
    Summary: Svnblame error on local modification
    Status: Wont fix
    Type: Bug
    Package: PHP_CodeSniffer
    Operating System: Linux
    Package Version: 1.3.0RC2
    PHP Version: 5.3.3
    Assigned To: squiz
    Roadmap Versions:
    New Comment:

    Here is a simple patch, just to remove the Notice.

    Around line 69 in Reports/VersionControl.php:
    - $author = $this->getAuthor($blames[($line - 1)]);
    + if (array_key_exists($line - 1, $blames)) {
    + $author = $this->getAuthor($blames[($line - 1)]);
    + }
    + else {
    + continue;
    + }

    Problem is that $blames contains only the lines that have already be
    committed, and newly added lines may have errors.


    Previous Comments:
    ------------------------------------------------------------------------

    [2011-02-08 00:32:22] squiz

    -Status: Assigned
    +Status: Wont fix
    Actually, I don't think I can fix this up. The SVN Blame report will
    never work on a locally modified file because the svn blame command only
    returns the file content from the repo. So none of your changes are in
    there.

    This means that if you've added a line between lines 12 and 13 and you
    have an error there, the error will appear to PHPCS on live 13 but svn
    blame will give me the author of line 13 in the repo. So the report will
    actually be incorrect.

    I suspect the error you are getting is not because the author is not
    know, but because there are now more lines in the file than in the
    repo.

    Sorry, but I wont be fixing this one for now. I can't get any sort of
    accurate result.

    ------------------------------------------------------------------------

    [2011-02-07 23:54:25] squiz

    -Assigned To:
    +Assigned To: squiz
    The SVN Blame report is designed to be run on checked out code to give a
    daily report (or similar) for developers. You don't want to be running
    it on code before you check in, but it still shouldn't give any errors.
    I'll get it fixed up.

    ------------------------------------------------------------------------

    [2011-02-07 15:36:21] ntoniazzi

    Description:
    ------------
    Not sure if it's really a bug or an unproper use of this report. I'm
    running the Svnblame report on a local modification of a file (SVN).
    The command "svn blame" cannot show modifications (lines added) of
    not-yet-commited changes.
    Thus, I get those notices :
    Notice: Undefined offset: <n> in [...]/VersionControl.php on line 69

    It could be possible to retrieve the local username, or simply add a
    array_key_exists check.

    ------------------------------------------------------------------------
  • Gsherwood at Feb 8, 2011 at 10:03 am
    Edit report at http://pear.php.net/bugs/bug.php?id=18246&edit=1

    ID: 18246
    Updated by: gsherwood@squiz.net
    Reported By: ntoniazzi at profideo dot com
    Summary: Svnblame error on local modification
    Status: Wont fix
    Type: Bug
    Package: PHP_CodeSniffer
    Operating System: Linux
    Package Version: 1.3.0RC2
    PHP Version: 5.3.3
    Assigned To: squiz
    Roadmap Versions:
    New Comment:

    I'm not going to apply the patch because its probably better that the
    report generate an error with local modifications because the report is
    actually 100% wrong when you have local modifications. That's the reason
    this bug is marked as Wont Fix. It's not a technical issue with
    suppressing error messages.


    Previous Comments:
    ------------------------------------------------------------------------

    [2011-02-08 09:40:10] ntoniazzi

    Here is a simple patch, just to remove the Notice.

    Around line 69 in Reports/VersionControl.php:
    - $author = $this->getAuthor($blames[($line - 1)]);
    + if (array_key_exists($line - 1, $blames)) {
    + $author = $this->getAuthor($blames[($line - 1)]);
    + }
    + else {
    + continue;
    + }

    Problem is that $blames contains only the lines that have already be
    committed, and newly added lines may have errors.

    ------------------------------------------------------------------------

    [2011-02-08 00:32:22] squiz

    -Status: Assigned
    +Status: Wont fix
    Actually, I don't think I can fix this up. The SVN Blame report will
    never work on a locally modified file because the svn blame command only
    returns the file content from the repo. So none of your changes are in
    there.

    This means that if you've added a line between lines 12 and 13 and you
    have an error there, the error will appear to PHPCS on live 13 but svn
    blame will give me the author of line 13 in the repo. So the report will
    actually be incorrect.

    I suspect the error you are getting is not because the author is not
    know, but because there are now more lines in the file than in the
    repo.

    Sorry, but I wont be fixing this one for now. I can't get any sort of
    accurate result.

    ------------------------------------------------------------------------

    [2011-02-07 23:54:25] squiz

    -Assigned To:
    +Assigned To: squiz
    The SVN Blame report is designed to be run on checked out code to give a
    daily report (or similar) for developers. You don't want to be running
    it on code before you check in, but it still shouldn't give any errors.
    I'll get it fixed up.

    ------------------------------------------------------------------------

    [2011-02-07 15:36:21] ntoniazzi

    Description:
    ------------
    Not sure if it's really a bug or an unproper use of this report. I'm
    running the Svnblame report on a local modification of a file (SVN).
    The command "svn blame" cannot show modifications (lines added) of
    not-yet-commited changes.
    Thus, I get those notices :
    Notice: Undefined offset: <n> in [...]/VersionControl.php on line 69

    It could be possible to retrieve the local username, or simply add a
    array_key_exists check.

    ------------------------------------------------------------------------

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppear-bugs @
categoriesphp
postedFeb 7, '11 at 10:52p
activeFeb 8, '11 at 10:03a
posts4
users2
websitepear.php.net

2 users in discussion

Gsherwood: 3 posts Ntoniazzi: 1 post

People

Translate

site design / logo © 2022 Grokbase