How do you flag code so that you can come back later and work on it?

前端 未结 23 2035
后悔当初
后悔当初 2020-12-24 11:46

In C# I use the #warning and #error directives,

#warning This is dirty code...
#error Fix this before everything explodes!
<         


        
相关标签:
23条回答
  • 2020-12-24 12:05

    Todo Comment.

    0 讨论(0)
  • 2020-12-24 12:06

    I use //FIXME: xxx for broken code, and //CHGME: xxx for code that needs attention but works (perhaps only in a limited context).

    0 讨论(0)
  • 2020-12-24 12:09

    If I've got to drop everything in the middle of a change, then

    #error finish this
    

    If it's something I should do later, it goes into my bug tracker (which is used for all tasks).

    0 讨论(0)
  • 2020-12-24 12:12

    Todo comment as well.

    We've also added a special keyword NOCHECKIN, we've added a commit-hook to our source control system (very easy to do with at least cvs or svn) where it scans all files and refuses to check in the file if it finds the text NOCHECKIN anywhere.

    This is very useful if you just want to test something out and be certain that it doesn't accidentaly gets checked in (passed the watchful eyes during the diff of everything thats commited to source control).

    0 讨论(0)
  • 2020-12-24 12:13

    Mark them with // TODO, // HACK or other comment tokens that will show up in the task pane in Visual Studio.

    See Using the Task List.

    0 讨论(0)
  • 2020-12-24 12:13

    Add a test in a disabled state. They show up in all the build reports.

    If that doesn't work, I file a bug.

    In particular, I haven't seen TODO comments ever decrease in quantity in any meaningful way. If I didn't have time to do it when I wrote the comment, I don't know why I'd have time later.

    0 讨论(0)
提交回复
热议问题