Start Free
Latest | Core Concepts | Clean as You Code | Introduction

Introduction

On this page

Clean as You Code is a software development practice based on the principle that new code (code that you added or modified recently) needs to comply with quality standards. The Sonar solution implements Clean as You Code by warning you whenever issues are detected in your new code.

When you add new code to your projects, you usually touch a portion of the old code in the process. As a consequence, analyzing and cleaning new code allows you to fix issues in your old code and gradually improve the overall quality of your codebase.

Each code increment allows you to fix a part of your old code. The codebase gets cleaner over time.
Each code increment allows you to fix a part of your old code. The codebase gets cleaner over time.

The end goal is to achieve a state of Clean Code for your entire codebase. This approach is also suitable for legacy projects with a substantial amount of code, although in this case a full cleanup can hardly be achieved.

Sometimes, you may want to implement additional measures to ensure the quality of the overall code base, such as checking for vulnerabilities and performing refactoring. Clean as You Code does not prevent you from pursuing these additional use cases.

Benefits of Clean as You Code

For developers 

  • You ensure that all new code added to the project is always clean.
  • You gain time by reducing and even eliminating debt-addressing sprints.
  • You adopt a sustainable approach to software development, as cleaning code becomes part of the development routine.
  • You fix issues in your own code, reducing the complexity that comes with fixing old code that is hard to understand.

For organizations

  • The overall quality of your code increases over time.
  • You ensure your software meets high quality standards. 
  • You increase developer morale by reducing debt-addressing sprints.
  • Engineering/Feature development velocity increases.

In SonarQube, you can get a visual representation of the benefits of Clean as You Code based on the data in your projects by navigating to More > Clean as You Code.


Was this page helpful?

© 2008-2024 SonarSource SA. All rights reserved. SONAR, SONARSOURCE, SONARLINT, SONARQUBE, SONARCLOUD, and CLEAN AS YOU CODE are trademarks of SonarSource SA.

Creative Commons License