SonarQube PHP
  1. SonarQube PHP
  2. SONARPHP-52

Upgrade PDepend plugin to support PHP 5.4+ features like traits

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.1
    • Fix Version/s: 1.2
    • Component/s: None
    • Labels:
      None
    • Number of attachments :
      1

      Description

      I'm working with the last version of PHP Depend (1.1.0) which handles now the PHP Trait. I tried to apply PHPDepend (--summary-xml) to some code using Trait and then parse the xml files with Sonar Plugin. I have this error message :

      Element method of type org.sonar.plugins.php.phpdepend.summaryxml.MethodNode is not defined as field in type org.sonar.plugins.php.phpdepend.summaryxml.PackageNode

      As an attachment, you can find the (truncated) generated file. As you can see, directly under the package, there are the tree Trait methods.

      I tried to generate the report using --jdepend-xml but it seems that there's not jdepend option in sonar plugin.

      Let me know if my issue is not clear and I will add some details.

        Issue Links

          Activity

          Hide
          Sebastian Marek added a comment -

          Please see SONARPLUGINS-1351 for some more details about the type of report sonar supports now. In short:

          • phpunit-xml is deprecated since PHP Depend 0.10.5
          • summary-xml is now supported by Sonar PHP Plugin (>=1.1)

          Will have a look into traits support.

          Show
          Sebastian Marek added a comment - Please see SONARPLUGINS-1351 for some more details about the type of report sonar supports now. In short: phpunit-xml is deprecated since PHP Depend 0.10.5 summary-xml is now supported by Sonar PHP Plugin (>=1.1) Will have a look into traits support.
          Hide
          Jaroslav Povolný added a comment -

          Until solution is available, you can use my workaround here http://stackoverflow.com/questions/14254407/checking-php-5-4-code-with-sonar-fail

          Show
          Jaroslav Povolný added a comment - Until solution is available, you can use my workaround here http://stackoverflow.com/questions/14254407/checking-php-5-4-code-with-sonar-fail
          Hide
          Julien HENRY added a comment -

          Very basic support: pdepend parser should not fail. But I'm not sure metrics are correct regarding method count, depending on if trait is declared in a separate file or not. It also depends on the report type (phpunit/summary).

          I think pdepend should really add support of traits and have a <trait> element in the report (at the same level than <class>), and a "use trait count" attribute on classes. Then it will be up to us to decide what to do with the information (probably count a trait as a class in Sonar).

          Show
          Julien HENRY added a comment - Very basic support: pdepend parser should not fail. But I'm not sure metrics are correct regarding method count, depending on if trait is declared in a separate file or not. It also depends on the report type (phpunit/summary). I think pdepend should really add support of traits and have a <trait> element in the report (at the same level than <class>), and a "use trait count" attribute on classes. Then it will be up to us to decide what to do with the information (probably count a trait as a class in Sonar).
          Hide
          Fabrice Bellingard added a comment -

          Tested!

          Show
          Fabrice Bellingard added a comment - Tested!
          Hide
          Julien HENRY added a comment -

          IT added

          Show
          Julien HENRY added a comment - IT added

            People

            • Assignee:
              Julien HENRY
              Reporter:
              Anonymous
            • Votes:
              4 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: