Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
I hate seeing it, but I also know that plenty of analysis tools have rules to vomit if switch statements don't have break, regardless of whether or not it's needed. Build systems run by admins will then decline to build the resulting code.
So I try not to judge unless I see something truly shit like O(n) that should be O(1).
Re: this shit
https://rules.sonarsource.com/javas... -
@SortOfTested yeah I know what you mean. The switch cases had if-else statements inside of them, with their own return statement, so the break statement was unreachable.
The return statements were setup like the following { data1, data2}. Throughout all the cases and if/else blocks only data1's contents would change data2 stayed the same.
This was just straight trash code and it didn't matter how much perfume was sprayed on it. -
C0D4681454ycase abc:
assign this to that;
break;
return that;
is hard coded so deep into my ways of doing things that code looks horrible to me without them, plus other languages that literally fall through unless there's a break 🤷♂️
But a return in a case.... "exit early" can go fuck it's self. -
Wow, that was an easy "fix".
Just find the very tiniest smidge of code style difference (not even actual code smell) in code not written by yourself and *wooosh*, its gone.
Now you only need to find a way to get that newly aquired overconfidence below 9000...
I always thought I suffered from imposter syndrome until I saw what the previous developer on this NodeJS/SailsJS project did.
They put return statements inside of a switch block. He also put in the break statements as well. The return statements were the exact same thing every time it was written.
Fuck shitty JS developers....
rant