Posts

Showing posts from September, 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...