+2

Commit: check for "hack" or "debug" markers in file modifications and make it hard to commit such files

CodeBehemoth 4 years ago updated by Marc Strapetz 4 years ago 5

Some changes ( hacks, debug code ) should not be committed. Therefore, the modified lines of files should be inspected for possible "hack" markers and on commit, I want to be asked to check these files.

Is this something which could be told from the diff of the file? E.g. because the diff contains markers like "TODO"?

First, I thought about a context menu entry "mark as hack" on each file in window "Files". After setting, the file will get a special icon. On stage or commit, the user wil get a message with the list of these files.

But, I find the idea with markers in code (TODO, DEBUG, HACK) also good. One disadvantage - some people have a lot of such markers in code, also in commited code. So it could be annoying.

I would limit the marker check in code only to those lines which you have modified. So, only if you are modifying a line which already contains such a marker from previous commits, that would result in a false-positive warning.


For myself this check would work better than an explicit action in SmartGit, because I'm already using such TODO-markers anyway (e.g. IntelliJ IDEA has special support for them) and thus there is zero overhead to have such a check working. If I had to switch from IDEA to SmartGit and invoke some additional operation there, that would be cumbersome.

Agreed.

By the way, Visual Studio supports a configurable list of such markers for the "Task List":

OK. I have updated the title and description.