https://github.com/miyako/loc
"lines of code" for 4D
https://github.com/miyako/loc
4d-class 4d-component
Last synced: about 1 month ago
JSON representation
"lines of code" for 4D
- Host: GitHub
- URL: https://github.com/miyako/loc
- Owner: miyako
- License: mit
- Created: 2024-11-20T00:52:06.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2025-03-13T07:43:20.000Z (about 1 month ago)
- Last Synced: 2025-03-13T08:32:56.164Z (about 1 month ago)
- Topics: 4d-class, 4d-component
- Language: 4D
- Homepage: https://miyako.github.io/loc/
- Size: 655 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README


[](LICENSE)
# loc
"lines of code" for 4D## dependencies.json
```json
{
"dependencies": {
"loc": {
"github": "miyako/loc",
"version": "latest"
}
}
}
```## 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`.