SlideShare a Scribd company logo
1 of 15
Download to read offline
SonarQube: Seven Deadly Software
Sins
Gnanaseelan , Senior Technology Architect
Who am I ?
• Senior Technical Architect @ Accenture Software
• Current Role
• Focusing on improving the software design /code quality
• Previous Roles:
• Application Architect, Infrastructure Architect and
Operation Architect for SOA Java Projects
Presentation Goals
• Knowledge of the Seven Deadly Developer Sins
• Role of SonarQube in identifying them
• Software patterns and principles to reduce the
same.
• Q/A
Sin
• Sin can be viewed as anything
that violates the ideal
relationship between an
individual and his conscience
• Software sin can be viewed as
anything that violates the ideal
relationship between an
software developer and
SonarQube.
Developer
Sin
Separates
Developer
and Code
SonarQube
Architecture/Design Sin 1 :
Violation of architecture layer
Presentation
Layer
Controller
Layer
Service Layer
Persistence
Layer
• MVC is a design
pattern to separate
the different layers.
• SonarQube helps
you to identify the
violations of the
architecture
patterns
Architecture/Design Sin 1 :
Violation of architecture layer
• Create Architecture
Rules
• Create Package
Structure
• no access to
*.controller.* from
*.dao.* classes
Architecture/Design Sin 2:
Creating Dependency Cycle
• Design Structure Matrix
(DSM) showing how
components depend
one on the other,
highlighting dependency
cycles and showing
details on dependencies
• Dependency –Inversion
Principle
• Interface Segregation
Principle
Complexity Sin 3:
High Cyclomatic Complexity
Lack of Proper Unit Test Sin 4:
• Make sure the JUnit tests are
aligned to business
requirements and it tests the
right business functionality.
• Check for both positive and
negative results
• Provide logical names for
your unit tests.
• Verify all the mock objects to
ensure unnecessary mocking
is not done for the test case.
• SonarQube also shares
the failures and errors
in the unit test success.
Un Documented Source Code Sin 5:
• Public API
• Public Class
• Public Method
• Public Property
• SonarQube measures the
quantity and not the quality
of the API
• Include the purpose of the
method also the
descriptions of input and
output parameters
/**
* Test Condition 1: Check
to make sure that the person is
responsible for the General Medical
Benefit
* Inputs: Eligible programs
to the rules engine.
* Expected Results:
Verified eligible programs are in the
results.
Duplicate Source Code Sin 6:
• Use Patterns like Extract
Method to reduce
duplication.
• Violates DRY principle
• SonarQube will help you to
identify the duplicate code
in the same file , project and
even across multiple
projects.
• SonarQube shares
the duplicate lines,
blocks and files
Coding Standard Breach Sin 7 :
Indication of
programmer
error
Severity
BugsPotential
bugs
Inefficiencies
BlockerCriticalMajorMinorInfo
Future
programmer error
Style
Issues require
urgent fix
Issues require
analysis
Source: Campbell, Papapetrou: SonarQube in Action
Bugs and Potential Bugs
• Bug (Blocker and Critical) : Failures to close file
handles or database connections
• Potential bugs (Critical or Major): Potential Null
pointer condition during a certain scenario
Bugs and Potential Bugs
• Indication of Programming error (Major) : Avoid
logging and throwing – as this results in multiple log
messages for the same problem. Exception should
be logged as the last resort error handler.
• Future Programming Error (Major/Minor): Methods
that are too long and complex.
• Inefficiencies (Minor) : Unused import and
methods.
SonarQube

More Related Content

What's hot

SonarQube: Continuous Code Inspection
SonarQube: Continuous Code InspectionSonarQube: Continuous Code Inspection
SonarQube: Continuous Code InspectionMichael Jesse
 
SonarQube - The leading platform for Continuous Code Quality
SonarQube - The leading platform for Continuous Code QualitySonarQube - The leading platform for Continuous Code Quality
SonarQube - The leading platform for Continuous Code QualityLarry Nung
 
Java Source Code Analysis using SonarQube
Java Source Code Analysis using SonarQubeJava Source Code Analysis using SonarQube
Java Source Code Analysis using SonarQubeAngelin R
 
Track code quality with SonarQube - short version
Track code quality with SonarQube - short versionTrack code quality with SonarQube - short version
Track code quality with SonarQube - short versionDmytro Patserkovskyi
 
Tracking and improving software quality with SonarQube
Tracking and improving software quality with SonarQubeTracking and improving software quality with SonarQube
Tracking and improving software quality with SonarQubePatroklos Papapetrou (Pat)
 
Code Quality Lightning Talk
Code Quality Lightning TalkCode Quality Lightning Talk
Code Quality Lightning TalkJonathan Gregory
 
What is SonarQube in DevOps.docx
What is SonarQube in DevOps.docxWhat is SonarQube in DevOps.docx
What is SonarQube in DevOps.docxDevOps University
 
Static Analysis with Sonarlint
Static Analysis with SonarlintStatic Analysis with Sonarlint
Static Analysis with SonarlintUT, San Antonio
 
Static code analysis with sonar qube
Static code analysis with sonar qubeStatic code analysis with sonar qube
Static code analysis with sonar qubeHayi Nukman
 
Sonarqube
SonarqubeSonarqube
SonarqubeCDS
 
Sonar Tool - JAVA code analysis
Sonar Tool - JAVA code analysisSonar Tool - JAVA code analysis
Sonar Tool - JAVA code analysisPrashant Gupta
 
Introduction to CICD
Introduction to CICDIntroduction to CICD
Introduction to CICDKnoldus Inc.
 

What's hot (20)

SonarQube Presentation.pptx
SonarQube Presentation.pptxSonarQube Presentation.pptx
SonarQube Presentation.pptx
 
SonarQube: Continuous Code Inspection
SonarQube: Continuous Code InspectionSonarQube: Continuous Code Inspection
SonarQube: Continuous Code Inspection
 
SonarQube - The leading platform for Continuous Code Quality
SonarQube - The leading platform for Continuous Code QualitySonarQube - The leading platform for Continuous Code Quality
SonarQube - The leading platform for Continuous Code Quality
 
Java Source Code Analysis using SonarQube
Java Source Code Analysis using SonarQubeJava Source Code Analysis using SonarQube
Java Source Code Analysis using SonarQube
 
Track code quality with SonarQube - short version
Track code quality with SonarQube - short versionTrack code quality with SonarQube - short version
Track code quality with SonarQube - short version
 
Track code quality with SonarQube
Track code quality with SonarQubeTrack code quality with SonarQube
Track code quality with SonarQube
 
Sonar Review
Sonar ReviewSonar Review
Sonar Review
 
Tracking and improving software quality with SonarQube
Tracking and improving software quality with SonarQubeTracking and improving software quality with SonarQube
Tracking and improving software quality with SonarQube
 
Sonar qube
Sonar qubeSonar qube
Sonar qube
 
Code Quality Lightning Talk
Code Quality Lightning TalkCode Quality Lightning Talk
Code Quality Lightning Talk
 
What is SonarQube in DevOps.docx
What is SonarQube in DevOps.docxWhat is SonarQube in DevOps.docx
What is SonarQube in DevOps.docx
 
Static Analysis with Sonarlint
Static Analysis with SonarlintStatic Analysis with Sonarlint
Static Analysis with Sonarlint
 
Jenkins with SonarQube
Jenkins with SonarQubeJenkins with SonarQube
Jenkins with SonarQube
 
Static code analysis with sonar qube
Static code analysis with sonar qubeStatic code analysis with sonar qube
Static code analysis with sonar qube
 
Sonarqube
SonarqubeSonarqube
Sonarqube
 
Sonar Tool - JAVA code analysis
Sonar Tool - JAVA code analysisSonar Tool - JAVA code analysis
Sonar Tool - JAVA code analysis
 
Code Quality
Code QualityCode Quality
Code Quality
 
BDD & Cucumber
BDD & CucumberBDD & Cucumber
BDD & Cucumber
 
Browser_Stack_Intro
Browser_Stack_IntroBrowser_Stack_Intro
Browser_Stack_Intro
 
Introduction to CICD
Introduction to CICDIntroduction to CICD
Introduction to CICD
 

Viewers also liked

Viewers also liked (10)

Sonar Overview
Sonar OverviewSonar Overview
Sonar Overview
 
Code Quality, Standards and Best Practices, Discuss
Code Quality, Standards and Best Practices, DiscussCode Quality, Standards and Best Practices, Discuss
Code Quality, Standards and Best Practices, Discuss
 
SonarQube 로 Unity 프로젝트 관리
SonarQube 로 Unity 프로젝트 관리SonarQube 로 Unity 프로젝트 관리
SonarQube 로 Unity 프로젝트 관리
 
DevOps – SonarQube
DevOps – SonarQubeDevOps – SonarQube
DevOps – SonarQube
 
Sonar
SonarSonar
Sonar
 
SONAR
SONARSONAR
SONAR
 
Sonar Metrics
Sonar MetricsSonar Metrics
Sonar Metrics
 
Sonar qube to impove code quality
Sonar qube   to impove code qualitySonar qube   to impove code quality
Sonar qube to impove code quality
 
Continuous integration using Jenkins and Sonar
Continuous integration using Jenkins and SonarContinuous integration using Jenkins and Sonar
Continuous integration using Jenkins and Sonar
 
SONAR
SONAR SONAR
SONAR
 

Similar to SonarQube

Understand release engineering
Understand release engineeringUnderstand release engineering
Understand release engineeringgaoliang641
 
Introducing systems analysis, design & development Concepts
Introducing systems analysis, design & development ConceptsIntroducing systems analysis, design & development Concepts
Introducing systems analysis, design & development ConceptsShafiul Azam Chowdhury
 
Capability Building for Cyber Defense: Software Walk through and Screening
Capability Building for Cyber Defense: Software Walk through and Screening Capability Building for Cyber Defense: Software Walk through and Screening
Capability Building for Cyber Defense: Software Walk through and Screening Maven Logix
 
Java Code Quality Tools
Java Code Quality ToolsJava Code Quality Tools
Java Code Quality ToolsAnju ML
 
Blackboard DevCon 2012 - Ensuring Code Quality
Blackboard DevCon 2012 - Ensuring Code QualityBlackboard DevCon 2012 - Ensuring Code Quality
Blackboard DevCon 2012 - Ensuring Code QualityNoriaki Tatsumi
 
Part5 - enforcing coding standard and best practices with jas forge v1.0
Part5 -  enforcing coding standard and best practices with jas forge v1.0Part5 -  enforcing coding standard and best practices with jas forge v1.0
Part5 - enforcing coding standard and best practices with jas forge v1.0Jasmine Conseil
 
Software Development Life Cycle (SDLC )
Software Development Life Cycle (SDLC )Software Development Life Cycle (SDLC )
Software Development Life Cycle (SDLC )eshtiyak
 
sdlc presentation.pptx
sdlc presentation.pptxsdlc presentation.pptx
sdlc presentation.pptxwaseemasghar20
 
Tools for Software Testing
Tools for Software TestingTools for Software Testing
Tools for Software TestingMohammed Moishin
 
Slides for Houston iPhone Developers' Meetup (April 2012)
Slides for Houston iPhone Developers' Meetup (April 2012)Slides for Houston iPhone Developers' Meetup (April 2012)
Slides for Houston iPhone Developers' Meetup (April 2012)lqi
 
Software Engineering Methodologies
Software Engineering MethodologiesSoftware Engineering Methodologies
Software Engineering MethodologiesDamian T. Gordon
 
Quality assuarance bharath anche (1)
Quality assuarance bharath anche (1)Quality assuarance bharath anche (1)
Quality assuarance bharath anche (1)bharathanche
 
Application Lifecycle Management
Application Lifecycle ManagementApplication Lifecycle Management
Application Lifecycle ManagementAmazon Web Services
 
Static Analysis Primer
Static Analysis PrimerStatic Analysis Primer
Static Analysis PrimerCoverity
 
ITFT - Software development life cycle
ITFT  -   Software development life cycleITFT  -   Software development life cycle
ITFT - Software development life cycleShruti Kunwar
 

Similar to SonarQube (20)

Understand release engineering
Understand release engineeringUnderstand release engineering
Understand release engineering
 
White box testing
White box testingWhite box testing
White box testing
 
Introducing systems analysis, design & development Concepts
Introducing systems analysis, design & development ConceptsIntroducing systems analysis, design & development Concepts
Introducing systems analysis, design & development Concepts
 
Capability Building for Cyber Defense: Software Walk through and Screening
Capability Building for Cyber Defense: Software Walk through and Screening Capability Building for Cyber Defense: Software Walk through and Screening
Capability Building for Cyber Defense: Software Walk through and Screening
 
Java Code Quality Tools
Java Code Quality ToolsJava Code Quality Tools
Java Code Quality Tools
 
SE Unit-1.pptx
SE Unit-1.pptxSE Unit-1.pptx
SE Unit-1.pptx
 
Coding - SDLC Model
Coding - SDLC ModelCoding - SDLC Model
Coding - SDLC Model
 
Blackboard DevCon 2012 - Ensuring Code Quality
Blackboard DevCon 2012 - Ensuring Code QualityBlackboard DevCon 2012 - Ensuring Code Quality
Blackboard DevCon 2012 - Ensuring Code Quality
 
Part5 - enforcing coding standard and best practices with jas forge v1.0
Part5 -  enforcing coding standard and best practices with jas forge v1.0Part5 -  enforcing coding standard and best practices with jas forge v1.0
Part5 - enforcing coding standard and best practices with jas forge v1.0
 
Software Development Life Cycle (SDLC )
Software Development Life Cycle (SDLC )Software Development Life Cycle (SDLC )
Software Development Life Cycle (SDLC )
 
postgres.pptx
postgres.pptxpostgres.pptx
postgres.pptx
 
sdlc presentation.pptx
sdlc presentation.pptxsdlc presentation.pptx
sdlc presentation.pptx
 
Tools for Software Testing
Tools for Software TestingTools for Software Testing
Tools for Software Testing
 
Slides for Houston iPhone Developers' Meetup (April 2012)
Slides for Houston iPhone Developers' Meetup (April 2012)Slides for Houston iPhone Developers' Meetup (April 2012)
Slides for Houston iPhone Developers' Meetup (April 2012)
 
Software Engineering Methodologies
Software Engineering MethodologiesSoftware Engineering Methodologies
Software Engineering Methodologies
 
Quality assuarance bharath anche (1)
Quality assuarance bharath anche (1)Quality assuarance bharath anche (1)
Quality assuarance bharath anche (1)
 
Application Lifecycle Management
Application Lifecycle ManagementApplication Lifecycle Management
Application Lifecycle Management
 
Java Code Quality Tools
Java Code Quality ToolsJava Code Quality Tools
Java Code Quality Tools
 
Static Analysis Primer
Static Analysis PrimerStatic Analysis Primer
Static Analysis Primer
 
ITFT - Software development life cycle
ITFT  -   Software development life cycleITFT  -   Software development life cycle
ITFT - Software development life cycle
 

SonarQube

  • 1. SonarQube: Seven Deadly Software Sins Gnanaseelan , Senior Technology Architect
  • 2. Who am I ? • Senior Technical Architect @ Accenture Software • Current Role • Focusing on improving the software design /code quality • Previous Roles: • Application Architect, Infrastructure Architect and Operation Architect for SOA Java Projects
  • 3. Presentation Goals • Knowledge of the Seven Deadly Developer Sins • Role of SonarQube in identifying them • Software patterns and principles to reduce the same. • Q/A
  • 4. Sin • Sin can be viewed as anything that violates the ideal relationship between an individual and his conscience • Software sin can be viewed as anything that violates the ideal relationship between an software developer and SonarQube. Developer Sin Separates Developer and Code SonarQube
  • 5. Architecture/Design Sin 1 : Violation of architecture layer Presentation Layer Controller Layer Service Layer Persistence Layer • MVC is a design pattern to separate the different layers. • SonarQube helps you to identify the violations of the architecture patterns
  • 6. Architecture/Design Sin 1 : Violation of architecture layer • Create Architecture Rules • Create Package Structure • no access to *.controller.* from *.dao.* classes
  • 7. Architecture/Design Sin 2: Creating Dependency Cycle • Design Structure Matrix (DSM) showing how components depend one on the other, highlighting dependency cycles and showing details on dependencies • Dependency –Inversion Principle • Interface Segregation Principle
  • 8. Complexity Sin 3: High Cyclomatic Complexity
  • 9. Lack of Proper Unit Test Sin 4: • Make sure the JUnit tests are aligned to business requirements and it tests the right business functionality. • Check for both positive and negative results • Provide logical names for your unit tests. • Verify all the mock objects to ensure unnecessary mocking is not done for the test case. • SonarQube also shares the failures and errors in the unit test success.
  • 10. Un Documented Source Code Sin 5: • Public API • Public Class • Public Method • Public Property • SonarQube measures the quantity and not the quality of the API • Include the purpose of the method also the descriptions of input and output parameters /** * Test Condition 1: Check to make sure that the person is responsible for the General Medical Benefit * Inputs: Eligible programs to the rules engine. * Expected Results: Verified eligible programs are in the results.
  • 11. Duplicate Source Code Sin 6: • Use Patterns like Extract Method to reduce duplication. • Violates DRY principle • SonarQube will help you to identify the duplicate code in the same file , project and even across multiple projects. • SonarQube shares the duplicate lines, blocks and files
  • 12. Coding Standard Breach Sin 7 : Indication of programmer error Severity BugsPotential bugs Inefficiencies BlockerCriticalMajorMinorInfo Future programmer error Style Issues require urgent fix Issues require analysis Source: Campbell, Papapetrou: SonarQube in Action
  • 13. Bugs and Potential Bugs • Bug (Blocker and Critical) : Failures to close file handles or database connections • Potential bugs (Critical or Major): Potential Null pointer condition during a certain scenario
  • 14. Bugs and Potential Bugs • Indication of Programming error (Major) : Avoid logging and throwing – as this results in multiple log messages for the same problem. Exception should be logged as the last resort error handler. • Future Programming Error (Major/Minor): Methods that are too long and complex. • Inefficiencies (Minor) : Unused import and methods.