PacktLib: Sonar Code Quality Testing Essentials

Sonar Code Quality Testing Essentials

Credits

About the Author

About the Reviewers

www.PacktPub.com

Preface

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

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

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

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

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

Hunting Potential Bugs

Potential bugs violations

Installing the Violation Density plugin

Integrating Sonar to Eclipse

Summary

Refining Your Documentation

Writing effective documentation

Documentation metrics definitions

Overview of Sonar documentation violations

Locating undocumented code

Generating documentation automatically

Summary

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

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

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

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

Sonar Metrics Index

Sonar Metrics Index