开发者

Jenkins CI - PHP Tools Question

开发者 https://www.devze.com 2023-03-15 08:28 出处:网络
I have Jenkins setup on my local Windows 7 dev environment, I used the instructions on http://jenkins-php.org/. Everything works...

I have Jenkins setup on my local Windows 7 dev environment, I used the instructions on http://jenkins-php.org/. Everything works...

Got a couple of questions regarding some of the PHP tools, I was not able to find any answers online...

  1. PHP Lines Of Code

    Is is possible to display the MAIN SUMMARY phploc returns on the project index page in Jenkins ?

    Example:

 Directories:                                         31
 Files:                                               63
 Lines of Code (LOC):                               5044
   Cyclomatic Complexity / Lines of Code:             0.07
 Comment Lines of Code (CLOC):                       730
 Non-Comment Lines of Code (NCLOC):                 4314
 Namespaces:                                           0
 Interfaces:                                           0
 Classes:                                             22
   Abstract:                                             0 (0.00%)
   Concrete:                                            22 (100.00%)
   Average Class Length (NCLOC):                       116
 Methods:                                             73
   Scope:
     Non-Static:                                         60 (82.19%)
     Static:                                             13 (17.81%)
   Visibility:
     Public:                                             63 (86.30%)
     Non-Public:                                         10 (13.70%)
   Average Method Length (NCLOC):                       35
   Cyclomatic Complexity / Number of Methods:         3.77
 Anonymous Functions:                                  0
 Functions:                                            3
 Constants:                                           21
   Global constants:                                    21
   Class constants:                                      0
 

I though I had seen that info somewhere in my project stats, but I can't find it anymore... I have the plots setup with the graphs as per the jenkins-php.org example but that does not display NUMBERS...

Any idea how I can display these stats on my project front page ?

  1. PHP Depend

    It is possible to generate a summary.xml file with the flag --summary-xml=${basedir}/build/logs/pdepend-s开发者_StackOverflow中文版ummary.xml. But Jenkins does not read that file when specified in the config menu > Post-build Actions > jDepend menu. It only accepts the jdepend.xml file...

    What is this summary file good for, do we need it and how can we display it in Jenkins ?

Thanx for your help in advance !

  • M


For PHPDepend, you can use this stylesheet to transform it: https://github.com/marcelog/Ci-Php-Phing-Example/blob/master/resources/pdepend.xsl and it will be published.

For PHPLoc, you have to publish "html artifacts".

In this article you can find how to integrate phploc, phpdepend, and other software metrics tools in the jenkins job page. I chose phing in this case to run everything, but you can use ant or other method to run the tools.

What is important here is the job configuration example (at end of the article), showing how to publish each and every one of the software metrics results. Also, the stylesheets needed to transform results so Jenkins can pick them up.

See the build.xml and build.properties files to see how phploc and phpdepend are invoked and how to transform their output with the given stylesheets. Again, the publish of the results is shown in the job configuration example

It really works great for me. Hope it helps you too :)

0

精彩评论

暂无评论...
验证码 换一张
取 消