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.](https://preview-assets-eu-01.kc-usercontent.com:443/5e986e54-339c-01a9-7c7c-26cbc5a344d5/491290f1-17e9-4d86-9949-815104ed59ae/Sonar_Q1001%20-%20Page%201%20%2841%29.png?w=2854&h=1581&auto=format&fit=crop)
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.
Related pages
Was this page helpful?