SVN Pre-commit capture for temporarily commented out code (in java)?

It just seemed to me that I commented out a line of code to check the reasons and finished checking the code back to the repository with comments.

eg. I set the rule to work in Eclipse RCP on one line. When developing a new function, I commented on this line, so the rule is not set.

After a couple of hours, the new function was completed and ready for transfer to SVN. While I changed a lot of things, I usually just double-check my changes, synchronizing with the repository (in Eclipse) and looking at all the classes that perform some kind of reasonableness check (i.e.: asking myself if I really touched this class ?). But I do not check every line.

So, in this case, I did not remember the commented line, and it got into SVN.

Now I was wondering if I could find some kind of automatism to prevent such errors. I was thinking of creating a code template or task tag and marking a commented line. And then check this task tag in the pre-commit svn binding.

Iโ€™ve been searching Google for some time, but couldnโ€™t find anything. Does anyone know a way to do this? Or maybe something that is close to this and just needs minor changes to achieve what I'm looking for?

+4
source share
3 answers

Borrowing from the idea of โ€‹โ€‹spong ... how about adding a comment to a comment ( FIXME ) if it needs to be split. The pre-hook can do svnlook diff and look for FIXME and prevent the commit.

+1
source

You can check these things in a binding before committing, but I would suggest using the branch first and checking at the end before merging with the trunk or other integration line. On the other hand, I suggest using unit tests to run them, and some of them are red, based on code with comments. And last, but least, what is so bad to remember about a missed deleted comment and make other commits? And what comes to mind: why not use @TODO, etc. Tags in Eclipse or better @COMMENT and see a list of tasks in Eclipse?

+1
source

Open the task view in Eclipse. Then it will show you where you have FIXME in the comments:

 // FIXME - uncomment this before checking in // importantThing.execute(); 
0
source

Source: https://habr.com/ru/post/1309524/


All Articles