Skip to content

Instantly share code, notes, and snippets.

Created June 28, 2016 20:33
What would you like to do?
Calculate class or package length in sloc
ClassMethod ProjectLength(Mask As %String = "%Package%")
Set count = 0
Set rset = ##class(%SQL.Statement).%ExecDirect(,"SELECT Name FROM %Dictionary.ClassDefinition WHERE NOT Name %STARTSWITH '%sqlcq' AND Name LIKE ?", Mask)
While rset.%Next() {
Set class = rset.%Get("Name")
Do ##class(%Compiler.UDL.TextServices).GetTextAsArray(, class, .raw)
Set lines = $ORDER(raw($CHAR(0)), -1)
Write class, $JUSTIFY("", 40-$LENGTH(class)), $JUSTIFY(lines, 7), !
Set count = count + lines
Write "Total ", $JUSTIFY("", 34), $JUSTIFY(count, 7)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment