173
Sonar 10 METRICS FOR BETTER BUILDS

Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

  • Upload
    others

  • View
    13

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

Sonar

10 METRICS

FOR BETTER BUILDS

Page 2: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

http://delicious.com/matthew.mccullough/sonar

Page 3: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

What is this?Measurements are for managers

Page 4: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar
Page 5: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

measurements are for managers

Page 6: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

true...

Page 7: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

and also for developers

Page 8: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar
Page 9: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

what measurements?

Page 10: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar
Page 11: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

★Checkstyle★PMD★ Findbugs★ Cobertura★ Emma★ Clirr★ JaCoCo★ Useless Code★ SQALE★ 20+ others...

Page 12: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

very little plaintext...

Page 13: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar
Page 14: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

instead, graphs

Page 15: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar
Page 16: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

and drill-downs

Page 17: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar
Page 19: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

MechanicsInstall, setup, config

Page 20: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

Download the zipcurrent version is 2.7

Page 21: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

http://sonarsource.org

Page 22: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

http://sonarsource.org

Page 23: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

Unpack it

Page 24: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar
Page 25: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

Put $SONAR_HOME/bin on your path

Page 26: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

Type sonar.sh start

Page 27: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar
Page 28: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

Database type?

Page 29: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar
Page 30: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

✓Derby

Page 31: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

✓Derby✓Oracle

Page 32: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

✓Derby✓Oracle✓MySQL

Page 33: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

✓Derby✓Oracle✓MySQL✓MS SQL

Page 34: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

✓Derby✓Oracle✓MySQL✓MS SQL✓PostgreSQL

Page 35: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

http://docs.sonarsource.org/display/SONAR/Install+Sonar

Page 36: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

AnalyzingMeasuring the code

Page 37: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

#To forcefully get a Sonar 2.4, Maven 3 compatible plugin

mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

Page 38: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

#...Or if you’ve never used Sonar before

mvn sonar:sonar

Page 39: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar
Page 40: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar
Page 41: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar
Page 42: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

Frequency and CIHudson, Bamboo and Friends

Page 43: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

How often?

Page 44: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

Not too often

Page 45: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

But enough to get good granularity

Page 46: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

Once per day

Page 47: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

Twice per day

Page 48: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

(a reasonable maximum)

Page 49: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

Why measure?Humans, numbers, and bad intuition

Page 50: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

managers distrust developers impulses

Page 51: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

impulses are incongruent with...

Page 52: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

our personal best interests

Page 53: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

our corporate best interests

Page 54: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

better at team agility

Page 55: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

better at leveraging frameworks

Page 56: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

as bad as ever choosing “what next?”

Page 57: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

JUnit: What to fix first

1. Tightly coupled classes?

2. Empty if-statements?

3. Test coverage?

4. Magic numbers?

Page 58: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

please don’t guess!

Page 59: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

please don’t guess!

Page 60: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

please don’t guess!

Page 61: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

analysis tools can provide the data

Page 62: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

“As the performance of the underlying systems improved... our ability to predict the performance of a program has eroded”

— Josh BlochChief Java Architect at Google

Page 63: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

measure, measure, measure

Page 64: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

act on that measurement’s implications

Page 65: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

measure again

Page 66: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

tiring

Page 67: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

who has time to glue the tools together?

Page 68: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar
Page 69: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

automate it!

Page 70: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar
Page 71: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

Our ShortcomingsAvoiding common mistakes

Page 72: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar
Page 73: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

“seven deadly developer sins”

Page 74: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

“seven deadly developer sins”

Page 75: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

★ Size / Complexity★ Unit Tests★ Duplication★ Coding Rules★ Potential Bugs★ Architecture★ Comments

Page 76: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

★ Size / Complexity★ Unit Tests★ Duplication★ Coding Rules★ Potential Bugs★ Architecture★ Comments

Page 77: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

★ Size / Complexity★ Unit Tests★ Duplication★ Coding Rules★ Potential Bugs★ Architecture★ Comments

Page 78: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

★ Size / Complexity★ Unit Tests★ Duplication★ Coding Rules★ Potential Bugs★ Architecture★ Comments

Page 79: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

★ Size / Complexity★ Unit Tests★ Duplication★ Coding Rules★ Potential Bugs★ Architecture★ Comments

Page 80: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

★ Size / Complexity★ Unit Tests★ Duplication★ Coding Rules★ Potential Bugs★ Architecture★ Comments

Page 81: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

★ Size / Complexity★ Unit Tests★ Duplication★ Coding Rules★ Potential Bugs★ Architecture★ Comments

Page 82: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

The MetricsRevealing the seven sins

Page 83: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

complexity

Page 84: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

LCOM4

• Lack of Cohesion Among Method of Class

Page 85: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

LCOM4

•Number of “connected components” in a class.

• Set of related methods and fields.

• Should be only one such component in each class.

• If 2 or more components, the class should be split.

Page 86: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

Cyclomatic Complexity

