BT

Reducing Technical Debt with SonarQube and Visual Studio

by Jeff Martin on May 01, 2015 |

Olivier Gaudin, of SonarSource, and Stuart Kent of Microsoft, were on hand at Build this week to discuss the benefits of using SonarQube and how it easier for .NET developers to do so.  Kent began their talk describing the cumulative burden of technical debt.  As a development progresses over the life of a project, technical debt first merely distracts from the implementing new work, but as time progresses it the development team will usually find all of its time consumed by dealing with technical debt.

Gaudin took the stage to discuss how to measure code quality and technical debt.  Informally calls this the number of expletives per minute when examining a code base.  He describes how Technical debt is caused by the 7 deadly sins of the developer:

  1. Duplications
  2. Bad distribution of complexity
  3. Spaghetti Design
  4. Lack of unit tests
  5. No coding standards
  6. Potential bugs
  7. Not enough or too many comments or incorrect comments [Unit tests will not pick up on this type of bug.]

Gaudin observes that it is hard to go back and implement strategies to mitigate technical debt after a project is underway.  Typically the team will consider it too hard, there can be lack of ownership (between QA and dev, who owns the quality), heterogeneous requirements, and any quality gates.  To "Change the Game", Gaudin proposes that:

  1. Development team owns quality
  2. Shorter feedback loop
  3. Unified quality gate
  4. Cost is non-significant
  5. This is fun!

To aid in accomplishing this, the feedback loop should be short with immediate feedback to the development team.  For existing software, the important thing is to stop making the problem worse-- focus on improving new code being written before addressing the legacy code base.

SonarQube provides a developer dashboard of the code base it is used on providing several useful metrics.  Example dashboard widgets include lines of code and code coverage for projects under monitoring.  Other include unit test coverage and the pass percentage for those unit tests.  It is also able to measure code coverage for newly written code separately from the code base as a whole, allowing teams to ensure they are not making things worse as they write code.

SonarQube received feedback that while the tool was great for Java projects, it does not follow the C# mindset.  So SonarQube contacted Microsoft for assistance in finding some quality C# developers.  Kent observes that code quality data can be useful, but by default it can be overwhelming due to all of the metrics available (code analysis issues, clones, code metrics, etc).  Suggests building a quality profile to filter what is shown, establish a baseline, set quality gates, and establish a remediation policy.  The result is a refined list of issues to focus on that avoids, or least, reduces, the sense of being overwhelemd with too much work.

While work remains, this new integration is ready to use now on TFS2013 for interested developers.  For additional details, consult the Stuart Kent’s companion article on integrating MSBuild and Team Build with Sonar Cube.

Rate this Article

Relevance
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread
Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Discuss
General Feedback
Bugs
Advertising
Editorial
Marketing
InfoQ.com and all content copyright © 2006-2016 C4Media Inc. InfoQ.com hosted at Contegix, the best ISP we've ever worked with.
Privacy policy
BT

We notice you're using an ad blocker

We understand why you use ad blockers. However to keep InfoQ free we need your support. InfoQ will not provide your data to third parties without individual opt-in consent. We only work with advertisers relevant to our readers. Please consider whitelisting us.