I like the idea that the setAttribute entries are never used in this code, but those and the comments are getting used for some horrifying code reflection elsewhere.
The person that knew that answer left the company 10 years ago. The person that made the comment tried removing it 5 years ago and discovered the hell that would ensue after pushing the change to prod without testing.
Yeah, I had that occur when I was trying to trace down why one piece of functionality was intentionally disabled for one (fairly normal) use case. Easily found the line of code which did it, looked back to try to find any documentation on why it was done.
All I got was "disabling per Steve". Of course the developer had been gone for 15 years. Who were you, Steve? What did you know? What horrors did you see???
I ended up deleting that line of code and as far as I know, it hasn't broken anything in the past eight years. But deep in the back of my mind, I know that somewhere, whatever terrifying future that Steve once envisaged may yet come to pass.
That, or it ran fine in staging initially, bizarre problems hit prod three days after release, and nobody’s sure why deleting this caused them but they know the rollback worked.
Someone I know used to work at a place where they occasionally had external consulting firms come in and poke around in the codebase. Apparently they just signed every line with a comment that said "changed by <consulting firm>" which I can imagine made debugging incredibly fun for everyone!
Ay I'm from (and living in) the country the origin of that meme mocks. They've actually arrested people for having reddit installed, for having memes related to political events, amongst many others.
If you're asking why there isn't a height variable, personally I would avoid two variables having the same value, because having two variables implies that the value might be different, and opens the door to programming errors where the values might become different.
Although I would probably throw in a quick // square to make that clear, since setting height to width does look like an error.
:in a meeting later on: '.. So you did see the crocodiles? You walked past the devils? You then walked on a fire like a team building exercise?' Well I have no choice - You're management material, we'll fire a sacrificial swe instead.
It's not needed for anything except to keep some other shitty workaround that was a side effect of a fix for a bug for a temporary hack to get around some technical debt working. We'll fix it next sprint after we finish the next feature
800
u/THNDHALBRT Mar 31 '26
This lines
836
u/TheBrainStone Mar 31 '26
Bad comment. It needs to explain why it's needed. At least what breaks if it's removed
112
u/Morg0t Mar 31 '26
I would create PR changing in comment this -> these for fucks sake
335
u/Nightmoon26 Mar 31 '26
At least explain why you're setting height to width.toString()...
118
u/Disastrous-Name-4913 Mar 31 '26
Maybe try r/programminghell?
17
u/RelaxedBlueberry Mar 31 '26
👹 muah ha ha ha ha ha ha
35
u/AnaxXenos0921 Mar 31 '26
Average JavaScript code be like
23
u/KissMyAcid420 Mar 31 '26
Can you delete the " " after the comma? It hurts my eyes that flame Emojis arent aligned on the right
9
u/NotUpdated Mar 31 '26
:in a meeting later on: '.. So you did see the crocodiles? You walked past the devils? You then walked on a fire like a team building exercise?' Well I have no choice - You're management material, we'll fire a sacrificial swe instead.
8
u/zrice03 Mar 31 '26
"Surely it should set the height attribute to 'height'?...Huh what's that horrible screaming I hear in the distance...?"
4
u/bonomel1 Mar 31 '26
It's not needed for anything except to keep some other shitty workaround that was a side effect of a fix for a bug for a temporary hack to get around some technical debt working. We'll fix it next sprint after we finish the next feature
24
u/obetu5432 Mar 31 '26
js "developers":
3
u/worthlessDreamer Mar 31 '26
I don't think crocodiles live in hell 🤔
3
u/el_cortezzz Mar 31 '26
Liskov principle violated, this seems the same problem of the Square that inherits from Rectangle
3
u/MisterBicorniclopse Apr 01 '26
I do this with every line of code I write
2
u/Frosty-Woodpecker-45 Mar 31 '26
farting sound
2
u/Freddie_Hawkes Apr 01 '26
It's JavaScript. Just overwrite in the next line, no need to change 🙈
1
u/Positive_Mud952 Mar 31 '26
Delightful.
1
u/yz9551 Mar 31 '26
Turns out you can't remove the comments either
1
u/Frytura_ Apr 02 '26
Ah, Javascript 😖☕️
1
u/Rodya_gambler Apr 03 '26
Do emojis in comments affect performance?
1
u/AdSeveral5047 Apr 16 '26
AI can't do this
1
u/Toiweonxd Apr 28 '26
That code aint even that important?? wtf
1
u/stresser_211 Mar 31 '26
diabolic