sonarqube - · pdf filewhat is code quality? •in nutshell –it’s a indicator...

36
SonarQube www.scmGalaxy.com

Upload: vobao

Post on 12-Feb-2018

229 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: SonarQube -  · PDF fileWhat is Code Quality? •In Nutshell –It’s a indicator about how quickly developers can add business value to a software system

SonarQube

www.scmGalaxy.com

Page 3: SonarQube -  · PDF fileWhat is Code Quality? •In Nutshell –It’s a indicator about how quickly developers can add business value to a software system

Overview

• Code Quality (What, Why and When)

• The 7 Axes of Quality and then Technical debt

• SonarQube Introduction

• Demo

www.scmGalaxy.com

Page 4: SonarQube -  · PDF fileWhat is Code Quality? •In Nutshell –It’s a indicator about how quickly developers can add business value to a software system

What is Code Quality?

www.scmGalaxy.com

Page 5: SonarQube -  · PDF fileWhat is Code Quality? •In Nutshell –It’s a indicator about how quickly developers can add business value to a software system

What is Code Quality?

• In Nutshell – It’s a indicator about how quickly developers can add business value to a software system

www.scmGalaxy.com

Page 6: SonarQube -  · PDF fileWhat is Code Quality? •In Nutshell –It’s a indicator about how quickly developers can add business value to a software system

www.scmGalaxy.com

Page 7: SonarQube -  · PDF fileWhat is Code Quality? •In Nutshell –It’s a indicator about how quickly developers can add business value to a software system

www.scmGalaxy.com

Page 8: SonarQube -  · PDF fileWhat is Code Quality? •In Nutshell –It’s a indicator about how quickly developers can add business value to a software system

www.scmGalaxy.com

Page 9: SonarQube -  · PDF fileWhat is Code Quality? •In Nutshell –It’s a indicator about how quickly developers can add business value to a software system

Architecture & Design

Comments

Potential Bugs

Unit Tests

Duplications

Coding Rules

Complexity

Technical Debt

www.scmGalaxy.com

Page 10: SonarQube -  · PDF fileWhat is Code Quality? •In Nutshell –It’s a indicator about how quickly developers can add business value to a software system

www.scmGalaxy.com

Page 11: SonarQube -  · PDF fileWhat is Code Quality? •In Nutshell –It’s a indicator about how quickly developers can add business value to a software system

www.scmGalaxy.com

Page 12: SonarQube -  · PDF fileWhat is Code Quality? •In Nutshell –It’s a indicator about how quickly developers can add business value to a software system

What is SonarQube?

It is a open platform to Manage Code Quality!

www.scmGalaxy.com

Page 13: SonarQube -  · PDF fileWhat is Code Quality? •In Nutshell –It’s a indicator about how quickly developers can add business value to a software system

In Another Word.

• SonarQube is a web-based application.

• Rules, alerts, thresholds, exclusions, settings… can be configured online.

• By leveraging its database, SonarQube not only allows to combine metrics altogether but also to mix them with historical measures.

• Got a very efficient way of navigating, a balance between high-level view, dashboard, TimeMachine and defect hunting tools.

www.scmGalaxy.com

Page 14: SonarQube -  · PDF fileWhat is Code Quality? •In Nutshell –It’s a indicator about how quickly developers can add business value to a software system

www.scmGalaxy.com

Page 15: SonarQube -  · PDF fileWhat is Code Quality? •In Nutshell –It’s a indicator about how quickly developers can add business value to a software system

www.scmGalaxy.com

Page 16: SonarQube -  · PDF fileWhat is Code Quality? •In Nutshell –It’s a indicator about how quickly developers can add business value to a software system

www.scmGalaxy.com

Page 17: SonarQube -  · PDF fileWhat is Code Quality? •In Nutshell –It’s a indicator about how quickly developers can add business value to a software system

www.scmGalaxy.com

Page 18: SonarQube -  · PDF fileWhat is Code Quality? •In Nutshell –It’s a indicator about how quickly developers can add business value to a software system

www.scmGalaxy.com

Page 19: SonarQube -  · PDF fileWhat is Code Quality? •In Nutshell –It’s a indicator about how quickly developers can add business value to a software system

Extend with Plugins

Covering new languages, adding rules engines, computing advanced metrics can be done through a powerful extension mechanism. More than 50 plugins are already available.

www.scmGalaxy.com

Page 20: SonarQube -  · PDF fileWhat is Code Quality? •In Nutshell –It’s a indicator about how quickly developers can add business value to a software system

