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
-
The test should check if there are in fact fewer commented out lines of code. If true, awesome!
-
Skuldul514y@N00bPancakes yeah our standards seem to be, “not used anymore? Comment it out even if it’s 10000’s of lines”
Oh even worse, comment out an entire class and add “_Old” to it -
May be you have a script running on a forgoten VM which reads your git repo, looks for this specific commented code, compiles it on the fly, then injects as a "plugin" into your release software ?
I saw so much vbizzare things, it would not surprise me to find something like that haha
(But yeah, removing commented section should not trigegr a full retest) -
Hazarth94884yNo, do your job properly!
You need to write unit tests to test that the removed comments are indeed still removed... In case someone adds them by accident... -
Testing against commented code, whose creation / last changed date can be (hopefully) verified by an VCS, seems like a very dangerous idea.
Most of the time the same trouble occurs as in too many comments without maintenance - you test wrong behaviour.
Even if the file hasn't changed much, it's senseless to add tests to have more tests.
Many tests with low quality are the worst. Resources are wasted, despite a misleading high count of tests it's very likely that the codebase is rotten and stinks like hell.
If you don't know how to test, let it be.
Hire an expert, but don't blindly add tests for the sake of tests.
Not only is it a PITA to maintain, but it leads to the problem of our codebase is wrong cause we assumed the tests were right problem - tons of low quality tests can lead to this paradoxon. -
I get this dilemma every now and then: Should I delete the code or comment it? A dev after may find it helpful to see the evolution of logic. I don’t know. Meh.
-
@Cyanide Delete.
That's why you have a VCS.
It's his job, don't take it away or it will be depressed. -
Skuldul514y@NoToJavaScript No, I know our code base very well, and there is nothing like that, would make my happier if there was though haha
-
Angry15674y@Hazarth
1. Remove commented code
2. Merge to master
3. 2nd dev rebase -i his working branch
4. Conflict!!
5. Add commented code back
6. Commit
7. Merge back to master
TADA! >.< -
You comment it out or rename it so you can say in 3 years „oh hey, we had that thing 3 years ago, ah, good times. We only had 2k commented lines.“
-
Dude - commented code should be terminated with extreme prejudice. Put on the shades, do the Arnold Schwarzenegger voice saying “Hasta la vista, baby.” and commit!😎
Related Rants
-
DRSDavidSoft28Found this in our codebase, apparently one of my co-workers had written this
-
erdlof16Pun of the day Boss: I heard your colleagues hate dealing with code you wrote. Why? Me: No comment
-
NiTr013"I wrote the code, I have to maintain the code, I wont need any comments" *some months later*
I understand that changing code requires it to be tested, but removing code that has been commented out for years shouldn’t matter!
Save my soul
rant
useless
comments
never ends
save me
pain in the ass