How to calculate lines of code (LOC) for a folder?

If you are having a problem using Fortress, post a message here.

Moderator: SourceGear

Post Reply
sakari.forsberg
Posts: 1
Joined: Mon Mar 08, 2010 6:38 am

How to calculate lines of code (LOC) for a folder?

Post by sakari.forsberg » Mon Mar 08, 2010 6:44 am

Hello.

I have searched the net but haven't found a way to calculate lines of code for files in a folder in fortress/vault. Is there a way to do that? SQL query will do, as well as a tool (if there is any).

-SF

lbauer
Posts: 9736
Joined: Tue Dec 16, 2003 1:25 pm
Location: SourceGear

Re: How to calculate lines of code (LOC) for a folder?

Post by lbauer » Mon Mar 08, 2010 1:01 pm

We don't have a built in way to do this with Vault. Files are stored as binary Blobs, not text in the datasbase, so you can't run queries against source code in the database.

If you Get the code to disk, you can count lines of code from there.

You can use the Command Line Client or Fortress Client API to do the get of current files or current and previous versions to compare the difference in line count.

Command Line Client documentation is here:

http://download.sourcegear.com/misc/vau ... nt/clc.htm

I found this simple SourceCodeLineCounter on the Internet -- I haven't tried it and don't know how well it works, but I do know that CodeProject is a reputable site. You have to register (it's free) to download the code.

http://www.codeproject.com/KB/files/Sou ... unter.aspx

HTH
Linda Bauer
SourceGear
Technical Support Manager

Post Reply