Hi Sonar
In Introducing Clean Code in our products it was announced that you have deprecated all of the well understood concepts of “bug” and “vulnerability” and “code smell” - with the exception perhaps of the last, the others need no explanation whatsoever for anyone to understand them,
Now we have some rather woolly hand-wavey new concepts of consistency, intentionality, adaptability etc.
So…where have all the bugs gone? Is there no such thing as a bug anymore?
Looking at your clean code definition page: Clean Code definition | SonarQube Docs I am struggling to see how we can adequately recognise bugs:
- Formatted - a bug can be well formatted
- Conventional - a bug can use all conventional features and behave consistently
- Identifiable - buggy code can be well structured, following all coding guidelines etc
- Clear - the bug may be self-explanatory, transpatent, and straigtforward
- Logical - buggy code may be well formed and free of explicit errors
- Efficient - it could be a very efficient bug
- Adaptability - a bit woolly bit okay it could be a modular, extendable bug
- Focused - a bug can be narrowly scoped
- Distinct - a bug can be distinct
- Modular - you have already covered this in “Adaptability” so not sure why we need it again but okay, it is a very modular bug
- Tested - the bug may well be tested and it behaves as per the testing - still a bug, just a tested one.
- Responsibility - I’m not going to bother with these as they are not things that can be automatically determined and no relevance to bugs per se.
I left out of that list two of your attributes - Intentionality and Complete as one could construct a somewhat thin argument that a bug is one or both of these.
Intentionality
The code is precise and purposeful. Every instruction makes sense, is adequately formed, and clearly communicates its behavior.
Intentional code is clear, logical, complete, and efficient.
I guess you could argue that it is not “adequately formed” or not “complete” if it does not behave as intended but it seems a bit of a stretch.
Complete
The code constructs are comprehensive and used adequately and thoroughly. The code is functional and achieves its implied goals. There are no obviously incomplete or lacking solutions.
This perhaps is the closest to a “bug” category - you could certainly argue that the code does not achieve it’s implied goals because there is a problem with it - but really this seems seems to be trying to fit a very very very well understood concept in the computer industry, (ever since Ada Lovelace “debugged” Babbage’s Analytical Engine back in the 1840’s) into some new rather woolly concepts that do not give the immediate understanding that we have had for almost two centuries.
“I made my code complete” does not quite convey the same thing as “I fixed a bug”
Maybe Sonar your code is so clean that you never have bugs anymore but I think those of us in the real world do indeed have bugs to fix!