Entries tagged as quality assuranceRelated tags annotations phpmd release announcement static code analysis checkstyle continuous integration cruisecontrol cyclomatic complexity design quality npath complexity php phpunit php_codesniffer php_depend pmd software metrics cli bug fix phpundercontrol usability conference hamburg phpugdo unconference ant arbit css customization dashboard ezcomponents java server pages layout lint php5 phpdoc sebastian marek testing tutorial torii portal ipc karlsruhe kore talks overview pyramid software architecture software design ext/filter phpt unit test book logger optimization performance crazy dortmund elephpant fabien potencier fun phpbbq phpug pirum static_reflection thinkpad tools xml xpath zce zend certified engineer git github sylvester 2007 elger mayflower php_codebrowser thorsten dbus derick cologne customerThursday, March 4. 2010PHPMD 0.2.3 released with @SuppressWarnings support and new rule set.We are proud to announce the 0.2.3 release of the PHP Mess Detector, a tool that takes source code and performs various tests to calculate various quality aspects from it. The measured values are a good starting point for future improvements. This release contains some new features, for example support for the @SuppressWarnings annotation, that allows you to exclude single methods or complete classes from PHPMD's analyzing process. This annotation can be used to suppress a single rule, a group of rules or PHPMD at all.
/**
* Suppress all PHPMD warnings for this class.
*
* @SuppressWarnings(PHPMD)
*/
class PHPMD_SuppressAll
{
}
class PHPMD_SuppressOnMethod
{
/**
* Do not warn about the unused parameter $bar.
*
* @SuppressWarnings(PHPMD.UnusedFormatParameter)
*/
public function foo($bar)
{
}
}
Beside several bugfixes this release comes with a new set of rules that check the naming of methods, variables etc. against common coding conventions and best practices.
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 Or from our github repository: mapi@arwen ~ $ git clone git://github.com/manuelpichler/phpmd.git
Posted by Manuel Pichler
in php, phpmd, phpugdo, projects
at
10:32
| Comments (0)
| Trackbacks (0)
Defined tags for this entry: annotations, phpmd, quality assurance, release announcement, 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
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)
Sunday, August 2. 2009PHP_Depend-0.9.6 releasedToday I released PHP_Depend 0.9.6, which contains many bug fixes and improvements, but the main feature of this release is behind the scene, I have started to migrate PHP_Depend's internal system from plain Token object to an Abstract Syntax Tree.
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, planet-php, projects
at
21:32
| Comment (1)
| Trackbacks (0)
Tuesday, July 7. 2009The value of complexity metrics - Cyclomatic Complexity (1/2)Software metrics are currently on everyone's lips and a frequently discussed topic. There are many conference talks, blog posts and other presentations that talk about software metrics. But to me it seems as if this subject is a closed book for many developers, so I decided to write this little post about a special category of software metrics, the complexity metrics. Complexity metrics are a theoretical approach to measure the subjective complexity of a software fragment, where the words software fragment stand for a paraphrase for functions, methods, classes and nearly every logical unit that can be found in a software system. The most prevalent procedure to calculate complexity values is static code analysis, where an application parses the raw source code of a project, counts different statements and expressions and packs up the determined results in simple classification numbers. And with this information you already know the main concepts behind most software metrics, classification numbers and counting. As you can see there is no magic behind the scene, the only thing required is a good background knowledge to interpret those values. The Cyclomatic Complexity Number or short CCN is the oldest complexity metrics. The first time this software metric was mentioned was 1976 by Thomas J. McCabe. This metric counts the available decision paths in a software fragment to determine its complexity. Each decision path starts with one of the conditional statements from the following list, so that it is fairly easy to detect them in existing source code.
A look at this list of statements may result in the questions:
Is this list wrong, it doesn't list Each decision path gets the value 1 and the sum of all these values represents the Cyclomatic Complexity of the analyzed software fragment. Note that each function and method also counts with a value of 1 With this knowlegde we can now calculate the complexity of the following example code:
Based on the previous definition the Cyclomatic Complexity
Number of the example code example is 5. But you may have
noticed that this approach does not capture all decision paths
that exist. We haven't catched those paths that came from the
by the boolean expression Now we get a complexity value of 8 when we apply the CCN2 to the previous example, what is a growt of the software's complexity of 60%.
Due to the fact that Cyclomatic Complexity Number was
originally invented for procedural programming languages,
this definition for the Cyclomatic Complexity Number still
misses one element to measure the complexity of an object
oriented software system. With the concept of exceptions a
software gets additional decision paths for each
Now that we know what the Cyclomatic Complexity Number is, what can we do with the measured information? We can find the complexity hotspots in a system, for example the top ten artifacts with the highest complexity, but this is only important during an initial analyses phase to get the big picture of an application. For a continuous inspection this information is not so important. A continuous analyses requires thresholds that help to categories calculated values. During the time four values have emerged as good thresholds for the Cyclomatic Complexity Number of a software system.
You may ask, why should I care about the complexity of a software system, where is the value of benefit in this metric? Mostly the complex parts of an application contain business critical logic. But this complexity has negative impacts on the readability and understandability of source code. Those parts will normally become a maintainence and bug fixing nightmare, because no one knows all the constraints, side effects and what's exactly going on in that part of the software. This situation results in the well known saying "Never touch a running system" which in turn mostly ends in copy&paste programming. The situation can even become more critical when the original author leaves the development team or the company. Finally a small example how to apply the new knowledge about the Cyclomatic Complexity Number, thresholds and the negative impacts of complex software to an existing development process. The following source listing shows a complex method taken from PHP_Depend's source. This method has a Cyclomatic Complexity Number of 16 and I must admit that the original author needed some time to understand what was going on in this method.
The first thing to do is to make sure that the test suite is good enough to ensure that the required refactorings will not change the public behavior of the component or class. When this is donw and we are sure our that api breaks will be detected by the test suitewe can start to extract logic into separate methods. The following example shows the result of the refactoring:
The subjective feeling of readability heavily depends on the complexity of control structures, as we can see by a comparison of the original and the refactored version of the method example. The new version with its Cyclomatic Complexity Number of 5 is much easier to read and understand. This text is the first of two blog posts. The second article will give a short introduction into the NPath Complexity You liked this article and you are interested in this and other quality assurence related topics? - Then you should now order your copy of the Book Quality Assurance in PHP Projects. The book talks about nearly all aspect of quality assurence, with practical tips and expert knowledge contributed by certain PHP professionals.
Posted by Manuel Pichler
in php, php_depend, phpugdo, phpundercontrol, planet-php, projects
at
21:20
| Comments (2)
| Trackbacks (0)
Defined tags for this entry: checkstyle, cyclomatic complexity, design quality, npath complexity, php_depend, quality assurance, software metrics
Monday, May 18. 2009PHP_Depend-0.9.5 releasedToday I released PHP_Depend 0.9.5, which contains many bug fixes and improvements. The main features of this release are PHP 5.3 namespace support and a more robust parser that ignores most kinds of syntax errors,
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, planet-php, projects
at
22:21
| Comments (0)
| Trackbacks (0)
Saturday, February 21. 2009PHP_Depend-0.9.4 releasedToday I released PHP_Depend 0.9.4, which contains many bug fixes and improvements.
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
Posted by Manuel Pichler
in php, php_depend, phpugdo, planet-php, projects
at
21:15
| Comment (1)
| Trackbacks (0)
Monday, January 19. 2009PHP_Depend-0.9.3 releasedJust now I released PHP_Depend 0.9.3, the primary goal for this release was focused on less memory consumption. A run of PHP_Depend 0.9.2 against eZ Publish took up to 1GB and PHP_Depend 0.9.3 analyzes the same source with a memory limit of 160Mb.
From now on you will get the latest PHP_Depend version through the new pear channel pear.pdepend.org, for a few weeks I will keep the old pear channel. Enter the following pear commands to upgrade PHP_Depend's channel. mapi@arwen ~ $ pear channel-discover pear.pdepend.org mapi@arwen ~ $ pear uninstall xplib/PHP_Depend mapi@arwen ~ $ pear install pdepend/PHP_Depend Or checkout version 0.9.3 from the PHP_Depend subversion repository. mapi@arwen ~ $ svn co http://svn.pdepend.org/tags/0.9.3
Posted by Manuel Pichler
in php, php_depend, phpugdo, planet-php, projects
at
21:44
| Comments (2)
| Trackbacks (0)
Defined tags for this entry: optimization, performance, php5, php_depend, quality assurance, release announcement
Friday, January 2. 2009PHP_Depend-0.9.2 releasedThis is a bug fix release of PHP_Depend. Version 0.9.2 fixes bug #84, which could result in a failure for all PHP versions lower than 5.3.0alpha2.
You can get the latest PHP_Depend version through its PEAR channel pear.xplib.de or as a subversion checkout of the 0.9.2 tag.
mapi@arwen ~ $ svn co http://svn.pdepend.org/tags/0.9.2
Posted by Manuel Pichler
in php, php_depend, phpugdo, projects
at
21:41
| Comments (0)
| Trackbacks (0)
Wednesday, December 31. 2008PHP_Depend-0.9.1 releasedJust now I released PHP_Depend 0.9.1, the major feature in this new version is an implementation of the NPath Complexity metric, beside that feature the main focus for this release was on performance improvements of the current implementation.
An additional test concept was introduced with the 0.9.* branch of PHP_Depend. Nightly builds test PHP_Depend against a series of open source projects to detect deadlocks like endless loop or similar issues. This procedure is also used to test each release candidate of PHP_Depend. The tested project are:
You can get the latest PHP_Depend version through its PEAR channel pear.xplib.de or as a subversion checkout of the 0.9.1 tag.
mapi@arwen ~ $ svn co http://svn.pdepend.org/tags/0.9.1
Posted by Manuel Pichler
in php, php_depend, phpugdo, planet-php, projects
at
10:31
| Comments (0)
| Trackbacks (0)
Defined tags for this entry: npath complexity, php5, php_depend, quality assurance, release announcement
Monday, December 15. 2008PHP_Depend-0.9.0 releasedToday I released version 0.9.0 of PHP_Depend. Beside bugfixes this release contains new features like a PHPUnit compatible xml-log.
mapi@arwen ~ $ pear channel-discover pear.xplib.de mapi@arwen ~ $ pear install xplib/php_depend
or as a subversion checkout of the 0.9.0 branch or tag. mapi@arwen ~ $ svn co http://svn.pdepend.org/branches/0.9.0 mapi@arwen ~ $ svn co http://svn.pdepend.org/tags/0.9.0 Feel free to report issues, bugs or just leave a comment here.
Posted by Manuel Pichler
in php, php_depend, phpugdo, planet-php, projects
at
15:04
| Comment (1)
| Trackbacks (0)
Defined tags for this entry: php5, php_depend, quality assurance, release announcement, software metrics
Sunday, July 27. 2008PHP_Depend-0.8.0 releasedToday I released the stable 0.8.0 version of PHP_Depend.
The previous list was taken from the PHP_Depend issue tracker. Feel free to report issues, bugs or just leave a comment here.
Posted by Manuel Pichler
in php, php_depend, phpugdo, planet-php, projects
at
16:02
| Comments (6)
| Trackbacks (0)
Monday, July 21. 2008New PHP_Depend release 0.8.0beta4This should be the final beta release for PHP_Depend 0.8.0. Beside some minor bugfixes, it contains a last API change for the log sub component. This change removes constraints to the ctor signature of a logger implementation, which is now part of a separate interface. The following list shows all changes in this version. A detailed description of all issues can be found in the PHP_Depend issue tracker!
As always you can use PHP_Depend's pear channel or its svn repository, to check out this new version. And feel free to discuss and follow the PHP_Depend development on its dedicated mailing list.
Posted by Manuel Pichler
in php, php_depend, phpugdo, phpundercontrol, projects
at
20:47
| Comments (0)
| Trackbacks (0)
Defined tags for this entry: design quality, php, php_depend, quality assurance, release announcement, software metrics
Wednesday, June 25. 2008Using the Overview PyramidThe Overview Pyramid is used to visualize a complete software system in a really compact manner. Therefor it collects a set of metrics from the categories Inheritance, Coupling and Size & Complexity, and puts them into relation. The following figure shows the base structure of the Overview Pyramid[ML06]. Metrics used by the Overview PyramidThe following three lists contain all the metrics, which the Overview Pyramid uses. Size and ComplexityThe category Size & Complexity contributes the greatest and mostly used set of software metrics.
CouplingThis group of metrics informs about the coupling between different program parts in the analyzed application.
InheritanceBoth metrics in this group deal with the use of Inheritance and give a general overview of the use of Inheritance within the analyzed system.
Structure of the Overview PyramidNow that we know all metrics used for the Overview Pyramid, it is time to replace the placeholders with the measured informations. The figure below shows the filled Overview Pyramid. In a second step, the previously independent metrics are set into relation. Therefor we calculate the average values of individual value pairs, these computed values provide us with new informations about the distributions within the application. The following example figure of the Overview Pyramid contains a computed value for the measured LOC and NOM metric which shows us, that in the average each operation has 25 lines of code. This value can be described as very high, especially when you consider that most systems contain a variety of simple operation, like Getter and Setter, in addition to the main application logic. To take reasonable conclusions from the computed values one important part is still missing, an adequate set of reference values. Without reference values, that say what values are low, average or high, it is not possible to classify these results. The current version of PHP_Depend supports a single set of reference values, this set was taken from [ML96]. Reference values
With these reference values PHP_Depend can classify the computed results. PHP_Depend uses this information for the generation of colored backgrounds, so that the color already supports the categorization. The benefit of the Overview PyramidOf course, the final question is, which advantages offers the Overview Pyramid? The Overview Pyramid provides a simple and size indipendent way to get a first impression of a software system, and this without an expensive source code analysis. Thus the Overview Pyramid is an effective tool for a first cost estimate for an unknown system. With the help of this tool and know-how, an experienced developer will quickly get a first impression and will know what can be expected from the analyzed application. And this knowledge could be a good help during the planning phase of a new project. Bibliography
Posted by Manuel Pichler
in php, php_depend, phpugdo, projects
at
18:36
| Comments (6)
| Trackbacks (0)
Defined tags for this entry: overview pyramid, php_depend, quality assurance, software design, software metrics
Sunday, June 22. 2008Follow the development process of PHP_DependIf you like commit mails as I do, you can subscribe to the commit mailing list. Simply send an email to commits-join@pdepend.org or register thru the online interface. If you have any PHP_Depend related questions, tips or suggestions, subscribe to the PHP_Depend user mailing list by mail users-join@pdepend.org or use the online interface. Enjoy PHP_Depend! Manuel
Posted by Manuel Pichler
in php, php_depend, phpugdo, projects
at
22:48
| Comments (0)
| Trackback (1)
(Page 1 of 2, totaling 23 entries)
» next page
|
ProjectsFurther stuffCategories |
