Calculate class or package length in sloc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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