Is there anyway to know the current lines of code that are stored in a TFS Collection.
2 Answers
For TFVC, assuming you have reporting enabled, you can look at the analysis cube -- under "Code Churn", there's a "total lines of code" metric.
I don't think there's anything equivalent for Git.
This ultimately leads back to the questions:
- "What are you trying to do with this information?"
- "What do you consider a 'line of code'?" Is a comment a line of code? How about a line that only contains a curly brace? Does whitespace count?
For what it's worth, there's typically not much value in knowing this number.

- 57,011
- 13
- 100
- 120
-
Hi @Daniel , we need to calculate the total number of lines of code to contract a tool which cost is based on the total number of lines of code . About the second point is a good point we need to ask the vendor . What would be the alternative if we do not have the reporting enabled? – jcromanu May 16 '18 at 15:32
For more detail info of how to use Code Churn, please go through the official tutorial: Analyze and report on code churn and coverage using the code churn and run coverage perspectives
You could find them in TFS’s database (warehouse) that how many lines added ,lines deleted ,lines modified, total lines and so on. Highly suggest you to use this method, not to hard to enable reporting.
If you do not have the reporting enabled, there are no end of tools to count lines in source files in TFS so far. One workaround should be: get the entire collection locally, you can then count the number of lines in every file that is of a type that has code in it (*.cs, vb, aspx, etc.) Many tools can count lines,even though cumbersome but effective method.
For git, a simple way is pushing your code to a github private repo, and then use Google Chrome browser - GLOC extension here. If you do not want to use github as a bridge, you could try to use some script in this question Can you get the number of lines of code from a Github repository?

- 49,478
- 5
- 35
- 62