Free Sample
+ Collection

Sonar Code Quality Testing Essentials

Starting
Charalampos S. Arapidis

Achieve higher levels of Software Quality with Sonar with this book and ebook
$29.99
$49.99
RRP $29.99
RRP $49.99
eBook
Print + eBook

Want this title & more?

$21.99 p/month

Subscribe to PacktLib

Enjoy full and instant access to over 2000 books and videos – you’ll find everything you need to stay ahead of the curve and make sure you can always get the job done.

Book Details

ISBN 139781849517867
Paperback318 pages

About This Book

  • Take full advantage of the Sonar platform and its visual components to track code quality and defects
  • Create step by step software quality profiles that match your needs
  • Real world examples that use Sonar efficiently to assess quality and improve Java code

Who This Book Is For

This book is for you if you are a Java developer or a Team Manager familiar with Java and want to ensure the quality of your code using Sonar.

You should have a background with Java and unit testing in general.

Table of Contents

Chapter 1: An Overview of Sonar
What is Sonar
Features of Sonar
Covering software quality on Seven Axes
Architecture of Sonar
Source code analyzers
The Sonar community and ecosystem
Summary
Chapter 2: Installing Sonar
Prerequisites for Sonar
Downloading Sonar
Installing the Sonar web server
Configuring MySQL
Starting Sonar as a service
Logging in to Sonar for the first time
Securing your Sonar instance
Creating users and groups
Backing up your data
Extending Sonar with plugins
Upgrading Sonar from the Update Center section
Summary
Chapter 3: Analyzing your First Project
Using a Java runner
Analysis with the Sonar Maven plugin
Analysis with Ant
Browsing the Sonar web interface
Sonar components—an overview
Anatomy of the dashboard
Eliminating your first violations
Summary
Chapter 4: Following Coding Standards
A brief overview of coding standards and conventions
Sonar profiles, rules, and violations
Managing quality profiles
Managing rules
Creating a coding standards profile
Chapter 5: Managing Measures and Getting Feedback
Reviewing code
Sonar manual reviews
Configuring notifications
Defining metric thresholds and alerts
Sonar manual measures
Quality reporting on your project
Getting visual feedback
Summary
Chapter 6: Hunting Potential Bugs
Potential bugs violations
Installing the Violation Density plugin
Integrating Sonar to Eclipse
Summary
Chapter 7: Refining Your Documentation
Writing effective documentation
Documentation metrics definitions
Overview of Sonar documentation violations
Locating undocumented code
Generating documentation automatically
Summary
Chapter 8: Working with Duplicated Code
Code duplication
Sonar code duplication metrics
Locating duplicated code with Sonar
The Useless Code Tracker plugin
Using extraction and inheritance to attack duplication
Summary
Chapter 9: Analyzing Complexity and Design
Measuring software complexity
Cohesion and coupling
Sonar Code Complexity metrics
The Response for Class metric
Lack of Cohesion in Methods and the LCOM4 metric
Locating and eliminating dependencies
Summary
Chapter 10: Code Coverage and Testing
Measuring code coverage
Code coverage tools
Code coverage analysis
Assessing the impact of your tests
Using the coverage tag cloud component
jUnit Quickstart
Reviewing test results in Sonar
Summary
Chapter 11: Integrating Sonar
The Continuous Inspection paradigm
Installing Subversion
Setting up a Subversion server
Installing the Jenkins CI server
Configuring Jenkins
Creating a build job
Installing the Sonar plugin
Summary

What You Will Learn

  • Understand the different perspectives of quality in software projects
  • Manage code quality and get historical visual feedback directly from your browser with Sonar
  • Drill down your code and easily hunt for potential bugs and defects using Sonar components
  • Take full advantage of custom quality profiles to refine your documentation and apply coding standards
  • Locate duplicate and useless code and assess testing coverage across your projects
  • Analyze design and understand code complexity using Sonar and advanced metrics
  • Learn to configure dashboards and maintain the Sonar platform to match different needs
  • Integrate Sonar with a build server according to the continuous inspection paradigm

In Detail

Sonar is an open source platform used by development teams to manage source code quality. Sonar has been developed with this main objective in mind: make code quality management accessible to everyone with minimal effort. As such, Sonar provides code analyzers, reporting tools, manual reviews, defect-hunting modules, and TimeMachine as core functionalities. It also comes with a plugin mechanism enabling the community to extend the functionality, making Sonar the one-stop-shop for source code quality by addressing not only the developer’s requirements, but also the manager’s needs.

The "Sonar Code Quality Testing Essentials" book will help you understand the different factors that define code quality and how to improve your own or your team's code using Sonar.

You will learn to use Sonar effectively and explore the quality of your source code in the following axes:

  • Coding Standards
  • Documentation and Comments
  • Potential Bugs and Defects
  • Unit Testing Coverage
  • Design and Complexity

Through practical examples, you will customize Sonar components and widgets to identify areas where your source code is lacking. The book goes down to proposing good practices and common solutions that you can put to use to improve such code.

You will start with installing and setting up a Sonar server and performing your first project analysis. Then you will go through the process of creating a custom and balanced quality profile exploring all Sonar components through practical examples. After reading the book, you will be able to analyze any project using Sonar and know how to read and evaluate quality metrics.

Hunting potential bugs and eliminating complexity are the hottest topics regarding code quality. The book will guide you through the process of finding such problematic areas, leveraging and customizing the most appropriate components. Knowing the best tool for each task is essential.
While you improve code and design through the book, you will notice that metrics go high and alerts turn green. You will use the Time Machine and the Timeline to examine how your changes affected the quality.

"Sonar Code Quality Testing Essentials" will enable you to perform custom quality analysis on any Java project and quickly gain insight on even large code bases, as well as provide possible solutions to code defects and complexity matters.

Authors

Read More