Posts

Showing posts from 2015

Customize & Extend PHP Codesniffer ruleset for Sonar PHP Profile

Image
Customize & Extend PHP Codesniffer ruleset for Sonar PHP Profile Sonar the tool that we are using for our code review. For PHP sonar has plugin which uses a PHP Codesniffer PEAR package to sniff code for violations. Almost all of them are predefined. If there is a requirement to add few more rules to the default ruleset, there is a way to do it with PHP_Codesniffer pear package. How to customize default ruleset of PHP_Codesniffer ruleset for Sonar profile. Following are the steps when one needs to change the predefined value for a rule and make it configuratioble settings via sonar profile page user interface. Violation in your project, BREAK statement must be indented 4 spaces from SWITCH keyword. Here the statement is indented 2 space as per it's a code done for Drupal, but the rules show that we need 4 space which avoid the drupal standards . Here it is SwitchDeclarationBreakIndent is the rule name which is having that spe...

Sonar setup with local for PHP

Hi All, Please setup sonar in local machines. first validate your code in local, whatever you are committing the code should be 100% compliance. Please follow following instructions Installation Steps :         To setup a sonar for PHP we need to have following on our machine. JDK for Window/linux. Winant for Windows or ant for linux. PHP PEAR Install XDebug Sonar 3.6.3 http://dist.sonar.codehaus.org/sonar-3.6.3.zip Sonar PHP Plugin Code Sniffers for Drupal / Moodle and it's ruleset for sonar. build.xml file for creating a ant task. JDK for Window/Linux         Download and install the latest JDK from http://www.oracle.com/technetwork/java/javase/downloads/index.html on windows machine. Or can use smb://192.168.102.226/software/Java/Windows .         After installation Right click on “My Computer” >> ...