• Count of:

• if• for• while• case• catch• throw• return (not at end of method)• &&• ||• ?

Page 87: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

afferent coupling

• How many classes use this one?

• “Inbound links”

Page 88: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

efferent coupling

• How many other classes does this one use?

• “Outbound links”

Page 89: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

size

Page 90: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

lines of code

•One of the few raw dimensions

Page 91: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

unit tests

Page 92: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

Tests

• Line coverage

• Branch coverage

• % Passing

Page 93: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

duplication

Page 94: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

Duplication

•Duplicated code blocks

• Refactor into a single method

Page 95: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

Unused

• Private methods

• Protected method

Page 96: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

coding rules

Page 97: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

Code styling

• Selling source code?

• For readability

Page 98: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

potential bugs

Page 99: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

Findbugs

• Rule-based

• Common mistakes

• Risky practices

Page 100: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

architecture

Page 101: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

Coupling

• Package tangle

• 2 * (package_tangles / package_edges_weight) * 100

Page 102: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

comments

Page 103: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

Comments

•Documented functions, classes

• Undocumented APIs

• Commented lines of code

Page 104: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

timethe z axis

Page 105: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

Timeline

• Uses Google charting

Page 106: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

Motion Chart

•Dimensions not visible in numbers

Page 107: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

API Changes

• Backwards compatible APIs

Page 108: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

Build tools

Page 109: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

2or

3

Page 110: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar
Page 111: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar
Page 112: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

Bootstrap it with a tiny Maven POM

Page 113: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

<?xml version="1.0"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>[YOUR.ORGANIZATION]</groupId> <artifactId>[YOUR.PROJECT]</artifactId> <name>[YOUR PROJECT NAME]</name> <version>[YOUR PROJECT VERSION]</version>

