Opened 11 years ago

Closed 11 months ago

# Add lines of code statistics

Reported by: Owned by: no_spam_f@… anybody highest Request-a-Hack normal lievenswouter@…, Filipe Correia, sincoder 0.11

### Description

Show lines of code (LOC) for components and plot their change over time, maybe including LOC for changesets grouped by commiting user.

### comment:1 Changed 11 years ago by anonymous

Cc: lievenswouter@… added; anonymous removed → 0.8

### comment:2 Changed 10 years ago by anonymous

I need this hack. Thanks.

### comment:3 follow-up:  4 Changed 10 years ago by Bhuricha Deen Sethanandha

Plan to work on this if more people want it.

### comment:4 in reply to:  3 Changed 10 years ago by anonymous

Plan to work on this if more people want it.

Trac definately needs this. :)

### comment:5 Changed 10 years ago by tedbundyjr

+ vote. will be usefull for all the dev. team member to evaluate their performance. :)

### comment:6 Changed 10 years ago by johnzhang

Trac Release: 0.8 → 0.11

a must-have feature for trac

### comment:7 Changed 10 years ago by anonymous

+1

A must-have feature also. But must also work with other VCS systems not just SubVersion! --JamesMills

### comment:8 Changed 9 years ago by anonymous

That would be a really great addition to Trac.

### comment:9 Changed 9 years ago by anonymous

I see this feature like this: When you "browse source" in trac there's an additional button "LOC stats" displayed next to the directory or file.

• If you press it next to the file, you'll see a plot of LOC over time for that file.
• If you press it next to some directory, you'll see a plot of LOC over time for the whole directory (sum of LOC of all files).
• It might be useful to jump there from the changeset entries in the timeline

me too :)

I vote for this

### comment:12 Changed 9 years ago by anonymous

Needs it we do, yeees...

### comment:13 Changed 9 years ago by Toby

Why does Lines of code == coder performance?

byte[] buffer;
buffer = byte[]{48, 65, 6C, 6C, 6F, 20, 57, 6F, 72, 6C, 64};
String s = new String(buffer);
OutputStream out = System.out;
out.print(s);
out.print("\n");


vs

System.out.println("Hello World");


Top version = 6x as performing than the bottom one, and thats not even with comments.

### comment:15 Changed 9 years ago by anonymous

would also love this

### comment:16 Changed 9 years ago by anonymous

LOC alone is a pretty useless stat. I wouldn't mind some "code statistics" not just LOC, but %Lines comments, largest file. file with largest "scoped object" i.e. function, method, whatever your language offers. complexity...all that.

anyway, if my idea of the plugin is the idea, then the plugin should just read/display, and define a format for the data to adhere too, and let external tools, or other plugins (or sub parts) do the work. (i.e., I don't want the # of classes in Java crap, it has bazillions, and my c code has none.).

Well, that's my take, maybe it's a different plugin.

### comment:17 Changed 9 years ago by anonymous

+1

I agree that LOC in no very meaningful, but at least it gives some insight if a developer changed 1 or 100 lines of code over a certain time period.

### comment:18 Changed 8 years ago by anonymous

LOC stats would be very very useful. All coders should know how efficient code they write so the "Hello World" example above is pretty irrelevant. Even if you're a team leader you should have guidelines and control over your team. And if not you would be able to monitor the lines of code are written by each member of your team over time, so would be able to pick up on coders with LOC above the average (either they work too hard (yeah right) or they write inefficient code).

When can we have this hack then? :)

### comment:19 Changed 8 years ago by anonymous

Have a look at statSVN, this does most of this already, but it would be good to have it integrated into trac.

I would be careful with LOC metrics as a productiviy measure, as others have highlighted. I would also suggest that for simplicity a simple physical lines of code count is done (i.e. none comment, none blank lines) as that can be made to work for a large number of languages. More detailed lines of code, such as a logical LOC are difficult to develop and are language specific. My company has Ada, Java, C, C++, C.NET, ASP and assembler in use as a mimimum!

### comment:20 Changed 7 years ago by sincoder

Cc: sincoder added normal → highest

I would give my left arm for this feature!

unfortunately statSVN needs a local checkout of the repository. If this can be achieved by the plugin a integration with statSVN would be perfect!

### comment:21 Changed 6 years ago by Jay

LOC, generally, is a useless statistic as shown in the println example above. however, in macro view, and depending on the industry/application, it has some value. However, making use of some external stats tool is ideal, then if you find loc useful, great, have it. If you find complexity calculation useful, add it.

The key, that was lost a bit in the follow on comments, was having it organized/summed by Component, rather than just per file. Other associations might be useful also, like by severity, or Date range? This would require some kind of association between file and component, and a little discipline in coding standards to maintain that, and might requiring configuration/use of the external tools properly to make good use of it.

I like metrics, I find them useful when taken together. I need them to be configurable/adjustable to my needs however, so the external tool idea is the way to go, IMHO.

+1, nice feature

### comment:23 follow-up:  24 Changed 11 months ago by figaro

Will this plugin help?: TracStatsPlugin

### comment:24 in reply to:  23 Changed 11 months ago by Ryan J Ollos

Resolution: → worksforme new → closed

Will this plugin help?: TracStatsPlugin

Possibly, or one of the other plugins with tag:statistics, such as StractisticsPlugin. If someone is interested in this feature, I suggest reviewing the available plugins and request the feature for the plugin where it fits best.

### Modify Ticket

Change Properties