Our thinking has evolved based on feedback from our Community. While much of this post remains relevant, some details have changed.
Hello everyone,
You might have noticed we relaunched our website and started to talk about Clean Code. We are now introducing a detailed definition of Clean Code in Sonar products.
What is Clean Code?
Clean Code is consistent, intentional, adaptable, and responsible.
These attributes define what Clean Code is all about. Going forward, all Sonar products will adopt the Clean Code attributes as a way to more precisely categorize issues in your code.
This complements our current approach, where Sonar lets you know that code issues affect your softwareâs security, reliability, and maintainability. And since a single code issue can impact one or more software concerns, we are now referring to these aspects collectively as software qualities.
Starting with the upcoming product releases, issues in your code will have an associated Clean Code attribute and highlight the impact they have on different software qualities with three levels of severity: low, medium, and high.
In future iterations, we plan to extend software qualities to reflect the breadth of our analysis: for example for accessibility, sustainability, safety, and more.
Clean Code attributes
Consistent
The code is written in a uniform and conventional way. All the code looks similar and follows a regular pattern, even with multiple contributors at different times. Consistent code is formatted, conventional, and identifiable.
Intentional
The code is precise and purposeful. Intentional code reads like it is written with attention and care to convey its purpose. Every instruction makes sense, is adequately formed, and simply communicates its behavior. Intentional code is clear, logical, complete, and efficient.
Adaptable
The code is structured to evolve easily and with confidence. It makes extending or repurposing its parts easy and promotes localized changes without undesirable side effects. Adaptable code is focused, distinct, modular, and tested.
Responsible
The code takes into account its ethical obligations on data and the potential impact of societal norms. Responsible code is lawful, trustworthy, and respectful.
Clean Code attributes in Sonar products
Screenshot from SonarQube 10.2 issues list - changes are highlighted in green.
Screenshot from SonarQube 10.2 issue details - changes are highlighted in green.
Screenshot from SonarCloud issues list - changes are highlighted in green.
Screenshot from SonarCloud issue details - changes are highlighted in green.
Screenshot from SonarLint - changes are highlighted in green.
Issue type deprecation and severity changes
As part of this change, we will be deprecating and gradually removing our previous notion of issue type (bugs, vulnerabilities, and code smells). Also, severity will have simplified values: low, medium, and high. Additionally, we are extending severity to multiple severities per issue, one per software quality.
All existing features and integrations that rely on issue type and severity will continue to work as before, and future changes will be introduced gradually.
Next steps
We still have lots to do to make Clean Code more visible in Sonar products. Stay tuned for more updates.
Until then, please feel free to provide feedback!