[codeface] Re: Is it possible to extract the deleted lines per artifact?

  • From: Claus Hunsen <hunsen@xxxxxxxxxxxxxxxxx>
  • To: codeface@xxxxxxxxxxxxx, Thomas Bock <bockthom@xxxxxxxxxxxxxxxxx>
  • Date: Mon, 3 Jul 2017 16:11:22 +0200

Hi Wolfgang.


On 23/06/17 15:33, Thomas Bock wrote:

Hi Wolfgang,


Am 23.06.2017 um 14:30 schrieb Wolfgang Mauerer:
Hi Thomas,

Am 23/06/2017 um 13:51 schrieb Thomas Bock:
Dear everyone,
Hi Wolfgang, Hi Mitchell,

In some of our analyses, we are interested in the number of added and
also in the number of deleted lines per artifact (file, feature, function).

Currently, there is a "size" column in the commit-dependency table of
Codeface, which represents the number of added lines per changed
artifact (within a commit). As far as I know, this is extracted from the
git blame.

However, we cannot extract the number of deleted lines per changed
artifact (within a commit), as git blame does not show deleted lines.

Does anyone have an idea how to extract the deleted lines per artifact?
this is unfortunately not possible with the current state of the
schema. However, in my for-upstream queue, there are some changes
(see dcab014eae6 and some of the following commits) that partially
implement your desired functionality. Currently, we store how the
size of each file changes with each commit that acts on the file, and
also captures the number of added and deleted lines for each
file and commit on the file.

The implementation is (for historical reasons) a bit ugly ATM
because it does not store the results in the DB, but uses temporary CSV
files. As I also said in response to Claus' mail, I'm currently working
on integrating these data into the DB.

Computing the information at function granularity would also be
possible without too much effort, but requires some extensions (ideally
during proximity analysis; this would save the extra git log run
that the current implementation uses). Feature support should work
similar.

I would be interested in how you want to achieve this exactly for
functions and whether you aim at performing the same steps for the
feature analysis.

Here is the approach that is on my mind: For files, we just compute the
LOC of the files changed in a commit and store the number (and/or
differences etc.). But for functions and features, we need fine-grained
text extracted from the changed files in a commit (i.e., the function
code and the features' code) to keep track of these artifacts' sizes.
So, we need to 1) extract the functions and the features for each commit
(at least, for all changed files), 2) track their sizes in terms of LOC,
and 3) log the size differences over time.

I think that this is indeed possible to achieve (although it might get
slightly tricky for features), but I honestly doubt the scalability of
that approach for both functions and features. Isn't it the reason why
Codeface uses the git-blame data to identify changes to artifacts in the
first place, because we do not want to run the diff between each two
commits to identify the changes on any artifact?!

Am I right or do I miss anything important?


Long story short: If you just want deleted lines per file, you can
use branch for-upstream and the data in
<resdir>/<project>/conway/<range>/file_metrics.csv (in two hours or so,
the fixup commits will be gone from the branch; beware that the branch
is rebased frequently). For functions and features, we should discuss
how to add this best to the data model. Especially for features, I
would appreciate some help with the implementation because Passau knows
more about the feature code than I do.

Sure, it's no problem for us to support you here.

Best,
Claus


Best regards, Wolfgang

Thanks for your reply. We would need to get the deleted lines per file,
per feature, and per function. It would be nice to get this information
during proximity (resp. feature) analysis. For features and functions,
the number of added lines as well as the number of deleted lines could
be stored in separate columns in the commit_dependency table.

If we know how to extract the deleted lines per artifacts from git
without too much effort, we will help to implement that. Nevertheless,
currently we do not know how to extract the number of deleted lines at
artifact-level. I am still not sure whether it is possible to extract
the needed information without much effort.

Best,
Thomas




Attachment: signature.asc
Description: OpenPGP digital signature

Other related posts: