"lines of code" for 4D
“lines of code” for 4D
{
"dependencies": {
"loc": {
"github": "miyako/loc",
"version": "latest"
}
}
}
var $folder : 4D.Folder
$folder:=Folder("/SOURCES/")
var $scc : cs.loc.scc
$data:=cs.loc.scc.new($folder).count().data
ALERT(JSON Stringify($data; *))
CLI options are
--count-as 4dm:js,4qs:js,4dsettings:xml,4dcatalog:xml,4dform:json
--format csv
--uloc
var $folder : 4D.Folder
$folder:=Folder("/SOURCES/")
var $loc : cs.loc.loc
$data:=cs.loc.loc.new($folder).count().data
ALERT([JSON Stringify($data; *); "-"*36; $data.sum("count")].join("\r"))
wc -l
)findstr /r/n/s "^"
+ find /c ":"
)the last line of a .4dm
typically doesn’t end with \n
or \r\n
. this has an impact on how lines are counted on each platform.
TEST_form.4dm:1://%attributes = {}
TEST_form.4dm:2:#DECLARE($params : Object)
TEST_form.4dm:3:If (Count parameters:C259=0)
TEST_form.4dm:4: CALL WORKER:C1389(1; Current method name:C684; {})
TEST_form.4dm:5:Else
TEST_form.4dm:6: $form:=cs:C1710._locForm.new()
TEST_form.4dm:7:End if TEST_sync.4dm:1://%attributes = {}
TEST_sync.4dm:2:#DECLARE($params : Object)
in this example, the line count from each file totals 7
+2
=9
, but the command reports 8
.