Details

    • Type: New Feature New Feature
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.2
    • Component/s: None
    • Labels:
      None
    • Number of attachments :
      2

      Description

      Useful PHP libraries :

      • PHPUnit : unit tests, code coverage and software metrics
      • PHP_CodeSniffer : code and detects violations of a defined set of coding standards
      • PHP under control : PHP continuous integration into cruisecontrol

      Article on PHP and software metrics by Sebastian Bergmann

      1. Money.tar.gz
        4 kB
        Sebastian Bergmann
      2. Money.tar.gz
        9 kB
        Sebastian Bergmann

        Activity

        Hide
        Simon Brandhof added a comment -

        Forum PHP Paris 2008 is on december.Two sessions are about PHP code analysis :

        • Automatiser les rapports sur la qualité du code
        • Static and Dynamic Analysis at Ning

        I hope slides will be published.

        Show
        Simon Brandhof added a comment - Forum PHP Paris 2008 is on december.Two sessions are about PHP code analysis : Automatiser les rapports sur la qualité du code Static and Dynamic Analysis at Ning I hope slides will be published.
        Hide
        Simon Brandhof added a comment -

        Thanks to Sebastian Bergmann for the following details :

        Both Apache Ant and Maven are used in the PHP world. We also have
        Phing [1] which is a port of Apache Ant to PHP.

        PHP_Depend [2] and PHP_CodeSniffer [3] calculate software metrics
        such as Cyclomatic Complexity, NPath Complexity, and the likes.

        PHP_Depend produces JDepend XML (and in the future PMD XML),
        PHP_CodeSniffer produces Checkstyle XML.

        PHP_CodeSniffer [3] performs a static code analysis for coding
        standard violations, bug patterns, etc.

        PHPUnit [4] has support for software metrics and can write violation
        reports in PMD XML format. This feature does not belong into a unit
        test framework, though, which is why it is currently moved out of
        PHPUnit. In the future, PHP_Depend [2] will produce PMD-style logfile.
        See [5] for details.

        PHPUnit [4] produces unit test results in JUnit XML and code coverage
        data in Clover XML as well as an HTML report of code coverage.

        [1] http://phing.info/
        [2] http://pdepend.org/
        [3] http://pear.php.net/package/PHP_CodeSniffer
        [4] http://www.phpunit.de/
        [5] http://tinyurl.com/7dv44l

        Show
        Simon Brandhof added a comment - Thanks to Sebastian Bergmann for the following details : Both Apache Ant and Maven are used in the PHP world. We also have Phing [1] which is a port of Apache Ant to PHP. PHP_Depend [2] and PHP_CodeSniffer [3] calculate software metrics such as Cyclomatic Complexity, NPath Complexity, and the likes. PHP_Depend produces JDepend XML (and in the future PMD XML), PHP_CodeSniffer produces Checkstyle XML. PHP_CodeSniffer [3] performs a static code analysis for coding standard violations, bug patterns, etc. PHPUnit [4] has support for software metrics and can write violation reports in PMD XML format. This feature does not belong into a unit test framework, though, which is why it is currently moved out of PHPUnit. In the future, PHP_Depend [2] will produce PMD-style logfile. See [5] for details. PHPUnit [4] produces unit test results in JUnit XML and code coverage data in Clover XML as well as an HTML report of code coverage. [1] http://phing.info/ [2] http://pdepend.org/ [3] http://pear.php.net/package/PHP_CodeSniffer [4] http://www.phpunit.de/ [5] http://tinyurl.com/7dv44l
        Hide
        Sebastian Bergmann added a comment -

        sb@ubuntu ~ % tar xvfz Money.tar.gz
        Money/
        Money/Money.php
        Money/IMoney.php
        Money/MoneyTest.php
        Money/build/
        Money/build/logs/
        Money/build/logs/jdepend.xml
        Money/build/logs/checkstyle.xml
        Money/build/logs/clover.xml
        Money/build/logs/pdepend.xml
        Money/build/logs/junit.xml
        Money/build.xml
        Money/MoneyBag.php
        sb@ubuntu ~ % cd Money
        sb@ubuntu Money % ant
        Unable to locate tools.jar. Expected to find it in /usr/lib/jvm/java-6-openjdk/lib/tools.jar
        Buildfile: build.xml

        clean:
        [delete] Deleting directory /home/sb/Money/build

        prepare:
        [mkdir] Created dir: /home/sb/Money/build/logs

        phpunit:
        [exec] PHPUnit @package_version@ by Sebastian Bergmann.
        [exec]
        [exec] ......................
        [exec]
        [exec] Time: 0 seconds
        [exec]
        [exec] OK (22 tests, 34 assertions)
        [exec]
        [exec] Writing code coverage data to XML file, this may take a moment.

        phpcs:
        [exec] Result: 1

        pdepend:
        [exec] PHP_Depend 0.9.2 by Manuel Pichler
        [exec]
        [exec] Parsing source files:
        [exec] .... 4
        [exec]
        [exec] Executing NodeLoc-Analyzer:
        [exec] ... 75
        [exec]
        [exec] Executing CodeRank-Analyzer:
        [exec] 8
        [exec]
        [exec] Executing CyclomaticComplexity-Analyzer:
        [exec] ... 71
        [exec]
        [exec] Executing ClassLevel-Analyzer:
        [exec] ... 68
        [exec]
        [exec] Executing Hierarchy-Analyzer:
        [exec] ... 77
        [exec]
        [exec] Executing NPathComplexity-Analyzer:
        [exec] ... 71
        [exec]
        [exec] Executing Dependency-Analyzer:
        [exec] ... 71
        [exec]
        [exec] Executing NodeCount-Analyzer:
        [exec] ... 68
        [exec]
        [exec] Executing Inheritance-Analyzer:
        [exec] 20
        [exec]
        [exec] Executing Coupling-Analyzer:
        [exec] .... 86
        [exec]
        [exec] Generating pdepend log files, this may take a moment.

        build:

        BUILD SUCCESSFUL
        Total time: 3 seconds

        Show
        Sebastian Bergmann added a comment - sb@ubuntu ~ % tar xvfz Money.tar.gz Money/ Money/Money.php Money/IMoney.php Money/MoneyTest.php Money/build/ Money/build/logs/ Money/build/logs/jdepend.xml Money/build/logs/checkstyle.xml Money/build/logs/clover.xml Money/build/logs/pdepend.xml Money/build/logs/junit.xml Money/build.xml Money/MoneyBag.php sb@ubuntu ~ % cd Money sb@ubuntu Money % ant Unable to locate tools.jar. Expected to find it in /usr/lib/jvm/java-6-openjdk/lib/tools.jar Buildfile: build.xml clean: [delete] Deleting directory /home/sb/Money/build prepare: [mkdir] Created dir: /home/sb/Money/build/logs phpunit: [exec] PHPUnit @package_version@ by Sebastian Bergmann. [exec] [exec] ...................... [exec] [exec] Time: 0 seconds [exec] [exec] OK (22 tests, 34 assertions) [exec] [exec] Writing code coverage data to XML file, this may take a moment. phpcs: [exec] Result: 1 pdepend: [exec] PHP_Depend 0.9.2 by Manuel Pichler [exec] [exec] Parsing source files: [exec] .... 4 [exec] [exec] Executing NodeLoc-Analyzer: [exec] ... 75 [exec] [exec] Executing CodeRank-Analyzer: [exec] 8 [exec] [exec] Executing CyclomaticComplexity-Analyzer: [exec] ... 71 [exec] [exec] Executing ClassLevel-Analyzer: [exec] ... 68 [exec] [exec] Executing Hierarchy-Analyzer: [exec] ... 77 [exec] [exec] Executing NPathComplexity-Analyzer: [exec] ... 71 [exec] [exec] Executing Dependency-Analyzer: [exec] ... 71 [exec] [exec] Executing NodeCount-Analyzer: [exec] ... 68 [exec] [exec] Executing Inheritance-Analyzer: [exec] 20 [exec] [exec] Executing Coupling-Analyzer: [exec] .... 86 [exec] [exec] Generating pdepend log files, this may take a moment. build: BUILD SUCCESSFUL Total time: 3 seconds
        Hide
        Sebastian Bergmann added a comment -

        Updated example project.

        Show
        Sebastian Bergmann added a comment - Updated example project.
        Hide
        Sebastian Bergmann added a comment -

        sb@ubuntu Money % ant
        Buildfile: build.xml

        clean:

        prepare:
        [mkdir] Created dir: /home/sb/Money/build/logs

        phpcs:

        phpmd:

        phpcpd:
        [exec] phpcpd @package_version@ by Sebastian Bergmann.
        [exec]
        [exec] 0.00% duplicated lines out of 722 total lines of code.

        pdepend:
        [exec] PHP_Depend @package_version@ by Manuel Pichler
        [exec]
        [exec] Executing Dependency-Analyzer:
        [exec] 16
        [exec]
        [exec] Generating pdepend log files, this may take a moment.

        phpunit:
        [exec] PHPUnit @package_version@ by Sebastian Bergmann.
        [exec]
        [exec] ......................
        [exec]
        [exec] Time: 0 seconds
        [exec]
        [exec] OK (22 tests, 34 assertions)
        [exec]
        [exec] Writing code coverage data to XML file, this may take a moment.

        build:

        BUILD SUCCESSFUL
        Total time: 4 seconds

        Show
        Sebastian Bergmann added a comment - sb@ubuntu Money % ant Buildfile: build.xml clean: prepare: [mkdir] Created dir: /home/sb/Money/build/logs phpcs: phpmd: phpcpd: [exec] phpcpd @package_version@ by Sebastian Bergmann. [exec] [exec] 0.00% duplicated lines out of 722 total lines of code. pdepend: [exec] PHP_Depend @package_version@ by Manuel Pichler [exec] [exec] Executing Dependency-Analyzer: [exec] 16 [exec] [exec] Generating pdepend log files, this may take a moment. phpunit: [exec] PHPUnit @package_version@ by Sebastian Bergmann. [exec] [exec] ...................... [exec] [exec] Time: 0 seconds [exec] [exec] OK (22 tests, 34 assertions) [exec] [exec] Writing code coverage data to XML file, this may take a moment. build: BUILD SUCCESSFUL Total time: 4 seconds
        Hide
        Mike Willbanks added a comment -

        I would also like to comment as to not forget about Hudson and Bamboo when focusing on this project for continuous integration servers.

        Simon already commented on the additional PHP packages that are typically fairly heavily utilized.

        Show
        Mike Willbanks added a comment - I would also like to comment as to not forget about Hudson and Bamboo when focusing on this project for continuous integration servers. Simon already commented on the additional PHP packages that are typically fairly heavily utilized.
        Hide
        Sebastian Bergmann added a comment -

        Is someone still working on this? Thanks!

        Show
        Sebastian Bergmann added a comment - Is someone still working on this? Thanks!
        Hide
        Freddy Mallet added a comment -

        Hi Sebastian, Julien has worked on it in May/June but currently this development seems frozen.

        Show
        Freddy Mallet added a comment - Hi Sebastian, Julien has worked on it in May/June but currently this development seems frozen.
        Hide
        Gabriele Santini added a comment -

        All of this works now

        Show
        Gabriele Santini added a comment - All of this works now

          People

          • Assignee:
            Unassigned
            Reporter:
            Simon Brandhof
          • Votes:
            8 Vote for this issue
            Watchers:
            8 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: