Blog-o! Notes from latte.ca

Fri, 24 Dec 2010

I was reading Making Software by Andy Oram and Greg Wilson, and got to the chapter about An Automated Fault Prediction System. It’s a pretty neat chapter, and it got me wondering which files in the Thunderbird code base had the most bugs. Now, I don’t have all the info I need, but I figured an easy first pass would be to go through the commit logs, and for each commit that started with “bug ”, add one to the files changed in that commit. Hmm, that sounded unintuitive. Let me just paste (and link) the code:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from mercurial import ui, hg
import operator
import re

ext = re.compile("(\.c(pp)?|\.js|\.xml)$")

repo = hg.repository(ui.ui(), ".")
changes = [repo[i] for i in repo
                   if repo[i].description().lower().startswith("bug ")]

master = {}

for change in changes:
  files = [f for f in change.files() if ext.search(f)]
  for f in files:
    master[f] = master.get(f, 0) + 1

files = master.items()
files.sort()
counts = master.items()
counts.sort(key=operator.itemgetter(1))
counts.reverse()
print "\n".join([c[0] + ":" + str(c[1]) for c in counts[:10]])

And so, without further ado, here are the files that have been changed the most in bug fixes, and the number of times they've been changed:

  • mail/base/content/mailWindowOverlay.js:109
  • suite/browser/browser-prefs.js:73
  • suite/browser/navigator.js:70
  • mail/base/content/msgMail3PaneWindow.js:69
  • mail/app/profile/all-thunderbird.js:67
  • suite/common/src/nsSessionStore.js:66
  • mail/components/compose/content/MsgComposeCommands.js:60
  • mailnews/imap/src/nsImapMailFolder.cpp:56
  • suite/browser/tabbrowser.xml:53
  • mail/base/content/msgHdrViewOverlay.js:52

As a side note, for the mozilla repo it looks like this:

  • js/src/jstracer.cpp:780
  • browser/base/content/browser.js:654
  • layout/base/nsCSSFrameConstructor.cpp:410
  • layout/base/nsPresShell.cpp:400
  • js/src/jsobj.cpp:399
  • browser/base/content/tabbrowser.xml:397
  • widget/src/windows/nsWindow.cpp:390
  • toolkit/components/places/src/nsNavHistory.cpp:374
  • js/src/jsinterp.cpp:345
  • js/src/jsapi.cpp:343
[Posted at 14:59 by Blake Winton] link
blog comments powered by Disqus