Friday, 8 January 2016

FIXME and TODO comments in the Linux kernel source

While looking at some code in the Linux Kernel this morning I spotted a few FIXME comments and that got me wondering just how many there are in the source code.  After a quick grep I found nearly 4200 in v4.4.0-rc8 and that got me thinking about other similar comment tags such as TODO that are in the source and how this has been changing over time.


So the trends are certainly upwards, but then again, so is the size of the kernel source:

Note: Data gathered using sloccount on the lines of C in the kernel source.

Using the sloccount data I then calculated the number of FIXME and TODOs per 1000 lines of code to see what the underlying trend is:

So FIXMEs are actually dropping in relative terms to the size of the kernel where as TODOs are increasing.

Of course, these statistics are bogus because it is dependent on kernel developers adding and removing FIXMEs and TODOs in a consistent manner, however, it is interesting to see how many comments exist and hence how much work has been tagged in comments as work to be done later. I wonder how this compares to other large open source projects.

9 comments:

  1. QEMU (current head of tree); LOC: 981525, FIXME: 460, TODO: 1003
    (LOC from sloccount total SLOC, fixme/todo from ag | wc -l)

    ReplyDelete
  2. I'm not a git expert, so it may not be doable, but it sounds like it is: why not graphing instead how many of the fixme's and todo's get actually fixed and done in each release? I believe git should be able to help, having the commits. Maybe something based on greping the logs?

    ReplyDelete
    Replies
    1. I will leave that as an exercise to the reader ;-)

      Delete
    2. Pycrastinate (https://github.com/isaacbernat/pycrastinate) greps through the source code (and git blame) to create such reports (on TODOs/FIXMEs and other regexps). It can easily group by metadata (path, author, etc.) filter by age range (checking git commit times), etc. and generate HTML or ascii reports. You may want to check it out.

      Delete
    3. Pycrastinate (https://github.com/isaacbernat/pycrastinate) greps through the source code (and git blame) to create such reports (on TODOs/FIXMEs and other regexps). It can easily group by metadata (path, author, etc.) filter by age range (checking git commit times), etc. and generate HTML or ascii reports. You may want to check it out.

      A sample report: http://pastebin.com/BGmUkhxR

      Delete
  3. very nice, i am forked the source code from github and search what is says the developers in this comments xD

    ReplyDelete
  4. One way to get a handle on them and organize them into issues would be to use imdone-atom and imdone-atom-github. I built both these packages expressly for this purpose.

    ReplyDelete
  5. What happened between 4.0-4.3 to receive so huge increase in TODOs?

    ReplyDelete
    Replies
    1. I have no clue what I am talking about, but maybe it is Skylake and its graphics.

      Delete