geerlingguy / drupalci-sonar-jenkins

DEPRECATED - Drupal CI environment with SonarQube and Jenkins for Drupal Core code analysis.
41 stars 16 forks source link

Jenkins Jobs fail because of PHPCS #8

Closed legovaer closed 9 years ago

legovaer commented 9 years ago

Started by user anonymous Building in workspace /var/lib/jenkins/jobs/Drupal 7/workspace No JDK named ‘(Inherit From Job)’ found No JDK named ‘(Inherit From Job)’ found Cloning the remote Git repository Cloning repository http://git.drupal.org/project/drupal.git

git init /var/lib/jenkins/jobs/Drupal 7/workspace/drupal # timeout=10 Fetching upstream changes from http://git.drupal.org/project/drupal.git git --version # timeout=10 git fetch --tags --progress http://git.drupal.org/project/drupal.git +refs/heads/:refs/remotes/origin/ git config remote.origin.url http://git.drupal.org/project/drupal.git # timeout=10 git config remote.origin.fetch +refs/heads/:refs/remotes/origin/ # timeout=10 git config remote.origin.url http://git.drupal.org/project/drupal.git # timeout=10 Fetching upstream changes from http://git.drupal.org/project/drupal.git git fetch --tags --progress http://git.drupal.org/project/drupal.git +refs/heads/:refs/remotes/origin/ git rev-parse origin/7.x^{commit} # timeout=10 Checking out Revision f1e15c1d6579f5d656b5792746b230a67e533168 (origin/7.x) No JDK named ‘(Inherit From Job)’ found git config core.sparsecheckout # timeout=10 git checkout -f f1e15c1d6579f5d656b5792746b230a67e533168 First time build. Skipping changelog. git tag -a -f -m Jenkins Build #1 jenkins-Drupal_7-1 # timeout=10 No JDK named ‘(Inherit From Job)’ found [workspace] $ /usr/local/sonar-runner/bin/sonar-runner -Dsonar.jdbc.driver=com.mysql.jdbc.Driver -Dsonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?autoReconnect=true ** **** -Dsonar.host.url=http://localhost:9000 "-Dsonar.projectBaseDir=/var/lib/jenkins/jobs/Drupal 7/workspace" -Dproject.settings=/etc/sonar/sonar-7.properties SonarQube Runner 2.3 Java 1.7.0_75 Oracle Corporation (64-bit) Linux 2.6.32-504.3.3.el6.x86_64 amd64 INFO: Runner configuration file: /usr/local/sonar-runner/conf/sonar-runner.properties INFO: Project configuration file: /etc/sonar/sonar-7.properties INFO: Default locale: "enUS", source code encoding: "UTF-8" INFO: Work directory: /var/lib/jenkins/jobs/Drupal 7/workspace/.sonar INFO: SonarQube Server 3.7.4 16:32:34.326 INFO - Load batch settings 16:32:34.390 INFO - User cache: /var/lib/jenkins/.sonar/cache 16:32:34.396 INFO - Install plugins 16:32:34.578 INFO - Install JDBC driver 16:32:34.587 INFO - Create JDBC datasource for jdbc:mysql://localhost:3306/sonar?autoReconnect=true 16:32:35.817 INFO - Initializing Hibernate 16:32:38.210 INFO - Load project settings 16:32:38.262 INFO - Apply project exclusions 16:32:38.418 INFO - ------------- Scan Drupal 7 16:32:38.423 INFO - Load module settings 16:32:38.972 INFO - Quality profile : [name=Drupal,language=php] 16:32:38.991 INFO - Excluded sources: 16:32:38.991 INFO - */.features. 16:32:38.991 INFO - /_.fieldgroup.inc 16:32:38.991 INFO - **/.strongarm.inc 16:32:38.991 INFO - */_.views_default.inc 16:32:38.991 INFO - Excluded tests: 16:32:38.991 INFO - /package-info.java 16:32:39.026 INFO - Configure Maven plugins 16:32:39.088 INFO - Compare to previous analysis 16:32:39.113 INFO - Compare over 30 days (2015-01-05) 16:32:39.128 INFO - Compare to previous version 16:32:39.384 INFO - Base dir: /var/lib/jenkins/jobs/Drupal 7/workspace 16:32:39.384 INFO - Working dir: /var/lib/jenkins/jobs/Drupal 7/workspace/.sonar 16:32:39.384 INFO - Source dirs: /var/lib/jenkins/jobs/Drupal 7/workspace/drupal 16:32:39.384 INFO - Source encoding: UTF-8, default locale: en_US 16:32:40.040 INFO - Sensor PHP Source Importer... 16:32:48.280 INFO - Sensor PHP Source Importer done: 8240 ms 16:32:48.280 INFO - Sensor NoSonar and Commented out LOC Sensor... 16:32:48.962 INFO - Sensor NoSonar and Commented out LOC Sensor done: 682 ms 16:32:48.963 INFO - Sensor CpdSensor... 16:32:48.963 INFO - SonarBridgeEngine is used 16:32:49.032 INFO - Cross-project analysis disabled 16:32:53.060 INFO - Sensor CpdSensor done: 4097 ms 16:32:53.061 INFO - Sensor PHP Lexer Sensor... 16:33:00.434 INFO - Sensor PHP Lexer Sensor done: 7373 ms 16:33:00.434 INFO - Sensor PHP Depend Sensor... 16:33:00.438 INFO - Executing command: pdepend --version 16:33:00.470 INFO - PHP_Depend @package_version@ by Manuel Pichler 16:33:00.470 INFO - 16:33:00.472 INFO - Executing command: pdepend --summary-xml=/var/lib/jenkins/jobs/Drupal 7/workspace/.sonar/pdepend.xml --suffix=php,inc,module,install /var/lib/jenkins/jobs/Drupal 7/workspace/drupal 16:33:00.492 INFO - PHP_Depend @package_version@ by Manuel Pichler 16:33:00.493 INFO - 16:33:00.504 INFO - Parsing source files: 16:33:18.329 INFO - ............................................................ 60 16:33:31.069 INFO - ............................................................ 120 16:33:50.191 INFO - ............................................................ 180 16:34:10.399 INFO - ............................................................ 240 16:34:26.956 INFO - ............................................................ 300 16:35:24.023 INFO - ............................................................ 360 16:36:11.459 INFO - ............................................................ 420 16:36:12.858 INFO - ................... 439 16:36:12.858 INFO - 16:36:13.008 INFO - Executing CyclomaticComplexity-Analyzer: 16:36:31.631 INFO - ............................................................ 1200 16:36:48.690 INFO - ............................................................ 2400 16:37:04.618 INFO - ............................................................ 3600 16:37:16.947 INFO - ............................................................ 4800 16:37:32.531 INFO - ........................................................ 5933 16:37:32.531 INFO - 16:37:32.542 INFO - Executing ClassLevel-Analyzer: 16:37:55.965 INFO - ............................................................ 1200 16:37:55.982 INFO - ............................................................ 2400 16:37:56.779 INFO - ............................................................ 3600 16:37:56.796 INFO - ............................................................ 4800 16:37:56.809 INFO - ............................................................ 6000 16:37:57.617 INFO - ............................................................ 7200 16:37:57.631 INFO - ............................................................ 8400 16:37:58.444 INFO - ............................................................ 9600 16:37:58.457 INFO - ............................................................ 10800 16:37:58.470 INFO - ............................................................ 12000 16:37:59.302 INFO - ............................................................ 13200 16:37:59.316 INFO - ............................................................ 14400 16:37:59.328 INFO - ............................................................ 15600 16:38:00.116 INFO - ............................................................ 16800 16:38:01.358 INFO - ..... 16910 16:38:01.358 INFO - 16:38:01.358 INFO - Executing CodeRank-Analyzer: 16:38:01.387 INFO - ............................................................ 1200 16:38:02.198 INFO - ............................................................ 2400 16:38:02.204 INFO - ............................................................ 3600 16:38:02.210 INFO - ............................................................ 4800 16:38:02.217 INFO - ............................................................ 6000 16:38:02.223 INFO - ............................................................ 7200 16:38:02.236 INFO - ............................................................ 8400 16:38:02.237 INFO - ............................................................ 9600 16:38:02.237 INFO - ............................................................ 10800 16:38:03.020 INFO - ............................................................ 12000 16:38:03.028 INFO - ............................................................ 13200 16:38:03.035 INFO - ............................................................ 14400 16:38:03.042 INFO - ............................................................ 15600 16:38:03.054 INFO - ......... 15783 16:38:03.055 INFO - 16:38:03.055 INFO - Executing Cohesion-Analyzer: 16:38:07.086 INFO - ............................................................ 1200 16:38:11.150 INFO - ............................................................ 2400 16:38:11.972 INFO - ............................................................ 3600 16:38:11.979 INFO - ............................................................ 4800 16:38:11.985 INFO - ............................................................ 6000 16:38:12.753 INFO - ............................................................ 7200 16:38:12.759 INFO - ............................................................ 8400 16:38:12.766 INFO - ............................................................ 9600 16:38:12.772 INFO - ............................................................ 10800 16:38:12.778 INFO - ............................................................ 12000 16:38:12.785 INFO - ............................................................ 13200 16:38:12.791 INFO - ............................................................ 14400 16:38:12.797 INFO - ............................................................ 15600 16:38:13.599 INFO - ............................................................ 16800 16:38:13.605 INFO - ............................................................ 18000 16:38:14.426 INFO - ........................... 18543 16:38:14.426 INFO - 16:38:14.426 INFO - Executing Coupling-Analyzer: 16:38:23.421 INFO - ............................................................ 1200 16:38:38.475 INFO - ............................................................ 2400 16:38:54.518 INFO - ............................................................ 3600 16:39:07.769 INFO - ............................................................ 4800 16:39:23.531 INFO - ............................................................ 6000 16:39:26.293 INFO - ... 6077 16:39:26.293 INFO - 16:39:26.293 INFO - Executing Hierarchy-Analyzer: 16:39:33.892 INFO - ............................................................ 1200 16:39:34.774 INFO - ............................................................ 2400 16:39:34.782 INFO - ............................................................ 3600 16:39:34.787 INFO - ............................................................ 4800 16:39:35.597 INFO - ......................................................... 5947 16:39:35.597 INFO - 16:39:35.597 INFO - Executing Inheritance-Analyzer: 16:40:20.582 INFO - ............................................................ 1200 16:40:20.589 INFO - ............................................................ 2400 16:40:20.596 INFO - ............................................................ 3600 16:40:20.603 INFO - ............................................................ 4800 16:40:20.609 INFO - ............................................................ 6000 16:40:20.616 INFO - ............................................................ 7200 16:40:21.408 INFO - ............................................................ 8400 16:40:21.415 INFO - ............................................................ 9600 16:40:21.420 INFO - ............................................................ 10800 16:40:21.427 INFO - ............................................................ 12000 16:40:21.432 INFO - ............................................................ 13200 16:40:21.439 INFO - ............................................................ 14400 16:40:21.447 INFO - ............................................................ 15600 16:40:22.237 INFO - ..................... 16025 16:40:22.238 INFO - 16:40:22.238 INFO - Executing NPathComplexity-Analyzer: 16:40:30.684 INFO - ............................................................ 1200 16:40:46.486 INFO - ............................................................ 2400 16:41:02.485 INFO - ............................................................ 3600 16:41:16.014 INFO - ............................................................ 4800 16:41:32.105 INFO - ......................................................... 5951 16:41:32.106 INFO - 16:41:32.109 INFO - Executing NodeCount-Analyzer: 16:41:40.427 INFO - ............................................................ 1200 16:41:40.435 INFO - ............................................................ 2400 16:41:40.442 INFO - ............................................................ 3600 16:41:40.450 INFO - ............................................................ 4800 16:41:41.205 INFO - .............................................. 5737 16:41:41.205 INFO - 16:41:41.207 INFO - Executing NodeLoc-Analyzer: 16:42:02.921 INFO - ............................................................ 1200 16:42:11.013 INFO - ............................................................ 2400 16:42:15.655 INFO - ............................................................ 3600 16:42:18.010 INFO - ............................................................ 4800 16:42:25.454 INFO - ............................................................ 6000 16:42:28.234 INFO - .... 6082 16:42:28.234 INFO - 16:42:28.261 INFO - Generating pdepend log files, this may take a moment. 16:42:39.708 INFO - 16:42:39.708 INFO - Time: 09:39; Memory: 602.50Mb 16:42:44.238 INFO - Sensor PHP Depend Sensor done: 583804 ms 16:42:44.238 INFO - Sensor PHP_CodeSniffer Sensor... 16:42:44.239 INFO - Executing command: phpcs --version 16:42:44.401 INFO - PHP_CodeSniffer version 1.5.3 (stable) by Squiz (http://www.squiz.net) 16:42:44.440 INFO - Executing command: phpcs --report-file=/var/lib/jenkins/jobs/Drupal 7/workspace/.sonar/phpcs.xml --report=checkstyle --standard=/var/lib/jenkins/jobs/Drupal 7/workspace/.sonar/build/logs/ruleset6752167420808142033.xml --extensions=php,inc,module,install /var/lib/jenkins/jobs/Drupal 7/workspace/drupal 16:42:44.487 INFO - PHP Fatal error: Uncaught exception 'PHP_CodeSniffer_Exception' with message 'Referenced sniff "Drupal.Semantics.Br.XHTMLBr" does not exist' in /var/lib/jenkins/.composer/vendor/squizlabs/php_codesniffer/CodeSniffer.php:847 16:42:44.487 INFO - Stack trace: 16:42:44.487 INFO - #0 /var/lib/jenkins/.composer/vendor/squizlabs/php_codesniffer/CodeSniffer.php(587): PHP_CodeSniffer->_expandRulesetReference(Object(SimpleXMLElement), '/var/lib/jenkin...', 0) 16:42:44.487 INFO - #1 /var/lib/jenkins/.composer/vendor/squizlabs/php_codesniffer/CodeSniffer.php(435): PHP_CodeSniffer->processRuleset('/var/lib/jenkin...') 16:42:44.487 INFO - #2 /var/lib/jenkins/.composer/vendor/squizlabs/php_codesniffer/CodeSniffer/CLI.php(614): PHP_CodeSniffer->process(Array, Array, Array, false) 16:42:44.488 INFO - #3 /var/lib/jenkins/.composer/vendor/squizlabs/php_codesniffer/scripts/phpcs(37): PHP_CodeSniffer_CLI->process() 16:42:44.488 INFO - #4 {main} 16:42:44.488 INFO - thrown in /var/lib/jenkins/.composer/vendor/squizlabs/php_codesniffer/CodeSniffer.php on line 847 INFO: ------------------------------------------------------------------------ INFO: EXECUTION FAILURE INFO: ------------------------------------------------------------------------ Total time: 10:11.318s Final Memory: 12M/289M INFO: ------------------------------------------------------------------------ ERROR: Error during Sonar runner execution ERROR: Unable to execute Sonar ERROR: Caused by: PHPCodeSniffer execution failed with returned code '255'. Please check the documentation of PHPCodeSniffer to know more about this failure. ERROR: ERROR: To see the full stack trace of the errors, re-run SonarQube Runner with the -e switch. ERROR: Re-run SonarQube Runner using the -X switch to enable full debug logging. Build step 'Invoke Standalone Sonar Analysis' marked build as failure Finished: FAILURE

