Tuesday, March 2. 2010PHP_Depend-0.9.11 releasedI have just released version 0.9.11 of PHP_Depend. It contains a few bug fixes and improvements for PHP_Depend.
As always, you can get the latest PHP_Depend version from its PEAR channel: pear.pdepend.org: mapi@arwen ~ $ pear channel-discover pear.pdepend.org mapi@arwen ~ $ pear install pdepend/PHP_Depend-beta Or you can fetch the sources from the subversion reposition: mapi@arwen ~ $ svn co http://svn.pdepend.org/branches/0.9.0/ And additionally you can find a repository mirror on github: mapi@arwen ~ $ git clone git://github.com/manuelpichler/pdepend.git
Posted by Manuel Pichler
in php, php_depend, phpugdo, projects
at
21:08
| Comments (0)
| Trackbacks (0)
Defined tags for this entry: bug fix, php_depend, release announcement, software metrics, static code analysis
Tuesday, February 23. 2010PHP_Depend-0.9.10 releasedI have just released the bug fix version 0.9.10 of PHP_Depend. This release contains several bug fixes and improvements for PHP_Depend.
As always, you can get the latest PHP_Depend version from its PEAR channel: pear.pdepend.org: mapi@arwen ~ $ pear channel-discover pear.pdepend.org mapi@arwen ~ $ pear install pdepend/PHP_Depend-beta Or you can fetch the sources from the subversion reposition: mapi@arwen ~ $ svn co http://svn.pdepend.org/branches/0.9.0/ And additionally you can find a repository mirror on github: mapi@arwen ~ $ git clone git://github.com/manuelpichler/pdepend.git
Posted by Manuel Pichler
in php, php_depend, phpugdo, planet-php, projects
at
20:36
| Comments (0)
| Trackbacks (0)
Defined tags for this entry: php, php5, php_depend, quality assurance, release announcement, software metrics, static code analysis
Thursday, February 4. 2010Talk about "Software Metrics" at PHPUG CologneThis friday I will give my software metrics introduction talk at the PHP User Group Cologne. The talk covers several aspects of static code analysis. Starting with classic count and complexity metrics, up to modern metrics, which are used for tracking the dependencies and coupling in a modern OO-systems.
I hope this talk will inspire some of the listerners, how software metrics can be used to improve the quality of their software projects. The talk will take place at:
Looking forward to meet you there. Sunday, January 31. 2010phpUnderControl 0.5.1 releasedToday I have released phpUnderControl version 0.5.1. It's a bug fix release that closes several issues open since a long time. First of all I would like to thank Sebastian Marek who was the main contributor to this releases, so a big thankyou to you.
Beside the new release some more things have changed. From now on the phpUnderControl development is hosted on github. This means that from now on the latest version of phpUnderControl can be obtained with the following command:
mapi@arwen ~ $ git clone \
git://github.com/manuelpichler/phpUnderControl.git
Additionally we have moved the phpUnderControl's PEAR Channel Server from pear.phpunit.de to its own server pear.phpundercontrol.org. At this point I would like to thank Sebastian for providing phpUnderControl's infrastructure under the PHPUnit umbrella for the last three years. mapi@arwen ~ $ pear uninstall phpunit/phpUnderControl mapi@arwen ~ $ pear channel-discover pear.phpundercontrol.org mapi@arwen ~ $ pear install --alldeps phpuc/phpUnderControl-beta Starting to download phpUnderControl-0.5.1.tgz (539,717 bytes) ..........................................done: 539,717 bytes install ok: channel://pear.phpundercontrol.org/phpUnderControl-0.5.1
Posted by Manuel Pichler
in php, phpugdo, phpundercontrol, planet-php, projects
at
21:16
| Comments (0)
| Trackbacks (0)
Defined tags for this entry: ant, bug fix, continuous integration, phpundercontrol, release announcement, sebastian marek
Wednesday, January 20. 2010PHPMD wednesday... PHPMD 0.2.2, PHPMD Ant Task, PHPMD on GitHubToday I have released PHPMD 0.2.2, a minor bug fix release that solves some exit code issues in the previous version. Beside this, I am proud to announce the first release of the PHPMD Ant Task. It allows a seamless integration of PHPMD into your Ant build.xml file. So, please download the PHPMD Ant Task, test it and file bug reports or feature requests in PHPMD's issue tracker. You can get the latest PHPMD version from its PEAR channel: pear.phpmd.org mapi@arwen ~ $ pear channel-discover pear.pdepend.org mapi@arwen ~ $ pear channel-discover pear.phpmd.org mapi@arwen ~ $ pear install --alldeps phpmd/PHP_PMD-alpha Beside this two releases there is an additional news. From now on you can find an up-2-date mirror of PHPMD's subversion repository on github, so that you can fork PHPMD and participate on in development on these days social coding plattform. mapi@arwen ~ $ git clone git://github.com/manuelpichler/phpmd.git Tuesday, January 5. 2010PHP Mess Detector 0.2.1 releasedThis is just a small bugfix release of PHPMD. It introduces a small new feature that enables PHPMD's command line tool to handle multiple input files. This feature was required for some upcoming external features and extensions. Since version 0.2.1 you can call the command line tool of PHPMD with multiple input files and/or directories, separated by comma. mapi@arwen ~ $ phpmd phpmd,systemDaemon text unusedcode You can get the latest PHPMD version from its PEAR channel: pear.phpmd.org mapi@arwen ~ $ pear channel-discover pear.pdepend.org mapi@arwen ~ $ pear channel-discover pear.phpmd.org mapi@arwen ~ $ pear install --alldeps phpmd/PHP_PMD-alpha Saturday, January 2. 2010staticReflection 0.1.4 releasedToday I have released version 0.1.4 of the staticReflection component. This release contains two critical bug fixes.
You can get the latest stable version of the staticReflection component through its PHP_Depend's PEAR channel: mapi@arwen ~ $ pear channel-discover pear.pdepend.org mapi@arwen ~ $ pear install pdepend/staticReflection-alpha or you can download the latest version from the staticReflection svn respository:
mapi@arwen ~ $ svn co http://svn.reflection.pdepend.org/trunk \
staticReflection
Posted by Manuel Pichler
in php, phpugdo, projects, staticReflection
at
23:38
| Comments (0)
| Trackbacks (0)
Tuesday, December 29. 2009PHP Mess Detector 0.2 released.Today I have released version 0.2.0 of the PHP Mess Detector or short PHPMD. PHPMD is a simple, customizable and user friendly frontend application for PHP_Depend. It takes the raw metrics measured by PHP_Depend, compares them with appropriate thresholds and generates a report that lists those software artifacts with potential problems. Such a report can be taken as a basis for human code audits or you can use it as input for an automated build/reporting tool. Most concepts behind PHPMD are based on those of the well known Java Tool PMD. It uses so called rule set files to organize different sets of rules. There are two purposes that are accomplished by these xml files. The first is to create custom sets of rules which fulfills the projects requirements. The second purpose is the configuration of each rule with thresholds, warning messages and other things. The format of these files is totally borrowed from PMD, so that the reuse existing rule sets in multi language environments should be easy. At the moment PHPMD has two build-in rule sets. One that detects software artifacts with high code size, and the second one detects unused code in your software.
Now lets start with a small How to use it. PHPMD can be called from the command line by typing mapi@arwen ~ $ phpmd Mandatory arguments: 1) A php source code filename or directory 2) A report format 3) A ruleset filename or a comma-separated string of ... Optional arguments that may be put after the mandato... --minimumpriority: rule priority threshold; rules with ... --reportfile: send report output to a file; default to ... --extensions: comma-separated string of valid source ... --ignore: comma-separated string of patterns that are ...
Now let's call PHPMD on its own source, with a simple text report on STDOUT and the mapi@arwen ~ $ phpmd ~/phpmd/source text codesize /home/mapi/phpmd/source/PHP/PMD/RuleSetFactory.php:66 \ This class has too many methods, consider refactoring it. /home/mapi/phpmd/source/PHP/PMD/RuleSetFactory.php:267 \ The method _parseSingleRuleNode() has a Cyclomatic \ Complexity of 11. /home/mapi/phpmd/source/PHP/PMD/RuleSetFactory.php:326 \ The method _parseRuleReferenceNode() has a Cyclomatic \ Complexity of 10.
The
mapi@arwen ~ $ phpmd ~/phpmd/source xml codesize,unusedcode \
--reportfile ~/pmd.xml
mapi@arwen ~ $ cat ~/pmd.xml
<?xml version="1.0" encoding="UTF-8" ?>
<pmd version="@package_version@" timestamp="...">
<file name=".../source/PHP/PMD/RuleSetFactory.php">
<violation beginline="66" endline="417" rule="TooManyMet ...>
This class has too many methods, consider refactoring it.
</violation>
<violation beginline="267" endline="315" rule="Cyclomati ...>
Method _parseSingleRule() has a Cyclomatic Complexity of 11.
</violation>
<violation beginline="326" endline="367" rule="Cyclomati ...>
Method _parseRuleReference() has a Cyclomatic Complexity of 10.
</violation>
</file>
</pmd>
This xml file is compatible with those files generated by PMD and PHPUnit's deprecated
Currently PHPMD supports the following three different report formats: Text, HTML and XML. And it has the build-in rule sets: You can get the latest PHPMD version from its PEAR channel: pear.phpmd.org mapi@arwen ~ $ pear channel-discover pear.pdepend.org mapi@arwen ~ $ pear channel-discover pear.phpmd.org mapi@arwen ~ $ pear install --alldeps phpmd/PHP_PMD-alpha
Posted by Manuel Pichler
in php, php_depend, phpmd, phpugdo, planet-php, projects
at
23:40
| Comments (2)
| Trackbacks (0)
Saturday, December 26. 2009PHP_Depend-0.9.9 releasedI have just released the bug fix version 0.9.9 of PHP_Depend.
You can get the latest PHP_Depend version from its PEAR channel: pear.pdepend.org mapi@arwen ~ $ pear channel-discover pear.pdepend.org mapi@arwen ~ $ pear install pdepend/PHP_Depend-beta
Posted by Manuel Pichler
in php, php_depend, phpugdo, projects
at
23:26
| Comments (0)
| Trackbacks (0)
Monday, December 14. 2009PHP_Depend-0.9.8 releasedToday I released PHP_Depend 0.9.8, which contains many bug fixes and improvements. This release will be the base version for a new tool called PHPMD. PHPMD is a frontend that reports critical and suspect software artifacts in a project, based on the metrics measured with PHP_Depend. It aims to be a PHP equivalent to the well known java tool PMD.
You can get the latest PHP_Depend version from its PEAR channel: pear.pdepend.org mapi@arwen ~ $ pear channel-discover pear.pdepend.org mapi@arwen ~ $ pear install pdepend/PHP_Depend-beta
Posted by Manuel Pichler
in php, php_depend, phpugdo, projects
at
17:21
| Comments (0)
| Trackbacks (0)
Sunday, December 6. 2009phpUnderControl 0.5.0 releasedAfter quite some time of silence around phpUnderControl I have bundled the 0.5.0 release today. Beside minor changes, bugfixes and enhancements this release contains one new major feature, the PHP_CodeBrowser. The PHP_CodeBrowser is a separate application that collects various XML log files with different project metrics/violations and presents them in a browseable source view with syntax highligting. This tool is a contribution by the Mayflower GmbH, where it was developed and now shared with the Open Source Community. At this point I would like to thank Mayflower as a whole and in particular at Elger and Thorsten, which were responsible for all technical aspects of this contribution. To use the PHP_CodeBrowser you must add an additional execute publisher to your CruiseControl config.xml file that generates the PHP_CodeBrowser html report and an additional artifacts publisher to move the generated PHP_CodeBrowser report into the projects artifacts directory.
<?xml version="1.0" encoding="UTF-8" ?>
<cruisecontrol>
<!-- ... -->
<project name="PHP_Depend" buildafterfailed="false">
<!-- ... -->
<publishers>
<!-- ... -->
<execute command="phpcb
--log projects/${project.name}/build/logs
--source projects/${project.name}/source/PHP
--output projects/${project.name}/build/php-code-browser"/>
<artifactspublisher
dir="projects/${project.name}/build/php-code-browser"
dest="artifacts/${project.name}"
subdirectory="php-code-browser"/>
<!-- ... -->
</publishers>
</project>
</cruisecontrol>
But why do we use a CruiseControl publishers instead of a regular ant (Your build tool here) target? The answer is really simple. The PHP_CodeBrowser must be the very last artifact generated for a project, which means it must also run after PHPUnit, to collect the test result logs. But in most setups PHPUnit is configured with
If you create a new project with phpUnderControl's
mapi@arwen ~ $ phpuc project \
--project-name PHP_Depend \
--source-dir PHP \
--test-case PHP_Depend_AllTests \
--test-dir tests \
--test-file PHP/Depend/AllTests.php \
--version-control svn \
--version-control-url http://svn.pdepend.org/branches/0.9.0 \
/opt/cruisecontrol/cruisecontrol-bin-2.8.2
To get the latest version of phpUnderControl, you can use the PEAR-Channel-Server: mapi@arwen ~ $ pear channel-discover pear.phpunit.de mapi@arwen ~ $ pear install phpunit/phpUnderControl-beta or you can check it out from the subversion repository: mapi@arwen ~ $ svn co svn://phpunit.de/phpunit/phpUnderControl/trunk
Posted by Manuel Pichler
in php, phpugdo, phpundercontrol, planet-php, projects
at
15:16
| Comments (25)
| Trackbacks (0)
Defined tags for this entry: elger, mayflower, phpundercontrol, php_codebrowser, release announcement, thorsten
Sunday, November 29. 2009First release of the staticReflection component.Today I have released the first version of the staticReflection component. This component parses the source files of a project to provide reflection information identical to that provided by PHP's build in API, without loading the class declaration into the PHP runtime context. Due to the API compatibility the staticReflection component can simply be used as a drop-in replacement for the reflection extension. A few weeks ago I started just another script that utilized the tokenizer extension to extract some information from source code files. At that point I thought that the time had come to realize a project that was on my todo for a very long time. And here is the result of the first iteration, a userland reflection implementation that is api compatible with PHP's internal reflection extension. Beside the source parser and the reflection ast this component provides a unified interface to both reflection versions, which makes it easy to switch between different implementations. As a first use case for this component I have choosen autoload files, as they are used by the eZ Components. The generation of those files is really easy, simply parse a directory with source files and dump the result into a file.
<?php
use org\pdepend\reflection\Autoloader;
use org\pdepend\reflection\ReflectionSession;
// Include the bundled autoloader
include_once 'staticReflection/Autoloader.php';
// Register the autoload function
spl_autoload_register( array( new Autoloader(), 'autoload' ) );
// Create a new session
$session = new ReflectionSession();
// Create a directory query
$query = $session->createDirectoryQuery( );
$autoload = array();
foreach ( $query->find( __DIR__ . '/../../source/' ) as $class )
{
$autoload[$class->getName()] = $class->getFileName();
}
var_export( $autoload );
You can also use the static reflection implementation to analyze different versions of the same class in the same process, which is not possible with the build-in reflection API, because you cannot load multiple classes with the same name into the current runtime context. Beside parsing of a given directory or file the staticReflection component also supports direct access to a concrete class or interface through the name. Therefor it uses so called source resolvers, that perform a mapping between class names and the associated source files. The current release has two build-in resolvers, one using autoload arrays as they are used by the eZ Components and the other one uses the PEAR naming conventions and the configured include_paths to determine the source file for a given class name. The following example illustrates the usage of the PEAR source resolver.
<?php
use org\pdepend\reflection\Autoloader;
use org\pdepend\reflection\ReflectionSession;
use org\pdepend\reflection\factories\StaticReflectionClassFactory;
use org\pdepend\reflection\resolvers\PearNamingResolver;
include_once 'staticReflection/Autoloader.php';
spl_autoload_register( array( new Autoloader(), 'autoload' ) );
$session = ReflectionSession::createStaticSession(
new PearNamingResolver()
);
$class = $session->getClass( 'PEAR_Frontend' );
echo '- ', $class->getName(), PHP_EOL,
' ', $class->getFileName(), PHP_EOL;
This concept makes the component extremly flexible, because you can write your own source resolver that fulfills the requirements for your application.
Beside the source resolver concept the ReflectionSession can also be configured with a custom stack of ReflectionClassFactory objects that are used to retrieve a reflection class instance for a given class/interface name. To minimize the configuration overhead for common use cases the
But you can always build your own session configuration with a custom factory stack, by calling the <?php use org\pdepend\reflection\Autoloader; use org\pdepend\reflection\ReflectionSession; include_once 'staticReflection/Autoloader.php'; spl_autoload_register( array( new Autoloader(), 'autoload' ) ); $session = new ReflectionSession(); $session->addClassFactory( new MyFooFactory() ); $session->addClassFactory( new MyBarFactory() );
So how can you use this cool component in your application? This is really simple, just replace all <?php // ... // Previous instantiation // $ref = new ReflectionClass( 'Foo_Bar_Baz' ); // New cool solution $ref = ReflectionSessionInstance::get()->getClass( 'Foo_Bar_Baz' ); And add the following code to your bootstrap file:
<?php
// ...
ReflectionSessionInstance::set(
ReflectionSession::createInternalSession()
);
Finally some words to the requirements and the installation of this component. This component requires PHP in a version greater or equal 5.3.0. For installation you can use PHP_Depend's PEAR channel: mapi@arwen ~ $ pear channel-discover pear.pdepend.org mapi@arwen ~ $ pear install pdepend/staticReflection-alpha or you can download the latest version from the staticReflection svn respository:
mapi@arwen ~ $ svn co http://svn.reflection.pdepend.org/trunk \
staticReflection
Feel free to test this component and file bug-reports and/or feature-requests in the project issue tracker.
Posted by Manuel Pichler
in php, phpugdo, planet-php, projects, staticReflection
at
21:45
| Comments (2)
| Trackbacks (0)
Saturday, November 28. 2009PHP_Depend PEAR Channel switched to Pirum
Today Fabien Potencier announced the first relase of the PEAR Channel server Pirum. The great benefit of this Channel server is that it provides a simple shell script to publish new PEAR package releases, a feature that I missed in the previously used Chiara PEAR Server. Pirum will make it really easy to publish new package versions through a simple build script
The setup was quick done, following the instructions on the pirum website, and importing the existing package files worked like a charm. The only problem I encountered was that both channel server implementations use a different directory structure. Pirum stores all the XML descriptors under a directory named /rest, while my Chiara Server installation has used /Chiara_PEAR_Server_REST, so that a first call to manu@arwen ~ $ pear upgrade Error getting channel info from pear.pdepend.org: \ File http://pear.pdepend.org:80/Chiara_PEAR_Server_REST/p/packages.xml \ not valid (received: HTTP/1.1 404 Not Found) But a simple 301 redirect makes this software transition transparent for the PHP_Depend users. So when you will also switch to Pirum you should keep this in mind and test your channel server with an existing/configured local pear installation. Finally, thanks to Fabien for this nitty-gritty tool, which will speed up the deployment process of PEAR packages, at least for me.
Posted by Manuel Pichler
in php, php_depend, phpugdo, planet-php
at
14:00
| Comments (3)
| Trackbacks (0)
Wednesday, November 18. 2009PHP_Depend jumps on the D-BUSToday I had the chance to visit Derick's IPC talk PHP on the D-BUS. Beside the fact that it was an exciting talk, it inspired me to implement a small, but nice feature for PHP_Depend using the pecl/dbus extension. ![]() PHP_Depend jumps on the D-BUS Sometimes the parsing and analysis process of PHP_Depend can consume a lot of time to finish, so I always put the shell aside and do something different. Normally I take a look at the shell every few minutes to check if the process has finished, but it also happens that I totally forget that I have started a PHP_Depend process on my system. So I need something that says to me, "Hey, mapi PHP_Depend has finished its job...", and here comes D-BUS in the game. With D-BUS it is really simple to send a message to a desktop notification panel, as it is available for desktop environments like Gnome or KDE. To use D-BUS in your php applications you must checkout the source code of pecl/dbus from the svn repository and compile it for your php installation.
mapi@arwen ~ $ svn co http://svn.php.net/repository/pecl/dbus/trunk \
pecl-dbus
mapi@arwen ~ $ cd pecl-dbus
mapi@arwen pecl-dbus $ phpize
mapi@arwen pecl-dbus $ ./configure
mapi@arwen pecl-dbus $ make
mapi@arwen pecl-dbus $ sudo make install
That's it. Now you should see the --notify-me option when you open PHP_Depend's help screen. mapi@arwen ~ $ ~/pdepend/pdepend.php --help PHP_Depend @package_version@ by Manuel Pichler // ... snipp ... --debug Prints debugging information. --help Print this help text. --version Print the current version. --notify-me Show a notification after analysis. -d key[=value] Sets a php.ini value. Now you can add this option to your normal PHP_Depend command and it will show a notification window with the number of analyzed files and the time the process took.
mapi@arwen ~ $ ~/pdepend/pdepend.php --summary-xml=/tmp/summary.xml \
--notify-me \
~/pdepend/PHP
For the moment this feature is only available through the 0.9.0 branch of PHP_Depend and not as a PEAR package.
Posted by Manuel Pichler
in php, php_depend, phpugdo, planet-php
at
18:47
| Comment (1)
| Trackbacks (0)
Tuesday, November 17. 2009Softwaremetriken verstehen und nutzenToday Kore and I gave a talk on software metrics at the International PHP Conference 2009 in Karlsruhe. You can download our german slides here. It was a really nice talk and the feedback from the audience and on twitter was really positive. So, if you liked the talk please comment on joind.in later, when our slides are online.
Posted by Manuel Pichler
in php, php_depend, phpugdo
at
14:19
| Comments (0)
| Trackbacks (0)
Defined tags for this entry: arbit, cyclomatic complexity, ipc, karlsruhe, kore, software metrics, talks
« previous page
(Page 2 of 6, totaling 89 entries)
» next page
|
ProjectsFurther stuffCategories |



