Sonar qube to impove code quality

10

Click here to load reader

description

A presentation on SonarQube and my personal experience using it to learn about a project - presented at the Software Craftsmanship unconference - Socrates UK.

Transcript of Sonar qube to impove code quality

Page 1: Sonar qube   to impove code quality

SonarQubetm

to improve code quality !

Page 2: Sonar qube   to impove code quality

Introduction- quick show of hands about SonarQubetm (previously Sonar)- code-base in Java, maybe some Python & Javascript- Definition of code crinkliness: from the static analysis and code-coverage point of views- not an expert, still learning about SonarQube- still learning to write quality code- build this session as we go, learn and improve together- lots of room for improvement

http://bit.ly/1lk8NDW

Page 3: Sonar qube   to impove code quality

Demo

- git logs- Sonar Dashboard widgets (for e.g. Quality metrics tab)

- show source code- show changesets and pull requests- strategy (continuously improving)

http://bit.ly/1lk8NDW

Page 4: Sonar qube   to impove code quality

Strategy (method to madness)

- Most violated rules (Blockers, Critical, Major, Minor violations)- Unit test coverage: Emma, IntelliJ Code Coverage check- Integration test coverage- Performance / non-functional testing, GC analysis (Java/JVM platforms only, JMH benchmarking) - Package Tangle Index (complexity)- Complexity (method / function, class-level)- Apply SonarGraph

http://bit.ly/1lk8NDW

Page 5: Sonar qube   to impove code quality

Strategy (haven’t applied, very but interesting)

- Squale - Technical Debt pyramid- LCOM- Toxicity Chart & Clouds- Apply PIT Mutation testing - Apply generative tests (QuickCheck)- Apply Mutability Detector library- Analyse using JitWatch (improve Jit compilation attempts)

http://bit.ly/1lk8NDW

Page 6: Sonar qube   to impove code quality

Benefits- Learn Checkstyle, Findbugs & PMD rules as you go- Learn through repetition & build muscle memory- Measure the improvement (history, timeline)- Measure your progress- Build quality profiles & dashboards- Identify unused / dead code- Identify Hotspot (areas of concern, maybe ready for refactoring)- Pairing an entity that gives consistent results (when you don’t have a human-partner to pair with)- A powerful ally when tweaked and fine-tuned- A short-feedback loop

http://bit.ly/1lk8NDW

Page 7: Sonar qube   to impove code quality

Resources● SonarQube resources● Installing SonarQube (formerly Sonar) on MacOsX Mountain Lion● Using SonarQube on MacOsX Mountain Lion● SonarGraph (http://www.hello2morrow.com/products/sonargraph)● Jitwatch: http://github.com/AdoptOpenJDK/jitwatch● Book: Sonar in Action (http://www.manning.com/papapetrou/)● QuickCheck (https://bitbucket.org/blob79/quickcheck)● PIT Mutation Testing (http://pitest.org/)● Mutability Detector (https://github.com/MutabilityDetector/)● Presentation on Sonar strategies (link to follow)

http://bit.ly/1lk8NDW

Page 8: Sonar qube   to impove code quality

Q & A

Its your time to share your methods and help me improve my craft !

http://bit.ly/1lk8NDW

Page 9: Sonar qube   to impove code quality

Thanks

- Chris Jeffrey, Brad & Rachel- LSCC- Socrates (UK & Germany)

http://bit.ly/1lk8NDW

Page 10: Sonar qube   to impove code quality

Feedback

mani@theNeomatrix369

http://bit.ly/1lk8NDW