Posts

Showing posts from June, 2017

Code quality analysis of Drupal. Can I use Sonar?

For better understanding: https://docs.acquia.com/article/tools-analyzing-your-drupal-codebase Following artcle my experience with Sonar and  Drupal. https://docs.sonarqube.org/display/PLUG/SonarPHP has following number of rules. Sonarway (for PHP) has following number of rules 1. Bug:15 2. Vulnerability:3 3. Code smell:45 Drupal has following number of rules 1. Bug: 3 2. Vulnerability: 0 3. Code smell: 10 Its possible that you can define following inheritance in Quality profile. For example: Sonarway=>Drupal Drupal uses PHPCodeSniffer (Drupal standards) or Coder to verify its coding standards. Both of them dont have integration with Sonar. 3. Sonar comes up with some Drupal Coding Standards. But is is not same as what we do in PHPCodeSniffer and Coder. 4. It's still better to fix critical / blocker issues from Sonar Way and Drupal Quality profiles. Its best to use PHPCodeSniffer with Drupal standards and  some repor...

Sonar Installation and using with a project

The below instruction is to run in MAC. Installation of Sonar 5.6.6 Download sonarqube and extract. > cd sonarqube-5.6.6/bin/macosx-universal-64 start sonar > ./sonar.sh console Installing sonar scanner 1. Download sonar scanner sonar-scanner-3.0.3.778-macosx 2. Add the following in ~/.bash_profile export SONAR_RUNNER_HOME="/Users/gopi/Downloads/sonar-scanner-3.0.3.778-macosx" export PATH="/Users/gopi/Downloads/sonar-scanner-3.0.3.778-macosx/bin:$PATH" 3. refresh bash profile > source ~/.bash_profile Running sonar scanner go to your projects folder where you have source code to analyze 1. Create a file sonar-project.properties with following contents # This file is used by sonar-runner # # Required metadata sonar.projectKey=myproject sonar.projectName=custom modules only, features excluded sonar.projectVersion=1.0 # Comma-separated paths to directories with sources (required) sonar.sources=. sonar.exclusions=jquery*,note...