mardi 17 février 2009

Engineering dictator strikes back : querying your team repository

That post inaugurate a series of "modeling kata"'s. Modeling kata's are about basic usage of Eclipse modeling and related technologies to create fun stuffs, and more importantly doing it again and again using different ways and analysing the pros and cons of each solution. Of course the "kata" terminology is not from me.

Let's introduce the problem :

Taking my role of " Non Benevolent Dictator for Life " at work seriously, I like to keep an eye on the source code history of our products; on the mass of changes and on the places where the changes are made.

That was the idea behind the teamlog2rss.py script I wrote last year. But now, going a bit further in the "big brother" concepts, I hacked a small EMF model to retrieve the logs from the team repository and to generate reports, I'm then able to analyze the log messages and file uri's :)

The model is straightforward, here is a quick extract of the result :



The model implementation is querying Subversive to retrieve the logs through a "derived reference". That solution is quite crappy as accessing the model means going through the network (meaning - that's slow), but the advantage is : my EMF model is a plain old EMF model, and as such any tool will work with it.

Then I'm producing reports using Acceleo, for each week and commiter, I'm checking:
  • how many changes have been made
  • how many unique files have been changed
  • how many tests have been changed
  • how many "happy checkstyle" commits were done
  • commit activity concerning "bugfixing"
  • how many "happy boyscout" commits were done
here is an extract of the M2T template:



I'm then able to generate HTML, and even generate a small uri for Google charts to get nice pictures:


I'm even able to add the commiters picture in the "weekly hall of fame" through user code tags in the HTML :)

That said, M2T transformation is not the best pick for such a need, I really need to deduce new information from the original teamlog data to produce, afterwards, a nice report. Next try on this kata will probably involve M2M transformation to deduce the information, or Birt reporting... But, I don't want to spoil you, stay tuned ;)

3 commentaires:

Emmanuel a dit…

Hi Cedric,

I did this such of things since one year. I did it to detect bad practices on subversion as developer not committing, too big commit or lack of correction report on another branch (we wrote subversion hooks to normalize svn comment), or to do some archaeology...

I do it only with m2m transformation (ok, I must say than I use the xml injector to model conforming to XML MM to produce the first model ;) ).

But as it is only an analyze tool to myself, I do not produce report : I produce a model conforming to an indicator MM, or to a MM really near the result I need : so I read only the XMI2 ;) ... (I'm quite xmi2 fluent now!)

I really like changing my analyzing point of view by a few change into one of my atl files and relaunching my ant script. If I am surprised by the result, I go a bit deeper.

Emmanuel
http://www.anacoluthe.org/

Cédric Brun a dit…

Hi Emmanuel and thanks for your comment,

as you said, I agree M2T is not the best pick for suth a thing and M2M would be better. Another possible solution, maybe even better than M2M for analyzing, would be using a rules based framework (like Drools) to induce and deduce facts from the logs. That could be fun :) and easier to update than the ATL transformation, what do you think ?

Emmanuel a dit…

Hi Cedric,

As I am now quite fluent with ATL, it is quite simpler to manipulate data (ie a model) using M2M.

I really like using M2M, because the transformation are written once. I fear than doing it by drools will enforce you to write more and more java code to navigate datas. My transformations are very short, the bigger is about 200 atl code lines (and without any library!).

And I also use it to merged point of view from disparate data sources. I use it to analyse pmd or checkstyle report. I plan to exploit more code analyser tools data as metrics and jdepend to be able to generate (by m2t) a javadoc including this data and a reverse sequential diagram (ie by whom am I called). I already used the java modisco discoverer to rebuild the sequential.
So I could be more efficient for developer to analyse problem.

I have more ideas of this kind, but only 24hour a day :( ...

We could organise a working day in Nantes to exchange about practices ;) .

Emmanuel Feller
http://www.anacoluthe.org