• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Sonar - the ring to rule them all
 

Sonar - the ring to rule them all

on

  • 2,768 views

With continuous integration process in place, at some point you will need to properly track the progress not only of the build itself, but also how in overall your code quality changes. You want to ...

With continuous integration process in place, at some point you will need to properly track the progress not only of the build itself, but also how in overall your code quality changes. You want to know whether the code complies to the rules you have set up, whether over time it gets better and at the same time you want to communicate the progress to the business. And all of that can be achieved with Sonar! This talk will fill the gap in my PHPNW10 talk "The Journey towards Continuous Integration" about Sonar and the state of PHP plugin for it.

Statistics

Views

Total Views
2,768
Views on SlideShare
2,659
Embed Views
109

Actions

Likes
4
Downloads
92
Comments
0

3 Embeds 109

http://criticallog.thornet.net 100
http://wordpress.thornet.net 7
http://www.linkedin.com 2

Accessibility

Categories

Upload Details

Uploaded via as OpenOffice

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Sonar - the ring to rule them all Sonar - the ring to rule them all Presentation Transcript

    • Sonar - the ring to rule them all Sebastian Marek
    • CI
      • Continuous Integration
        • automated builds
        • static code analysis
        • code coverage reports
    • CI
      • Continuous Inspection
        • code violations
        • code improvements
        • build stability
    • Technical debt under control
      • architecture & design
      • comments
      • coding rules
      • potential bugs
      • code duplications
      • unit tests
      • complexity
    • What is Sonar? “ Sonar is the central place to manage code quality, offering visual reporting on and across projects and enabling to replay the past to follow metrics evolution” source: http://www.sonarsource.org/
    • Sonar vs. phpUnderControl/Hudson Continuous Integration Platform vs. Reporting Platform
    • PHP support
      • PHP_Codesniffer
      • PHPUnit
      • PHP Depend
      • PHP Mess Detector
    • Requirements JDK 1.5+
      • Maven 2.0.9+, 2.1+, 2.2+
      • DB backend of your choice
        • MySQL
        • PostgreSQL
        • Oracle
        • MS SQL
    • Installation
      • download
      • unzip
      • run
    • Preparing for analysis – pom file <project xmlns =&quot; http://maven.apache.org/POM/4.0.0 &quot; xmlns:xsi =” http://www.w3.org/2001/XMLSchema-instance &quot; xsi:schemaLocation =&quot; http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd &quot;> <modelVersion> 4.0.0 </modelVersion> <groupId> org.bovigo </groupId> <artifactId> vfs </artifactId> <name> VFS_Stream </name> <version> 1.0 </version> <!-- For the moment,specify pom as packaging for php projects --> <packaging> pom </packaging> </project>
    • Preparing for analysis – pom file <build> <!-- You cannot omit this one, because maven will implicitely add src/main/java to it --> <sourceDirectory> ${basedir}/src/main/php </sourceDirectory> <testSourceDirectory> ${basedir}/src/test </testSourceDirectory> </build>
    • Preparing for analysis – pom file <!-- some properties that you may want to change --> <properties> <sonar.language> php </sonar.language> <sonar.phpPmd.shouldRun> true </sonar.phpPmd.shouldRun> <sonar.phpCodesniffer.shouldRun> true </sonar.phpCodesniffer.shouldRun> <sonar.phpDepend.shouldRun> true </sonar.phpDepend.shouldRun> <sonar.phpUnit.shouldRun> true </sonar.phpUnit.shouldRun> <sonar.phpcpd.shouldRun> true </sonar.phpcpd.shouldRun> </properties>
    • Maven configuration <profile> <id> php-profile </id> <properties> <sonar.jdbc.url> jdbc:mysql://localhost:3306/sonar?useUnicode=true&amp;characterEncoding=utf8 </sonar.jdbc.url> <sonar.jdbc.driver> com.mysql.jdbc.Driver </sonar.jdbc.driver> <sonar.jdbc.username> sonar </sonar.jdbc.username> <sonar.jdbc.password> s0n4rU53r </sonar.jdbc.password> </properties> </profile>
    • Maven configuration <activeProfiles> <activeProfile> php-profile </activeProfile> </activeProfiles>
    • Performing analysis #> mvn sonar:sonar
    • Integration
      • phpUnderControl via ant
      • Hudson via dedicated plugin
    • ant task <target name =&quot; sonar &quot;> <exec dir =&quot; ${basedir}/Source/ &quot; executable =&quot; mvn &quot; failonerror =&quot; false &quot; > <arg line =&quot; sonar:sonar &quot; /> </exec> </target>
    • Code complexity
    • Build results
    • Code violations
    • Time machine
    • Resources
      • http://www.sonarsource.org/
      • http://docs.codehaus.org/display/SONAR/PHP+Plugin
      • @SonarSource
      • http://criticallog.thornet.net/
    • Q&A