geerlingguy commented 9 years ago

The key error there is:

16:42:44.487 INFO - PHP Fatal error: Uncaught exception 'PHP_CodeSniffer_Exception' with message 'Referenced sniff "Drupal.Semantics.Br.XHTMLBr" does not exist' in /var/lib/jenkins/.composer/vendor/squizlabs/php_codesniffer/CodeSniffer.php:847

You will either need to add that sniff to the SonarQube quality profile for PHP/Drupal, or remove it from the sniffs performed on the Drupal codebase... I've been trying to find a more automated way to add all relevant sniffs correctly, but it's really hard.

With SonarQube 4.x, I think it has a different mechanism for PHP sniffs, so this may be resolved when #2 is completed.

abhijeetka commented 9 years ago

@geerlingguy :+1: one question with which version of SonarQube you have implemented this?

have you tried the same with newer version of SonarQube (4.x or 5.0) ?

Please reply as i am working on the same and its not working for me .

Thanks in advance.

geerlingguy commented 9 years ago

@abhijeetka - I originally started this project with SonarQube 4.x, but found that 4.x's PHP analysis didn't actually work with PHPCS at all, only with internal SonarQube rules. That's why I've pinned this project on 3.x for now.

And AFAICT, there's no PHP standards available for 5.x yet :(

abhijeetka commented 9 years ago

@greenlingguy thanks for the information. Yes PHP standards are not available for 5.x :(