Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

[closed] Calculate Lines of Code from RTC

 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 

0 votes

Comments

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)

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.

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.

 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.

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");

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.

1 vote

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.

Thank you, Tim

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

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).

 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details

Question asked: Sep 17 '12, 8:41 a.m.

Question was seen: 7,452 times

Last updated: Aug 22 '13, 12:25 p.m.

Confirmation Cancel Confirm