I just started using Crucible / FishEye on top of a Git repository. To get a feeling how much our code base is in a state of flux, for a specific branch, I'd like to see the amount of code changes (lines added / removed) in relation to the total lines of code for the last 7 days / the current week. I tried to come up with something using EyeQL but failed miserably at even getting the syntax right (I always get "unexpected token: thisweek" no matter how I try to use the "thisweek" keyword). Any hint how this could be accomplished? Does FishEye even know about the total lines of code, as I guess this is something specific to the programming language?
Hi Sten,
thanks for the response. Getting the total number of lines (per file type) is crucial for our stats to get some meaning. However, it actually turned out to be quite easy to get the stats I need in plain Git. The idea is to simply get the diff to the "empty commit", which equals the lines of currently committed code. At the example of Java files my shell script looks like this:
empty=$(git hash-object -t tree /dev/null) total=$(git diff --stat $empty -- *.java | tail -1 | cut -d "," -f 2 | cut -d " " -f 2) echo "Total lines of Java code in repository: $total"
Next, I get the amount of changed code since the last 7 days like this:
stats=$(git log --since=1.week --pretty=tformat: --numstat -- *.java | awk '{ added += $1 ; removed += $2 } END { printf "%s,%s",added,removed }' -) added=$(echo $stats | cut -d "," -f 1) removed=$(echo $stats | cut -d "," -f 2) changed=$(expr $added + $removed) echo "Java statistics for the last 7 days: $added lines added, $removed lines removed, $changed lines changed"
With these numbers it's now easy to come up with a change ratio which sort of reflects how much the code base is in flux.
Given that this was not too hard at all, I hope FishEye will soon be able to support LOC stats for Git repositories, too ;-)
Hi Sebastian,
Unfortunately FishEye does not provide Lines of Code statistic for Git as this is something quite complex to build of Git repositories. We're looking into alternatives and I'd like to get your feedback.
Would you be happy to simply see a volume of changes other time without the ratio to the total line of code count?
Sten Pittet
Dev Tools Product Manager
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.