|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Code AnalyzerHi,
Is there a way that I can scan for the total number of lines of code written thus far? I read in Help about a Code Metrics report but can't seem to locate it? Am I on the right track? Thank you in advance! Patrick Hi pregis,
What does this give for information while it becomes now possible in Visual Basic in version 2010 to spread code over more lines than now with one. You mean that persons start making code like this. \\ Dim X as Integer = 5 /// And they are more productive then people doing \\\ Dim X as Integer = 5 /// Code metrics are always asked by persons who want to show that they know nothing about development but want to make it more efficient (With as result that it takes 2 times the time, but than you can see in future the history about that). Just my opinion Cor Show quoteHide quote "pregis" <pre***@discussions.microsoft.com> wrote in message news:102A1570-3C07-40CA-9BCC-CD4C2B76656F@microsoft.com... > Hi, > > Is there a way that I can scan for the total number of lines of code > written > thus far? I read in Help about a Code Metrics report but can't seem to > locate it? Am I on the right track? > > Thank you in advance! > > Patrick I was just asking sir :) I don't know alot about development, that is why I
ask you the questions that I don't understand. I was given a project recently and it allowed me to use Visual Studio 2008 for the first time... It has been a success, in part because of the contributions of others MVP's such as yourself. I appreciate your response, however unhelpful and almost insulting. Thank you. Patrick Show quoteHide quote "Cor Ligthert[MVP]" wrote: > Hi pregis, > > What does this give for information while it becomes now possible in Visual > Basic in version 2010 to spread code over more lines than now with one. > > You mean that persons start making code like this. > \\ > Dim > X > as > Integer > = > 5 > /// > And they are more productive then people doing > \\\ > Dim X as Integer = 5 > /// > > Code metrics are always asked by persons who want to show that they know > nothing about development but want to make it more efficient (With as result > that it takes 2 times the time, but than you can see in future the history > about that). > > Just my opinion > > Cor > > "pregis" <pre***@discussions.microsoft.com> wrote in message > news:102A1570-3C07-40CA-9BCC-CD4C2B76656F@microsoft.com... > > Hi, > > > > Is there a way that I can scan for the total number of lines of code > > written > > thus far? I read in Help about a Code Metrics report but can't seem to > > locate it? Am I on the right track? > > > > Thank you in advance! > > > > Patrick > > Patrick,
Here are two quick ways to get a count using DOS commands. If you never used DOS, use the IDE and click TOOLS | Visual Studio 200x Command Prompt This will open a DOS window. 1) Using FIND command: find /V /C "^M" filename example: find /V /C "^M" testargs2.vb ---------- TESTARGS2.VB: 230 FIND takes a wild card, so you can use it for all files in your project folder for example: D:\Local\projects\wcChat.NET> find /V /C "^M" *.vb ---------- CLSCHATUSER.VB: 44 ---------- COLCHATUSER.VB: 6 ---------- FRMCHATMAIN.DESIGNER.VB: 774 ---------- FRMCHATMAIN.VB: 991 ---------- FRMHELP.DESIGNER.VB: 269 ---------- FRMHELP.VB: 9 ---------- FRMLOGIN.DESIGNER.VB: 191 ---------- FRMLOGIN.VB: 49 ---------- MODCHAT.VB: 98 ---------- SETTINGS.VB: 11 ---------- WCSERVERAPI.VB: 2105 2) Using FOR command in a batch file. The following batch file will count lineso but the count excludes blank lines. Cut and paste/save the following into a file called CountLines.CMD -------------- CUT HERE ----------------- @echo off :----------------------------------------- setlocal: count lines in files :----------------------------------------- if "%1" == "" goto :help : get list of files for %%i in (%*) do call :sub_countfile %%igoto :eof :----------------------------------------- set a=0:sub_countfile :----------------------------------------- : start count the file lines for /f %%i in (%1) do set /A a += 1 : show result and exit call echo ---------- %1: %a%goto :eof :----------------------------------------- echo usage: countlines filespec1 [filespec2] ... [filespecN]:help :----------------------------------------- goto :eof -------------- CUT HERE ----------------- example: countlines testargs2.vb ---------- testargs2.vb: 187 or with a file spec: D:\Local\projects\wcChat.NET> countlines *.vb ---------- clsChatUser.vb: 38 ---------- colChatUser.vb: 4 ---------- frmChatMain.Designer.vb: 769 ---------- frmChatMain.vb: 869 ---------- frmHelp.Designer.vb: 265 ---------- frmHelp.vb: 5 ---------- frmLogin.Designer.vb: 187 ---------- frmLogin.vb: 41 ---------- modChat.vb: 71 ---------- Settings.vb: 10 ---------- wcServerAPI.vb: 1950 You can really do alot these with the extended COMSPEC (DOS) commands today, especially in manipulating text files, lines and strings. Its almost a "real" language. :-) --- pregis wrote: Show quoteHide quote > I was just asking sir :) I don't know alot about development, that is why I > ask you the questions that I don't understand. I was given a project > recently and it allowed me to use Visual Studio 2008 for the first time... It > has been a success, in part because of the contributions of others MVP's such > as yourself. I appreciate your response, however unhelpful and almost > insulting. > > Thank you. > > Patrick > > "Cor Ligthert[MVP]" wrote: > >> Hi pregis, >> >> What does this give for information while it becomes now possible in Visual >> Basic in version 2010 to spread code over more lines than now with one. >> >> You mean that persons start making code like this. >> \\ >> Dim >> X >> as >> Integer >> = >> 5 >> /// >> And they are more productive then people doing >> \\\ >> Dim X as Integer = 5 >> /// >> >> Code metrics are always asked by persons who want to show that they know >> nothing about development but want to make it more efficient (With as result >> that it takes 2 times the time, but than you can see in future the history >> about that). >> >> Just my opinion >> >> Cor >> >> "pregis" <pre***@discussions.microsoft.com> wrote in message >> news:102A1570-3C07-40CA-9BCC-CD4C2B76656F@microsoft.com... >>> Hi, >>> >>> Is there a way that I can scan for the total number of lines of code >>> written >>> thus far? I read in Help about a Code Metrics report but can't seem to >>> locate it? Am I on the right track? >>> >>> Thank you in advance! >>> >>> Patrick >> You can get this info with MZ-Tools add-in, see
http://www.mztools.com/v6/features.aspx#Statistics -- Peter Macej Helixoft - http://www.helixoft.com VSdocman - Commenter and generator of class documentation for C#, VB ..NET and ASP .NET code Wow MZ-Tools for .NET, it's been a long time since I've seen that app. It
was quite handy back in the day, but surely VS 2008 has everything you need built right into it now? Including refactoring, code metrics, analysis etc. Show quoteHide quote "Peter Macej" <pe***@helixoft.com> wrote in message news:e6AqyZO5JHA.1372@TK2MSFTNGP05.phx.gbl... > You can get this info with MZ-Tools add-in, see > http://www.mztools.com/v6/features.aspx#Statistics > > -- > Peter Macej > Helixoft - http://www.helixoft.com > VSdocman - Commenter and generator of class documentation for C#, VB .NET > and ASP .NET code > "nak" <a@a.com>'s wild thoughts were released on Thu, 4 Jun 2009 10:25:18 +0100 bearing the following fruit:>Wow MZ-Tools for .NET, it's been a long time since I've seen that app. It You can probably achieve everything but not without some>was quite handy back in the day, but surely VS 2008 has everything you need >built right into it now? Including refactoring, code metrics, analysis etc. effort. Fortunately I have MZTools so I don't need to ;-) J Show quoteHide quote >"Peter Macej" <pe***@helixoft.com> wrote in message >news:e6AqyZO5JHA.1372@TK2MSFTNGP05.phx.gbl... >> You can get this info with MZ-Tools add-in, see >> http://www.mztools.com/v6/features.aspx#Statistics >> >> -- >> Peter Macej >> Helixoft - http://www.helixoft.com >> VSdocman - Commenter and generator of class documentation for C#, VB .NET >> and ASP .NET code >> -- Jan Hyde Hi Patrick,
> Is there a way that I can scan for the total number of lines of code Just right click the solution or project node in the "Solution Explorer", > written > thus far? I read in Help about a Code Metrics report but can't seem to > locate it? Am I on the right track? which by default is on the right hand side of the IDE. Then click "Calculate Code Metrics". It's also in the "Analyze" menu along the top. Nick. > Just right click the solution or project node in the "Solution That's only available in some versions of VS: I certainly can't find it in > Explorer", which by default is on the right hand side of the IDE. Then > click "Calculate Code Metrics". It's also in the "Analyze" menu > along the top. VS2008 Professional. Andrew Aaah! Maybe it's only part of Team Suite?
I wasn't aware, my bad. Show quoteHide quote "Andrew Morton" <a**@in-press.co.uk.invalid> wrote in message news:78pkftF1nj2slU1@mid.individual.net... >> Just right click the solution or project node in the "Solution >> Explorer", which by default is on the right hand side of the IDE. Then >> click "Calculate Code Metrics". It's also in the "Analyze" menu >> along the top. > > That's only available in some versions of VS: I certainly can't find it in > VS2008 Professional. > > Andrew > > pregis wrote:
> Hi, Patrick, if you all you want is the total lines, you can get a visual > > Is there a way that I can scan for the total number of lines of code written > thus far? I read in Help about a Code Metrics report but can't seem to > locate it? Am I on the right track? > > Thank you in advance! > > Patrick count by putting your cursor at the end of the file and look at the IDE status bar right hand side to get the count <g> Or you can turn on the line numbers on the IDE editor. I like to see line numbers myself, so I can quickly grasp where things are at relatively, "hmmm that function is around line 378,500 or so." <g> Or do what lots of good programmers do - right their own tools especially for something very simple like getting line counts. That would be line 3-5 lines in VB. See the ReadAllLines() function in MSDN. -- > especially for something very simple like getting line counts. That That would not be that easy if you want counting lines in whole project > would be line 3-5 lines in VB. See the ReadAllLines() function in MSDN. or even solution :) -- Peter Macej Helixoft - http://www.helixoft.com VSdocman - Commenter and generator of class documentation for C#, VB ..NET and ASP .NET code Peter Macej wrote:
>> especially for something very simple like getting line counts. That True.>> would be line 3-5 lines in VB. See the ReadAllLines() function in MSDN. > > That would not be that easy if you want counting lines in whole project > or even solution :) I can see a command line tool like: CountLines [filesspec]... [filesspec] [@listfile] [ProjectFile] For the project file option, do a XML read, get the source elements and count each file, produce a report, etc. :-) Of course, to me, that is pretty worthless - just getting line counts unless I wanted to place a Software Engineering rule that no file can be more than 500 lines and/or function can be more than 25 lines to promote black box functional programming, lower QA issues, etc. Such SE rules existed in the past, i.e. federal defense contracts. Can't tell ya if its still followed today - OOPS did change many things. :-) -- |
|||||||||||||||||||||||