forked from 4D-JP/code-audit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathparse_lines.txt
45 lines (36 loc) · 1.11 KB
/
parse_lines.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
METHOD GET PATHS(Path all objects;$methods)
$codes:=New collection
$comments:=New collection
$empties:=New collection
$len:=0
For ($m;1;Size of array($methods))
$method:=$methods{$m}
If (Current method path#$method)
METHOD GET CODE($method;code;Code with tokens)
$lines:=Split string(code;"\r";sk trim spaces)
$lines.shift() //remove %attributes
$len:=$len+$lines.length
For each ($line;$lines)
Case of
: (Match regex("\\s*";$line))
$empties.push($line)
: (Match regex("^//.*";$line))
$comments.push($line)
Else
$codes.push($line)
End case
End for each
End if
End for
$total:=$codes.length+$comments.length+$empties.length
$counts:=New collection
$count:=New collection
$count.push("code";$codes.length;100*$codes.length/$total)
$counts.push($count.join("\t"))
$count:=New collection
$count.push("comment";$comments.length;100*$comments.length/$total)
$counts.push($count.join("\t"))
$count:=New collection
$count.push("enpty";$empties.length;100*$empties.length/$total)
$counts.push($count.join("\t"))
SET TEXT TO PASTEBOARD($counts.join("\r";ck ignore null or empty))