It's all about the answers!

Ask a question

[closed] Calculate Lines of Code from RTC


Pavithra Kasturirangan (42956056) | asked Sep 17 '12, 8:41 a.m.
closed Aug 22 '13, 12:25 p.m. by Millard Ellingsworth (2.5k12431)
 Hi,

My requirement is to capture the Lines of Code and the number of lines added or removed from the source files in the stream for the tracking purpose. I understand that RTC does not offer any direct facility to do this. I would like to know how this is practiced in other companies. Any suggestions are much appreciated.

Regards,
Pavithra 

Comments
Anthony Kesterton commented Sep 17 '12, 9:09 a.m.
JAZZ DEVELOPER

Hi Pavithra - at what point in the development cycle do you want to capture this info? I assume it is when you deliver to the stream - but wanted to check my assumption. Once you capture the info - how do you want to access this info later on? I would also be really interested in how you plan to use this info (if you are able to disclose this)


Pavithra Kasturirangan commented Sep 17 '12, 9:35 a.m. | edited Aug 14 '13, 3:27 p.m.

I want to do this once the code is delivered.Say, the source code that is considered for a regression build.

After every successful build, i would like to calculate the Lines of code added/Removed.


Anthony Kesterton commented Sep 18 '12, 10:38 a.m.
JAZZ DEVELOPER

RTC works in terms of change sets - so it must be holding this information somewhere. The trick is to work out how to get at it - and how to make sure you can see it. Let me continue to look around and see if I can find this for you.

Perhaps someone else knows how to do this and can comment.


Pavithra Kasturirangan commented Aug 14 '13, 11:41 a.m. | edited Aug 17 '13, 12:52 a.m.

 Hi Anthony,


I'm still looking for some help on generating the data on the number of lines added, removed and modified between two streams/snapshots/folders

I had a look at the example link for Diff command, however that is not so useful. I would like to see more working examples of file comparisons, snapshot comparisons, etc

Any help on the examples will be much appreciated.


Pavithra Kasturirangan commented Aug 14 '13, 11:59 a.m. | edited Aug 17 '13, 12:52 a.m.

I tried to compare my local changes with the stream.


The changes i have done are  "This is a hello world program for test" to "This is a hello world program for test1"
and added a new line "#Second comment added"

When i execute the Diff i get the output as
-#This is a hello world program for test
+#This is a hello world program for test1

But, the change is only the modification and not the line deletion.
Please let me know if there is a better way to get the count on the line added, deleted and modified.


C:\Users\xyz\workspace>"C:\Program Files\IBM\TeamConcert\scmtools\eclipse\lscm" diff changeset 1008
diff -u -N SampleBuild/src/HelloWorld.java SampleBuild/src/HelloWorld.java
--- SampleBuild/src/HelloWorld.java     2013-08-14 20:23:09.000000129 +0530
+++ SampleBuild/src/HelloWorld.java     2013-08-14 21:16:27.000000117 +0530
@@ -1,6 +1,7 @@

-#This is a hello world program for test
+#This is a hello world program for test1
+#Second comment added
 public class HelloWorld {
     public static void main(String[] args) {
         System.out.println("Hello World");


1
Tim Mok commented Aug 14 '13, 3:32 p.m.
JAZZ DEVELOPER

You might want to try stack overflow for suggestions as this is beyond the scope of RTC.

http://stackoverflow.com/questions/104756/how-do-you-count-your-lines-of-code

That's one person that has asked the question before. It's ultimately up to you how you want to determine the diff to be a line add/del/mod. You've got the data but you need to process it.


sam detweiler commented Aug 15 '13, 7:29 a.m.

RTC doesn't provide an out of the box mechanism to get this metric. Other tools do,
jenkins, team city and some of the  code review tools.


Pavithra Kasturirangan commented Aug 16 '13, 4:26 a.m.

Thank you, Tim

Thank you for the Link, Hope that at some time, we will have this made available in RTC
 


Geoffrey Clemm commented Aug 17 '13, 1:02 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Just for interest's sake, what is your purpose for collecting information about the number of lines of code that were changed?   It used to be collected primarily because it was an easy thing to measure, and not because it actually provides much value.  In particular, it commonly was used to either measure productivity (which is a really bad idea) or code churn (which can be effectively approximated by "number of changes sets" ... the additional detail of "lines of code" does not usually add significant value).


Pavithra Kasturirangan commented Aug 22 '13, 8:00 a.m.

 Thank you, Tim. I had a look at the other options.

@Geoffrey, We have components that are to be closely tracked for certain changes. Management would like to have a detailed report on such components apart from the generic LOC metrics

showing 5 of 10 show 5 more comments

The question has been closed for the following reason: "Question is answered as well as it can be." by millarde Aug 22 '13, 12:25 p.m.