When reviewing code, the first step is to know what has to be checked, and what will be considered for fixing. There are lots of considerations to be taken into account, and it is often difficult to both agree on which code smells to check, and to collect all of them in the same time. […]
« We don’t have time for reviewing code » is both the most often and most reasonable excuse anyone may have. Think about it, features are already late : they are not being coded as you read this post. Then, when it’s done, there will be the other features that are stacking up while the current features […]
I’m already busy preparing for the international PHP conference, in Munchen, Germany. I’m giving two talks : on about PHP 5.6 and the second about static audits. Besides, being an impressive conference, I’ll be happy to visit one of my first conferences ever. Preparing for the next PHP Version Monday, October 27, 2014 […]
I’ll be giving a talk ‘automated PHP code audits‘ to the 010php user group, in Rotterdam. “Even nowadays, PHP code is mostly manually audited. Expert pore over actual code, in search for bugs or code smells. Actually, it is possible to have PHP do this work itself ! Strengthened with the internal Tokenizer, bolstered by […]
Unit test is a part of daily coding, and once you have reached the critical mass, it is just not possible to go on without them. They spot bugs efficiently and systematically, and it is reassuring to have more and more of them. This is also why I started using a random suite for unit tests. […]
Switch statements in PHP link a situation (the cases) to code to be executed. Just like this : switch ($a) { case ‘a’ : /* code here */ case ‘b’ : /* code here */ default : /* code here */ } Duplicate code in switch statements With the size of the switch, it is easy to miss that cases […]
Detecting dead code in PHP PHP applications are under constant evolution. The code tents to grow bigger, more complex, and finally, to collect dust : this also know as dead code. Dead code is actual code that is not being used in production, even if the code is deployed. It is important to remove dead code. Missing […]
It is difficult to avoid the world cup yesterday. Since I’m not a football fan, but rather a PHP fan, I checked which technologies are in use for the national team. I got the list of the 32 national team, then checked they website. The great news is : PHP is a clear winner. Out of […]
The audit report contains several parts : the main part is the diagnostic, and the secondary part is the appinfo. Let’s review them. The diagnostic The diagnostic collect all information in the code that needs to be reviewed, and probably fixed. The diagnostic has 3 parts : the dashboard, the full list and the detailed report. The […]
Defining a PHP method is quite standard : a function only requires a name and arguments. The arguments are its signature, just like this : function x($arg1, $arg2, $arg3) {} Arguments may, among other things, have default value. When this is the case, the arguments has to be at the end of the signature. Thus, function goodSignature($arg1, […]