I had an interesting experience with Codacy today. I got this error.
When doing my IT Degree (many moons ago) I was taught 2 things (amongst others you understand):
- An If statement always has an else. You should always handle a possible situation even if it should never happen.
- There should only ever be one exit point from a function, loop etc.
Perhaps these mantras stemmed from a safety critical standpoint (I was using Ada).
However, it seems the ‘modern way’ doesn’t agree. Well tough, I still think I am right and any other way is just building in problems.by