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

  ID: 20378
  Updated by: gsherwood@squiz.net
  Reported By: ferdypruis@gmail.com
-Summary: Syntax error in XML report file
+Summary: Report appended to existing file if no errors found
                     in run
  Status: Open
  Type: Bug
  Package: PHP_CodeSniffer
  Operating System: CentOS
  Package Version: 1.5.4
  PHP Version: Irrelevant
-Assigned To:
+Assigned To: squiz
  Roadmap Versions:
  New Comment:

-Summary: Syntax error in XML report file
+Summary: Report appended to existing file if no errors
               found in run
-Assigned To:
+Assigned To: squiz



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

[2014-08-29 10:00:36] ferdyp

Description:
------------
When using the checkstyle-format and writing to a report-file, each run
no
errors are found a new report is nested inside the existing report,
resulting in
invalid XML.

I ran into this problem while using Jenkins, which fails to parse the
XML
report for all projects that lack codestyle-errors.

Test script:
---------------
Run this command;
phpcs --report=checkstyle --report-checkstyle=/tmp/phpcs/report
/tmp/phpcs/example.php

Where '/tmp/phpcs/example.php' is completely empty or otherwise contains
no errors for the sniffs that are used.

The first run the report file is ok. Each consecutive run duplicate
nodes are added, corrupting the XML structure.

This only occurs when not a single error or warning is found, checkstyle
formatting is used, and a previous report file already exists.

Expected result:
----------------
/tmp/phpcs/report:
<?xml version="1.0" encoding="UTF-8"?>
<checkstyle version="1.5.4">
</checkstyle>

Actual result:
--------------
/tmp/phpcs/report:
<?xml version="1.0" encoding="UTF-8"?>
<checkstyle version="1.5.4">
<?xml version="1.0" encoding="UTF-8"?>
<checkstyle version="1.5.4">
</checkstyle>
</checkstyle>

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

Search Discussions

  • Gsherwood at Aug 31, 2014 at 10:54 pm
    Edit report at https://pear.php.net/bugs/bug.php?id=20378&edit=1

      ID: 20378
      Updated by: gsherwood@squiz.net
      Reported By: ferdypruis@gmail.com
      Summary: Report appended to existing file if no errors found
                         in run
    -Status: Assigned
    +Status: Closed
      Type: Bug
      Package: PHP_CodeSniffer
      Operating System: CentOS
      Package Version: 1.5.4
      PHP Version: Irrelevant
      Assigned To: squiz
      Roadmap Versions:
      New Comment:

    -Status: Assigned
    +Status: Closed
    This was a general error for all report types, but most notable in the
    ones that output
    some content even when nothing is found. Fix is committed here:
    https://github.com/squizlabs/PHP_CodeSniffer/commit/933bd158d79247993bdf6e547c
    55fcdcbefa6b3e


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

    [2014-09-01 00:53:51] squiz

    -Summary: Syntax error in XML report file
    +Summary: Report appended to existing file if no errors
                   found in run
    -Assigned To:
    +Assigned To: squiz


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

    [2014-08-29 10:00:36] ferdyp

    Description:
    ------------
    When using the checkstyle-format and writing to a report-file, each run
    no
    errors are found a new report is nested inside the existing report,
    resulting in
    invalid XML.

    I ran into this problem while using Jenkins, which fails to parse the
    XML
    report for all projects that lack codestyle-errors.

    Test script:
    ---------------
    Run this command;
    phpcs --report=checkstyle --report-checkstyle=/tmp/phpcs/report
    /tmp/phpcs/example.php

    Where '/tmp/phpcs/example.php' is completely empty or otherwise contains
    no errors for the sniffs that are used.

    The first run the report file is ok. Each consecutive run duplicate
    nodes are added, corrupting the XML structure.

    This only occurs when not a single error or warning is found, checkstyle
    formatting is used, and a previous report file already exists.

    Expected result:
    ----------------
    /tmp/phpcs/report:
    <?xml version="1.0" encoding="UTF-8"?>
    <checkstyle version="1.5.4">
    </checkstyle>

    Actual result:
    --------------
    /tmp/phpcs/report:
    <?xml version="1.0" encoding="UTF-8"?>
    <checkstyle version="1.5.4">
    <?xml version="1.0" encoding="UTF-8"?>
    <checkstyle version="1.5.4">
    </checkstyle>
    </checkstyle>

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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppear-bugs @
categoriesphp
postedAug 31, '14 at 10:53p
activeAug 31, '14 at 10:54p
posts2
users1
websitepear.php.net

1 user in discussion

Gsherwood: 2 posts

People

Translate

site design / logo © 2022 Grokbase