# Is there a tool to measure the “maturity” (age) of a code in Git?

The vc-annotate in Emacs is a nice tool to see the "maturity" (age) of each line of code in colors. More blue dark, more mature, more red, less mature. This functionality has already been considered to be implemented in MediaWiki (but I don't know if it ever came to be). Usually, in a active project, untouchables lines or functions are very stable (it's applicable to Wiki too - information not disputed tend to be better) and bug-free.

Is there a tool to make a analysis of maturity of a code on Git based on the age of each line? That output something like:

Total lines: 500
Until 1 month lines: 100
1mo-6mo lines: 200
6mo-1yr lines: 100
more than 1yr lines: 100


This could be very useful in active projects (in abandoned maybe it is useless since the entire code would be false-flagged to "mature").

• Hello Felipe, welcome to SO :) As answered below by O.F., SonarQube has this feature. I did use something similar but the use of this feature made the syntactic colorization quite unreadable, so the leaddev did modify background colors with dark gray scales instead of text colors. – Benj Sep 13 '19 at 22:26
• I think a better word may be "age". Also does changing the indentation level of a snippet reset this counter? This could happen if something was put inside a conditional without changing the code itself. – Thorbjørn Ravn Andersen Sep 15 '19 at 13:25

I think you can use: https://github.com/erikbern/git-of-theseus

It can visualize the amount of code still in use since its conception.

This is a graph of the Git codebase itself:

• Funny. It hints at a soft ceiling for the amount of LOC in use. – Mindwin Sep 13 '19 at 17:07
• @Mindwin to go beyond that border is the land of enterprise code Simba. You must never venture there. – mbrig Sep 13 '19 at 18:16

On browsing through the of @Niels van Reijmersdal answer, I found this written in the README

Markovtsev Vadim implemented a very similar analysis that claims to be 20%-6x faster than Git of Theseus. It's named Hercules and there's a great blog post about all the complexity going into the analysis of Git history.

So well lookup Hercules and go through the blog post.

Disclaimer: I have neither used Hercules, nor git-of-theseus.

Well, SonarQube has a metric actually called Maturity, so, yeah. :)

The best tool I know is Codescene https://codescene.io.

You can check Codacy. This will give some insight about code.