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
-
Hazarth95212yI'd say, at code review.
commented out code should never pass code review unless it is super clear, that it's going to get uncommented very very soon...
Like it could be to avoid tests failing while another system is getting fixed or something but you still need to push changes for a client. It's not pretty and recommended, but in real life it happens more than we'd like and managers don't care. So in very small subset of particular cases, I can imagine commented code getting out, but it should be uncommented very soon, otherwise nothing like that should ever pass review... no shit like "we might need it" or "I'm just testing something"... that's what git is for already.
I'd say, if you found commented code that's older than a week it's definitely safe to remove, I mean worst case it's already tracked by git, so who cares, it's just very slightly more convenient to keep it around in the files, but not enough to justify doing it willy nilly -
@C0D4 has the right notion.
that's what version control is for.
and if you don't have version control, you have far bigger problems than commented out code. -
@C0D4 nah, that is too idealistic. I am keeping commented out code as easy constant reminder for something to decide later. I don’t take any notes outside my code. Also bringing that code from the history is tedious. L
-
C0D4669022y@aviophile I can't stand commented out code, especially when it's deprecated or even been rewritten.
Sure it's a bit of a pain to rollback a change, but that's the point of testing and assuring the changes align with the needs.
Having hundreds of lines of code doing nothing besides taking up space in a file is pointless and tiresome when it's a project with millions of lines and endless blocks of :
/**
revert this if needed
**/ -
You don't you commit it to source control and then you delete it hehe
But yeah after testing and debugging -
Immediately.
It's the VCS job to keep track of changes.
Commented code is just being lazy.
Delete it, it's unneeded.
If it breaks things, find out why, learn that your workflow sucks as that shouldn't have happened, clean up the mess you made and do it properly the next time.
This laziness is what I really... really...really hate.
If it's not laziness, then I'd need to assume that you don't know what you're doing, you cannot use a VCS properly and that you're insecure about the changes you made.
Things that are all high red flags for me. -
Ooh boy this is one of my strongest code review moments
Any commented out code must be deleted UNLESS a valid reason above the snippet is written down.
'Maybe we need it later and it'd be lost...' no shithead that's what git is for
Related Rants
-
dyslxr40So I named my daughter "io" everyone calls her by the name and then we register her on our local gov't to get...
-
smit-happens35!rant Worked all day and got my embedded systems project working the first time! Bluetooth as well! 😁 It's...
-
Papi23Started learning Go It's very interesting language
After how long do we delete the commented code
question
flutter
physics
golang