Training material   sonar v1
Upcoming SlideShare
Loading in...5
×
 

Training material sonar v1

on

  • 460 views

Presentation on Sonar

Presentation on Sonar

Statistics

Views

Total Views
460
Views on SlideShare
457
Embed Views
3

Actions

Likes
0
Downloads
15
Comments
0

2 Embeds 3

http://shinusworkspace.blogspot.in 2
http://shinusworkspace.blogspot.com 1

Accessibility

Upload Details

Uploaded via as Microsoft PowerPoint

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
  • Blocker = number of PMD blocker issuesCritical = number of PMD critical issuesMajor = number of PMD major issuesMinor = number of PMD minor issuesInfo = number of PMD info issues
  • Blocker = number of PMD blocker issuesCritical = number of PMD critical issuesMajor = number of PMD major issuesMinor = number of PMD minor issuesInfo = number of PMD info issues
  • Blocker = number of PMD blocker issuesCritical = number of PMD critical issuesMajor = number of PMD major issuesMinor = number of PMD minor issuesInfo = number of PMD info issuesCyclomatic ComplexityThe Cyclomatic Complexity is measured by the number of (&&, ||) operators and (if, while, do, for, ?:, catch, switch, case, return, throw) statements in the body of a class plus one for each constructor, method (but not getter/setter), static initializer, or instance initializer in the class. The last return stament in method, if exists, is not taken into account.Even when the Cyclomatic Complexity of a class is very high, this complexity might be well distributed among all methods. Nevertheless, most of the time, a very complex class is a class which breaks the Single Responsibility Principle and which should be re-factored to be split in several classes.
  • Blocker = number of PMD blocker issuesCritical = number of PMD critical issuesMajor = number of PMD major issuesMinor = number of PMD minor issuesInfo = number of PMD info issues
  • Blocker = number of PMD blocker issuesCritical = number of PMD critical issuesMajor = number of PMD major issuesMinor = number of PMD minor issuesInfo = number of PMD info issues

Training material   sonar v1 Training material sonar v1 Presentation Transcript

  • Training Material Sonar 11th October 2013 By Shinu Suresh
  • Agenda • Introduction • Sonar Portal • Statistics • Navigation • Violations
  • Introduction • A platform to manage code quality • Free, Open source, LGPL web based portal • Aggregates will know Code Review tools • Static Analysis – PMD, Findbugs, Checkstyle • Duplicate Code – (Squid, CPD) • Code Coverage – (Cobertura, JaCoCo) • Easy to integrate with Jenkins build
  • Sonar Portal
  • Sonar Basic Statistics
  • Quality Index • Derived based on 4 pillars Quality Index = 10 - 4.5 * Coding - 2 * Complexity - 2 * Coverage - 1.5 * Style • Coding • Checks for PMD compliance. Rule applied is Coding = (Blocker * 10 + Critical * 5 + Major * 3 + Minor + Info) / (Lines of Code - Duplicated Lines) • Complexity • Checks for method complexities. Rule applied is Complexity = (Complexity>30 * 10 + Complexity>20 * 5 + Complexity>10 * 3 + Complexity>1) / (Lines of Code - Duplicated Lines) • Coverage • Coverage of Unit Tests • Style • Check style compliance index. Rule applied is Style = (Errors * 10 + Warnings) / (Lines of Code - Duplicated Lines) * 10
  • Size Metrics • Lines of Code • Classes • Packages • Methods • Accessors
  • Complexity • Cyclomatic Complexity • Method • Class • File Complexities over 10 will be flagged
  • Rules Compliance • Issues • Rules Compliance • Issue Types
  • Duplications • Analyses duplications with in • Class File • Project • Multiple Projects
  • Navigation
  • Navigating to Issue Drill down
  • Navigating to Specific file
  • Violations
  • Violations - Examples
  • Violations – Examples Cont
  • Managing Violations • For Each violation You Can • • • • • Comment Change its severity Declare it as a false-positive Assign it to someone Assign it to an action plan
  • Unresolved issues in Project
  • What now • What to Start With • Check violations for your project • Remove duplicate code • Improve test coverage