<build> <sourceDirectory>[YOUR SOURCE DIRECTORY]</sourceDirectory> <outputDirectory>[YOUR CLASSES/BIN DIRECTORY</outputDirectory> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.5</source> <target>1.5</target> <excludes> <exclude>**/*.*</exclude> </excludes> </configuration> </plugin> </plugins> </build>

<properties> <sonar.dynamicAnalysis>false</sonar.dynamicAnalysis> </properties>

</project>

Page 114: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar
Page 115: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

Bootstrap it with a tiny Maven POM

Page 116: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

<?xml version="1.0"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>[YOUR.ORGANIZATION]</groupId> <artifactId>[YOUR.PROJECT]</artifactId> <name>[YOUR PROJECT NAME]</name> <version>[YOUR PROJECT VERSION]</version>

<build> <sourceDirectory>[YOUR SOURCE DIRECTORY]</sourceDirectory> <outputDirectory>[YOUR CLASSES/BIN DIRECTORY</outputDirectory> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.5</source> <target>1.5</target> <excludes> <exclude>**/*.*</exclude> </excludes> </configuration> </plugin> </plugins> </build>

<properties> <sonar.dynamicAnalysis>false</sonar.dynamicAnalysis> </properties>

</project>

Page 117: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar
Page 118: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

Jenkins?

Page 119: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

install the Hudson Sonar Plugin

Page 120: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar
Page 121: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

setup the Hudson Sonar Plugin

Page 122: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar
Page 123: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

use the Hudson Sonar Plugin

Page 124: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar
Page 125: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

Other LanguagesThe JVM and beyond

Page 126: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

Sonar works with Java

Page 127: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

Javasupported out of the box

Page 128: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

But not just Java

Page 129: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

GroovyAct I

Page 130: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

<?xml version="1.0"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion>

<groupId>my.group.id</groupId> <artifactId>arifactId</artifactId> <version>1.0</version> <packaging>pom</packaging> <name>The Name of My Project</name>

<build> <sourceDirectory>src/main/groovy</sourceDirectory> </build>

<properties> <sonar.language>grvy</sonar.language> <sonar.dynamicAnalysis>false</sonar.dynamicAnalysis> </properties></project>

Page 131: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

PL/SQL

Page 132: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

worried

Page 133: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

Flex

Page 134: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

PHP

Page 135: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

C#

Page 136: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

<?xml version="1.0"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion>

<groupId>com.whatever</groupId> <artifactId>my-solution</artifactId> <version>1.2.3-SNAPSHOT</version> <name>My solution</name> <packaging>sln</packaging> <properties> <!-- NOTE : the versions and parameters may be defined as properties Prefer this option to the plugin specific configuration as it may be accessible to several plugins --> <visual.studio.solution>MySolution.sln</visual.studio.solution> <visual.test.project.pattern>*.Tests;*Test</visual.test.project.pattern> <dotnet.tool.version>4.0</dotnet.tool.version> <sonar.language>cs</sonar.language> </properties>

<build> <plugins> <plugin> <groupId>org.codehaus.sonar-plugins.dotnet</groupId> <artifactId>maven-dotnet-plugin</artifactId> <extensions>true</extensions> </plugin> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>sonar-maven-plugin</artifactId> <configuration> <language>cs</language> </configuration> </plugin> </plugins> </build></project>

Page 137: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar
Page 138: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

Seriously.

Page 139: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

Visual Basic 6

Page 140: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

Cobol

Page 141: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

Sonar has become a Multi-Languages Platform

By Olivier Gaudin on September 16, 2010 » tags languages, plugins

At the beginning of this year, Freddy mentioned in the Sonar roadmap for 2010 that after version 2.0 the main objective was to enable otherlanguages on the Sonar platform through plugins. Nine months later, we have made very good progress on this subject and I wanted to take achance to report on it.

Java is currently the only language that is built in Sonar Core. This means that when you install the platform, the support for Java is therealready. All other languages get supported through plugins. All those plugins are obviously available on the forge of plugins withdocumentation. But here is a slightly different view, based on whether what we call “the 7 deadly sins of the developers” get covered in Sonarfor the language :

Size & Complexity Unit Tests Duplication Coding Rules Potential Bugs Architecture Comments

Cobol(Commercial)

Flex(LGPL v3)

Groovy(LGPL v3)

Java(Built-in)

PHP(LGPL v3)

PL/SQL(Commercial)

VB6(Commercial)

Web(Apache 2.0)

.Net(LGPL v3)

Most of those plugins are still young, have got room for improvement and the community is working on them. But they all bring already a lot ofvalue to the project teams.

Let’s now review what is on the path in the short term :

A C plugin will be released soonWe plan to provide a core to the C# plugin before the end of the yearA Natural plugin will be release in october

Of course all those plugins can be installed in a single Sonar instance to centralize the quality management of an heterogeneous portfolio ofapplications. No need for a tool per language anymore !

Page 142: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

Sonar has become a Multi-Languages Platform

By Olivier Gaudin on September 16, 2010 » tags languages, plugins

At the beginning of this year, Freddy mentioned in the Sonar roadmap for 2010 that after version 2.0 the main objective was to enable otherlanguages on the Sonar platform through plugins. Nine months later, we have made very good progress on this subject and I wanted to take achance to report on it.

Java is currently the only language that is built in Sonar Core. This means that when you install the platform, the support for Java is therealready. All other languages get supported through plugins. All those plugins are obviously available on the forge of plugins withdocumentation. But here is a slightly different view, based on whether what we call “the 7 deadly sins of the developers” get covered in Sonarfor the language :

Size & Complexity Unit Tests Duplication Coding Rules Potential Bugs Architecture Comments

Cobol(Commercial)

Flex(LGPL v3)

Groovy(LGPL v3)

Java(Built-in)

PHP(LGPL v3)

PL/SQL(Commercial)

VB6(Commercial)

Web(Apache 2.0)

.Net(LGPL v3)

Most of those plugins are still young, have got room for improvement and the community is working on them. But they all bring already a lot ofvalue to the project teams.

Let’s now review what is on the path in the short term :

A C plugin will be released soonWe plan to provide a core to the C# plugin before the end of the yearA Natural plugin will be release in october

Of course all those plugins can be installed in a single Sonar instance to centralize the quality management of an heterogeneous portfolio ofapplications. No need for a tool per language anymore !

Page 143: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

PluginsExtending the analysis

Page 144: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

manual install of pluginsprior to v2.4

Page 145: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

now, a web UI for plugins

Page 146: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

but first, log in...

Page 147: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar
Page 148: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

then plugins...

Page 149: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar
Page 150: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

plugins galore...

Page 151: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar
Page 152: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

some are commercial

Page 153: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

most are open source

Page 154: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

motion chart...

Page 155: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar
Page 156: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

Google charting engine

Page 157: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

web connectivity may be required

Page 158: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

exposes coding impacts over time

Page 159: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar
Page 160: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

IDEsMapping metrics to the editor

Page 161: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

But wait, there’s more!

Page 162: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

IDEs

Page 163: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar
Page 164: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar
Page 165: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar
Page 166: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar
Page 167: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

Discover human-to-code interdependencies

Page 168: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

If you can’t measure it...

Page 169: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

can’t prove you are

spending time wisely

Page 170: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

Measure twice

Page 171: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

Cut once

Page 172: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

Sonar

10 METRICS

FOR BETTER BUILDS

Page 173: Sonar - 33degree.org33degree.org/pdf/MatthewMcCulloughSonar.pdf · #To forcefully get a Sonar 2.4, Maven 3 compatible plugin mvn org.codehaus.mojo:sonar-maven-plugin:2.0-beta-1:sonar

• Punch Cardhttp://farm1.static.flickr.com/82/247968267_49cf34e1d5_o.jpg

• MonkeysFlickr Creative Commons

• Cups and Ballshttp://www.flickr.com/photos/laanba/4408687132/

• Chocolate Strawberrieshttp://www.flickr.com/photos/raggle/3224971811/

• http://iStockPhoto.com

• http://AmbientIdeasPhotography.com

Credits