Question

Is there a way to run a Git log command with a majority contributor (author)? I want to use that along with a code metric tool to be able to essentially show the quality of code produced per contributor.

File       Author      Cyclomatic Complexity    LOC(Additions)   LOC(Deletions)
Test.js   "John Doe"            5                     20               12

Another view that would be interesting is to be able to summarize with

Author   CyclomaticComplexityAverage      LOC Per File   #Files Majority Contributor

James               4                          30                 75
Anne                8                          60                 20

Also, it would be interesting if there is a Git tool that leveraged the Microsoft visual studio code analysis using http://msdn.microsoft.com/en-us/library/ms173498.aspx with Git log or Git blame to get per author metrics.

It would be useful when trying to identify weaknesses or strengths in order to help improve team members and give recognition to higher quality. It could also be used to track someone's improvement over time.

I know that code metrics are not necessarily an accurate way to determine a developer's skill and that there are many other factors that determine the team member's contribution/skills.

Était-ce utile?

La solution

Git is a content tracker, and while every blob can be associated with an author, git has no provisions to conveniently accommodate the various top-level software metrics of the kind you are after . So you will either have to build your own parser for the content, or you will run into inherent difficulties with what you are trying to achieve in the general case, because git interpretation and presentation of the content is not aligned with your goals.

Additionally keep in mind is that git can distinguish between the author and the committer of a change (and every blob), something that you will have to account for, especially if code can be submitted via patches in your project.

Ignoring the distinction between authors and committers, you can know out of the box,

  • authorship attribution of the different lines in a file using git blame -- /path/to/file (and you can subsequently filter the lines by the individual author contribution)
  • history of an individual file with git log -- /path/to/file (the commits that affected the file)
  • history of author commits in a branch with git log -p --author=<name>

If you are lucky you can possibly utilise a mix of the above with post-processing to generate a sensible input to your tool, but I suspect that significant amount of post-processing will be required in any event.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top