search cancel

Calculate the number of lines of code for the source repository


Article ID: 189915


Updated On:


CA Harvest Software Change Manager CA Harvest Software Change Manager - OpenMake Meister


Our customer would like to calculate the number of lines of code for the source repository.
Is there a way to output this info as a CSV file (and compute via pivot table) or get it from via a Dashboard report?


Release : 13.0

Component : CA Harvest Software Change Manager


There are a couple of things that complicate this idea.  The first is that Harvest stores all the files checked in as "blob" or "raw" data inside the database.  No easy way to "look inside a file" while it's checked into the database. So the files would have to be checked out first, even if only to a temporary location.  The second is that in many cases, we would want to identify which files are source code and which are object files, properties files, or other types of supporting data.  No need to try to count lines of code in an exe or jpg file, for example.  Normally this second objective is done by targeting only certain file extensions to be checked out.

So, what we would need to do would be to check out all the files we designate as source code files, then run some sort of script or app to count the lines in each of those files.  The first part is easily done with a standard checkout command (or, if you have your source code deployed to a server somewhere it's already checked out there).  For the second part, I googled "program to count lines of code" and got several hits back for scripts, applications and programs that others have created to do just that.

In the end, it can be done, but not with any out of the box function inside Harvest.