News Feed
Sections




News Archive
feed this:

Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Phil Sturgeon:
PHP Static Analysis in Sublime Text
August 21, 2013 @ 09:49:59

Phil Sturgeon has put together a new post for his site showing you how to set up static analysis of PHP code in the Sublime Text editor using various tools.

Coding Standards have been around for the longest time and recently they're starting to become more widespread in PHP. While learning Python I really enjoyed how Sublime Text 2 would shout at me for using too many empty lines, using tabs instead of spaces and even things like declaring unused local variables, importing modules that were never used, etc. This was pretty cool, and I was soon writing beautiful Python code without any concern over which way things should be done. I've been doing this with PHP for the last year, but trying to get a new-hire going with this stuff was hard. We smashed through it taking notes so now I've written it up for you guys.

He's broken it down into a few different steps (three of them) to get things like the right version of PHP, PHPMD and PHP_CodeSniffer installed and configured. There's a few config settings you'll need to change in Sublime to get things working correctly, but it's a relatively painless setup.

0 comments voice your opinion now!
static code analysis phpmd phpcs sublimetext install configure

Link: http://philsturgeon.co.uk/blog/2013/08/php-static-analysis-in-sublime-text

Andrew Podner:
NPATH Complexity Demystified
November 14, 2012 @ 10:55:57

In a new post to his site today Andrew Podner takes a look at NPATH and tries to "demystify" some of the concepts around it.

"NPATH, which counts the acyclic execution paths through a function, is an objective measure of software complexity related to the ease with which software can be comprehensively tested."[1] This is the definition from an article written in 1988 by Brian Nejmeh. As informative as this is, my eyes glazed over half way into it. So what the heck is acyclic execution anyway?

He defines the term in a bit easier to understand language and includes an example function to help illustrate how NPATH is measured.

The goal is to limit your NPATH complexity in a given method down to 200 or less. [...] As with other complexity metrics, this one can be checked with PHP Mess Detector (phpmd). The importance of staying under the 200 path threshold is realized when you develop tests and start trying to debug.
0 comments voice your opinion now!
npath complexity cyclomatic introduction phpmd phpmessdetector


Lorna Mitchell's Blog:
PHP Static Analysis Tool Usage
August 03, 2011 @ 10:50:22

In an informal poll Lorna Mitchell recently asked fellow developers to weigh in on what static analysis tool they used on their code. She's posted the results to her blog today with one of the tools being a clear winner.

My interest was mostly because I'm working on a book chapter which includes some static analysis content, and there are a couple of these tools that I include in my own builds, but I don't do much with the output of them. However I didn't want to drop anything from the chapter if it was actually a valuable tool and I was just missing the point - pretty much all the tools got a good number of votes though, so I'll be covering all of the [options].

According to her results, the most used tool by developers is the PHP_CodeSniffer with the PHP Mess Detector and PHP Copy & Paste Detector tied for second place.

0 comments voice your opinion now!
poll results static analysis tool codesniffer phpmd phpcopypaste


DZone.com:
PHP Tool Integration (PHPsrc)
May 24, 2011 @ 12:05:15

On the PHP on Windows section of DZone.com, Eric Hogue looks at the PHPsrc extension for Eclipse - a handy tool that lets you run some of the common PHP QA tools right from the IDE.

PHPsrc is a plugin that allow you to run PHP_CodeSniffer, PHPUnit, PHP Depend and PHP Copy/Paste Detector directly in Eclipse. The site also says that more tools should come. As you work, you will see any transgression you make. That will save you from breaking the build, but it also makes it easier to fix the problem. After all, you just wrote the faulty lines of code.

He walks you through the install of the plugin and shows you how to set things up to point to the executables on your development environment (complete with some screenshots). There's even an example of the output for a particularly offensive (standards-wise, of course) piece of code.

0 comments voice your opinion now!
phpsrc eclipse plugin codesniffer phpunit phpmd phpdepend


QaFoo.com Blog:
Howto write a Rule for PHPMD
March 21, 2011 @ 09:16:57

On the QaFoo blog today Manuel Pichler has written up a guide to help you write a custom rule to use with the PHP Mess Detector (PHPMD) as extended from some of the current rules (it's always easier to start from examples).

Let us start with some architecture basics behind PHPMD. All rules in PHPMD must at least implement the PHP_PMD_Rule interface. You can also extend the abstract rule base class PHP_PMD_AbstractRule which already provides an implementation of all required infrastructure methods and application logic, so that the only task which is left to you is the implementation of the concrete validation code of your rule.

He walks you through some sample code and talks about some of the common interfaces that are available to your testing. He takes one of them, IFunctionAware, and looks at it specifically, showing how to use it to detect and add violations for the validation. He includes an example of writing a rule based on an existing software metric (in this case, the number of public methods). There's also bit at the end showing how to write a rule based on the "abstract syntax tree" to be able to check just about anything in the code you're looking to test.

0 comments voice your opinion now!
phpmd mess detector rule tutorial


Manuel Pichler's Blog:
Howto create custom rule sets for PHPMD
April 09, 2010 @ 13:19:25

If you've been using the PHP Mess Detector (PHPMD) to help clean up problem areas in your applications, but have needed more than just the basic rules that it comes with, you're in luck. Manuel Pichler has put together a new post for his blog about creating custom rules sets for the tool.

PHPMD can be seen as an one level down/low level equivalent to PHP_CodeSniffer. It is a simple command line tool that can be used to check your application's source code for possible bugs, suboptimal or overcomplicated code. The current release of PHPMD ships with three default rule sets.

The first deals with code size, the second checks for unused variables and the like and the third looks at naming conventions. He shows how to take one of the structures from one of these three and create a new rule. For his example it's a measurement of cyclomatic complexity. He also shows you how to exclude certain rules that might come in another set so you don't have to completely redefine to use pre-existing rules.

The latest release of PHPMD can be pulled from pear.phpmd.org or from its github repository.

1 comment voice your opinion now!
phpmd custom rule set tutorial


Sebastian Bergmann's Blog:
Quality Assurance Tools for PHP
March 17, 2009 @ 12:02:53

Sebastian Bergmann has a new post that lists a few quality assurance testing tools you can use to ensure that you and your code are safe to make the jump to production.

He's laid out a map of the tools that can all interact to create a more robust environment for automatically building and testing your code. Here's his list:

The results of all of these tools running on your code is then fed into the CruiseControl instance and passed off to phpUnderControl for final deployment.

0 comments voice your opinion now!
quality assurance tool phpcodesniffer phpmd phpcpd phpdepend phpunit phpundercontrol



Community Events





Don't see your event here?
Let us know!


tool library opinion laravel release series conference symfony framework community security introduction composer version language list podcast artisanfiles interview voicesoftheelephpant

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework