Skip to content

Instantly share code, notes, and snippets.

@eduard93
Created June 28, 2016 20:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eduard93/58c762bd67dc7f507b7f19a2371bfdde to your computer and use it in GitHub Desktop.
Save eduard93/58c762bd67dc7f507b7f19a2371bfdde to your computer and use it in GitHub Desktop.
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