Search code examples
phpdrupalsonarqubesonar-runnersonarqube-5.0

SonarQube for Drupal Projects


Currently i am using SonarQube with latest version 5.0 .

I am using SonarQube for scanning PHP projects with PHP plugin.

Now there some queries which i having regarding SonarQube and PHP Plugin.

  1. Why SonarQube guys deprecated the old PHP Plugin which is more configurable than the Previous one.
  2. Is it possible to Analyze Drupal Projects with SonarQube.

Thanks in advance for the answers.


Solution

  • After doing so much research for SonarQube Coding Standards i came to following conclusion.

    please find below my comments for the questions that i asked previously.

    1. Because of some security reasons, SonarQube guys modified the plugin and removed the configuration part from PHP plugin. However, the configuration part is till present for JAVA(SonarQube version 5.0)

    2. Yes, We can scan Drupal projects with SonarQube. This is possible after SonarQube version 5.1 where they have provided a separate Quality profile for Drupal Projects. set that profile as default while analyzing.

    Also you have to used file suffixes within your project properties file.

    sonar.php.file.suffixes= file extensions that you have to scan
    

    Default extensions scanned by PHP Plugins are php,php3,php4,php5,phtml,inc As Drupal Contains files with extension such as .module and .install. To enable Sonar to analyze these files, you have to add the same in above mentioned key.

    You can also enable this using Dashboard where you can globally set the same properties within PHP plugin.

    There is one more alternative, if you don't want to use Sonar. I am using Coder(Static code analysis tool for Drupal) and integrating the same with Jenkins. Through ANT/Phing I am triggering the static code analysis and generate various reports and displayed in Jenkins Dashboard.