training material sonar v1

19
Training Material Sonar 11 th October 2013 By Shinu Suresh

Upload: shinu-suresh

Post on 20-May-2015

730 views

Category:

Art & Photos


1 download

DESCRIPTION

Presentation on Sonar

TRANSCRIPT

Page 1: Training material   sonar v1

Training MaterialSonar

11th October 2013By Shinu Suresh

Page 2: Training material   sonar v1

Agenda

• Introduction• Sonar Portal• Statistics• Navigation• Violations

Page 3: Training material   sonar v1

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

Page 4: Training material   sonar v1

Sonar Portal

Page 5: Training material   sonar v1

Sonar Basic Statistics

Page 6: Training material   sonar v1

Quality Index

• Derived based on 4 pillarsQuality 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 isStyle = (Errors * 10 + Warnings) / (Lines of Code - Duplicated Lines) * 10

Page 7: Training material   sonar v1

Size Metrics

• Lines of Code• Classes• Packages• Methods• Accessors

Page 8: Training material   sonar v1

Complexity

• Cyclomatic Complexity• Method• Class• File

Complexities over 10 will be flagged

Page 9: Training material   sonar v1

Rules Compliance

• Issues• Rules Compliance• Issue Types

Page 10: Training material   sonar v1

Duplications

• Analyses duplications with in• Class File• Project• Multiple Projects

Page 11: Training material   sonar v1

Navigation

Page 12: Training material   sonar v1

Navigating to Issue Drill down

Page 13: Training material   sonar v1

Navigating to Specific file

Page 14: Training material   sonar v1

Violations

Page 15: Training material   sonar v1

Violations - Examples

Page 16: Training material   sonar v1

Violations – Examples Cont

Page 17: Training material   sonar v1

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

Page 18: Training material   sonar v1

Unresolved issues in Project

Page 19: Training material   sonar v1

What now

• What to Start With• Check violations for your project• Remove duplicate code• Improve test coverage