Skip to content

miyako/loc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

version platform license downloads

loc

"lines of code" for 4D

dependencies.json

{
   "dependencies": {
   	"loc": {
   		"github": "miyako/loc",
   		"version": "*"
   	}
   }
}

macOS (wc -l)

Windows (findstr /r/n/s "^" + find /c ":")

remarks

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.

  • on Mac the final line is excluded regardless of its content.
  • on Windows, the final line is excluded except for the last file in a directory. this is because all files in a directory and its subdirectories are evidently concatenated before processing, which means the first line of a file is added to the last line of the previous file in sequence.
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.