www.scmGalaxy.com

Page 21: SonarQube -  · PDF fileWhat is Code Quality? •In Nutshell –It’s a indicator about how quickly developers can add business value to a software system

Sonar – Basic statistics

www.scmGalaxy.com

Page 22: SonarQube -  · PDF fileWhat is Code Quality? •In Nutshell –It’s a indicator about how quickly developers can add business value to a software system

Sonar – Project Drill Down

www.scmGalaxy.com

Page 23: SonarQube -  · PDF fileWhat is Code Quality? •In Nutshell –It’s a indicator about how quickly developers can add business value to a software system

Sonar – Time Machine

www.scmGalaxy.com

Page 24: SonarQube -  · PDF fileWhat is Code Quality? •In Nutshell –It’s a indicator about how quickly developers can add business value to a software system

www.scmGalaxy.com

Page 25: SonarQube -  · PDF fileWhat is Code Quality? •In Nutshell –It’s a indicator about how quickly developers can add business value to a software system

Demo Time

www.scmGalaxy.com

Page 26: SonarQube -  · PDF fileWhat is Code Quality? •In Nutshell –It’s a indicator about how quickly developers can add business value to a software system

Pre Requisites

JDK 1.7 +

http://docs.sonarqube.org/display/SONAR/Requirements

www.scmGalaxy.com

Page 27: SonarQube -  · PDF fileWhat is Code Quality? •In Nutshell –It’s a indicator about how quickly developers can add business value to a software system

Download

• http://www.sonarqube.org/downloads/

www.scmGalaxy.com

Page 28: SonarQube -  · PDF fileWhat is Code Quality? •In Nutshell –It’s a indicator about how quickly developers can add business value to a software system

Install

1. Download and unzip the SonarQube distribution (let's say in "C:\sonarqube" or "/etc/sonarqube")

2. Start the SonarQube server:

# On Windows, execute:

C:\sonarqube\bin\windows-x86-xx\StartSonar.bat

# On other operating system, execute:

/etc/sonarqube/bin/[OS]/sonar.sh console

3. Download and unzip the SonarQube Scanner (let's say in "C:\sonar-runner" or "/etc/sonar-runner")

www.scmGalaxy.com

Page 29: SonarQube -  · PDF fileWhat is Code Quality? •In Nutshell –It’s a indicator about how quickly developers can add business value to a software system

4. Download and unzip some project samples (let's say in "C:\sonar-examples" or "/etc/sonar-examples")

5. Analyze a project:# On Windows:cd C:\sonar-examples\projects\languages\java\sonar-runner\java-sonar-runner-simpleC:\sonar-runner\bin\sonar-runner.bat

# On other operating system:cd /etc/sonar-examples/projects/languages/java/sonar-runner/java-sonar-runner-simple/etc/sonar-runner/bin/sonar-runner

www.scmGalaxy.com

Page 30: SonarQube -  · PDF fileWhat is Code Quality? •In Nutshell –It’s a indicator about how quickly developers can add business value to a software system

Dashboard Time

Browse the results at http://localhost:9000 (default System administrator credentials are admin/admin)

www.scmGalaxy.com

Page 31: SonarQube -  · PDF fileWhat is Code Quality? •In Nutshell –It’s a indicator about how quickly developers can add business value to a software system

Integration with MySql

• http://docs.sonarqube.org/display/SONAR/Installing+the+Server

www.scmGalaxy.com

Page 32: SonarQube -  · PDF fileWhat is Code Quality? •In Nutshell –It’s a indicator about how quickly developers can add business value to a software system

Integration with Maven

http://docs.sonarqube.org/display/SONAR/Analyzing+with+SonarQube+Scanner+for+Maven

www.scmGalaxy.com

Page 34: SonarQube -  · PDF fileWhat is Code Quality? •In Nutshell –It’s a indicator about how quickly developers can add business value to a software system

www.scmGalaxy.com

Page 35: SonarQube -  · PDF fileWhat is Code Quality? •In Nutshell –It’s a indicator about how quickly developers can add business value to a software system

SonarQube Using Docker

> docker pull library/sonarqube@sha256:e03b6c1f5195676dad7f3b5c02b818bf64a213fe34e04e3fb60103034fb50d5b>

Referencehttps://hub.docker.com/_/sonarqube/

www.scmGalaxy.com

Page 36: SonarQube -  · PDF fileWhat is Code Quality? •In Nutshell –It’s a indicator about how quickly developers can add business value to a software system

Questions

www.scmGalaxy.com