Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How can I get project statistics?
Message
De
26/06/2007 12:33:22
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 6 SP5
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Divers
Thread ID:
01235559
Message ID:
01235714
Vues:
17
It excludes white space and comments (see GetLineCount()) when

The results don't seem unreasonable to me. Yuo have approx 400 objects with code (forms and progs) with approximately 160 lines of code / object. I verified the code on a small project, but it was a fairly 'quick & dirty' prog for reporting project scope.

Here are the results from my last run

Project metrics for: ecn.PJX

Class Count = 416
Lib Count = 24
Form Count = 144
Line Count = 71554
Report Count = 19
Lookup Count = 78
Program Count = 67
Data Table Count = 117
Data View Count = 433

The line count actually felt 'light' to me!

>You might be interested in what it returned - I know its a big project but line count looks very big especially as I'm not big on comments
>
>26/06/2007
>
>Project metrics for: j:\global\global.pjx
>
>Class Count = 3
>Lib Count = 2
>Form Count = 218
>Line Count = 63154
>Report Count = 8
>Lookup Count = 0
>Program Count = 199
>Data Table Count = 0
>Data View Count = 0
>
>Thanks
>
>Colin
>
>
>>>Hi
>>>
>>>I want to produce some stats about a couple of large projects
>>>
>>>No of forms
>>>No of prg
>>>No of reports
>>>
>>>Lines of code
>>>
>>>Is there any easy way to do this?
>>>
>>>Thanks
>>>
>>>Colin
>>
>>Here is one I wrote. Not perfect but met my needs
>>
>>
>>***************************************************************************
>>*!*	Method:			ProjMetrics
>>*!*	Purpose:		Calc some simple project metrics
>>*!*	Author:			bxk 11.11.03
>>*!*	Parameters:
>>*!*	Returns:
>>*!*	Modifications:	
>>***************************************************************************
>>LPARAMETERS tcProjectName
>>
>>ASSERT !EMPTY(tcProjectName) .AND. VARTYPE(tcProjectName) = 'C' ;
>>	MESSAGE 'A project name is required'
>>	
>>ASSERT EMPTY(JUSTEXT(tcProjectName)) .OR. UPPER(JUSTEXT(tcProjectName)) = 'PJX' ;
>>	MESSAGE 'A _PROJECT_ name is required'
>>	
>>CLOS ALL
>>CLOS DATA ALL
>>SET CENTURY ON
>>
>>LOCAL lnClassCount, lnFormCount, lnLibCount, lnLineCount, lnRptCount, ;
>>	lnDBFCount, lnProgCount, lcOut, lnLines, lcProjName, lcFileName, lnViewCount, ;
>>	lnTableCount
>>	
>>STORE 0 TO lnClassCount, lnFormCount, lnLibCount, lnLineCount, ;
>>	lnRptCount, lnDBFCount, lnProgCount, lnViewCount, lnTableCount
>>	
>>STORE "" TO lcOut
>>
>>#DEFINE CRLF CHR(13) + CHR(10)
>>
>>IF ! ('.' $ tcProjectName)
>>	lcProjName = tcProjectName + '.PJX'
>>ELSE
>>	lcProjName = tcProjectName
>>ENDIF
>>
>>USE (lcProjName) in 0 ALIAS metProject
>>SELECT metProject
>>SCAN FOR !DELETED()
>>	lcType = ALLTRIM(metProject.type)
>>	
>>	&& Handle project objects implemented as tables
>>	IF lcType $ 'M,V,K,R,d'
>>		lcObj = ALLTRIM(metProject.name)
>>		USE IN SELECT ('metObject')
>>		USE (lcObj) IN 0 AGAIN ALIAS metObject
>>		SELECT metObject
>>		
>>		DO CASE	
>>			CASE lcType = 'M'						&& Menus
>>				SCAN FOR !EMPTY(metObject.procedure)
>>					lnLines = ALINES(laLines, metObject.procedure)
>>					lnLineCount = lnLineCount + GetLineCount(@laLines)
>>				ENDSCAN
>>				
>>			CASE lcType = 'V'						&& ClassLibs
>>				COUNT TO lnCount FOR !EMPTY(class)
>>				lnClassCount = lnClassCount + lnCount
>>				lnLibCount = lnLibCount + 1
>>				
>>				SCAN FOR !EMPTY(methods)
>>					lnLines = ALINES(laLines, metObject.methods)
>>					lnLineCount = lnLineCount + GetLineCount(@laLines)
>>				ENDSCAN
>>			
>>			CASE lcType = 'K'						&& Forms
>>				lnFormCount = lnFormCount + 1
>>				SCAN FOR !EMPTY(metObject.methods)
>>					lnLines = ALINES(laLines, metObject.methods)
>>					lnLineCount = lnLineCount + GetLineCount(@laLines)
>>				ENDSCAN
>>			
>>			CASE lcType = 'R'						&& Reports
>>				lnRptCount = lnRptCount + 1
>>				SCAN FOR !EMPTY(metObject.expr)
>>					lnLines = ALINES(laLines, metObject.expr)
>>					lnLineCount = lnLineCount + GetLineCount(@laLines)
>>				ENDSCAN
>>				
>>			CASE lcType = 'd'
>>				SCAN FOR !DELETED()
>>					DO CASE
>>						CASE objecttype = 'View'
>>							lnViewCount = lnViewCount + 1
>>						
>>						CASE objecttype = 'Table'
>>							lnTableCount = lnTableCount + 1
>>						
>>					ENDCASE
>>				ENDSCAN
>>			
>>		ENDCASE
>>		
>>	ELSE
>>		IF lcType = 'D'								&& Tables
>>			lnDBFCount = lnDBFCount + 1
>>		ELSE
>>			IF lcType = 'P'							&& Programs
>>				lnProgCount = lnProgCount + 1
>>				lcProg = ALLTRIM(metProject.name)
>>				lcLines = FILETOSTR(lcProg)
>>				lnLines = ALINES(laLines, lcLines)
>>				lnLineCount = lnLineCount + GetLineCount(@laLines)
>>			ENDIF
>>		ENDIF
>>		
>>	ENDIF
>>
>>ENDSCAN
>>
>>lcOut = lcOut + CRLF + CRLF
>>lcOut = lcOut + DTOC(DATE())
>>lcOut = lcOut + CRLF + CRLF
>>lcOut = lcOut + + 'Project metrics for: ' + lcProjName + CRLF + CRLF
>>lcOut = lcOut + 'Class Count      = ' + TRAN(lnClassCount) + CRLF
>>lcOut = lcOut + 'Lib Count        = ' + TRAN(lnLibCount) + CRLF
>>lcOut = lcOut + 'Form Count       = ' + TRAN(lnFormCount) + CRLF
>>lcOut = lcOut + 'Line Count       = ' + TRAN(lnLineCount) + CRLF
>>lcOut = lcOut + 'Report Count     = ' + TRAN(lnRptCount) + CRLF
>>lcOut = lcOut + 'Lookup Count     = ' + TRAN(lnDBFCount) + CRLF
>>lcOut = lcOut + 'Program Count    = ' + TRAN(lnProgCount) + CRLF
>>lcOut = lcOut + 'Data Table Count = ' + TRAN(lnTableCount) + CRLF
>>lcOut = lcOut + 'Data View Count  = ' + TRAN(lnViewCount) + CRLF
>>
>>lcFileName = JUSTSTEM(lcProjName) + 'Metrics.txt'
>>StrToFile(lcOut, lcFileName)
>>
>>MESSAGEBOX(lcFileName + ' Created')
>>
>>CLOS DATA ALL
>>
>>
>>RETURN
>>
>>***************************************************************************
>>*!*	Method:			GetLineCount
>>*!*	Purpose:		Returns lines of code in a Method, Prg.  Ignore comments
>>*!*					white space.
>>*!*	Author:			bxk
>>*!*	Parameters:
>>*!*	Returns:
>>*!*	Modifications:	
>>***************************************************************************
>>FUNCTION GetLineCount
>>LPARAMETERS taLines
>>
>>LOCAL lnCount, lnLines
>>STORE 0 TO lnCount, lnLines
>>
>>lnLines = ALEN(taLines)
>>FOR li = 1 TO lnLines
>>	IF EMPTY(taLines[li]) .OR. LEFT(ALLTRIM(taLines[li]), 1) $ '&*'
>>	
>>	ELSE
>>		lnCount = lnCount + 1
>>		
>>	ENDIF
>>ENDFOR
>>
>>RETURN lnCount
>>
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform