[codeface] Differing "addedLines" and "size" in Codeface commit data

  • From: Thomas Bock <bockthom@xxxxxxxxxxxxxxxxx>
  • To: codeface@xxxxxxxxxxxxx
  • Date: Thu, 31 Aug 2017 16:53:54 +0200

Hi everyone,

I had a small problem with the Codeface commit data of BusyBox regarding
the number of added lines of a commit. I do not know if everyone is
aware of that. So, I decided to write this mail just for documentation
reasons.

In the Codeface commit table, there is a column "AddedLines", which
represents the number of added lines per commit. Moreover, the Codeface
commitDependency table contains a column "size" representing the number
of added lines per artifact within a commit (e.g., added lines per
function).

So, usually, the following equation should hold for a commit: sum(size)
<= addedLines, where sum(size) is the sum of the "size"-values for all
artifacts belonging to the considered commit. (In the above equation, it
is only a <= and not a = since it may be the case that Codeface does not
analyze all artifacts that are part of a commit).

Nevertheless, while analyzing the BusyBox data, I found a commit where
addedLines=0, deletedLines=0, but size=11. I used 'git show -p
088d9e0f05a8bda93db07acd20557ab96e083086' to show that commit and got
the following output:

diff --git a/tests/busybox.REGRESS.sh b/tests/busybox.REGRESS.sh
index f493ead..a5a31ad 100755
Binary files a/tests/busybox.REGRESS.sh and b/tests/busybox.REGRESS.sh
differ

So, git automatically interprets this sh-file as binary file, even if it
is not binary. This is the case if the file has a wrong file encoding or
contains non-ASCII characters. For that reason, git is not able to
determine the number of added respective deleted lines for this commit,
resulting in addedLines=0.

However, the algorithm in Codeface which calculates the "size" for the
artifacts of this commit does not treat this file as binary as it
returns a size of 11 (added lines to this artifact).

That is why the number of added lines is 0 but the corresponding size
value in the commit-dependency table is greater than 0, which was an
unexpected behavior to me.

This problem just appeared only in three commits of BusyBox in the years
2000 and 2001. So, in my analyses I can just ignore these three commits
-- but I wanted to document the above described behavior here.

Best,
Thomas


Other related posts:

  • » [codeface] Differing "addedLines" and "size" in Codeface commit data - Thomas Bock