{"id":21683407,"url":"https://github.com/stonestepsinc/linecnt","last_synced_at":"2025-03-20T11:22:50.711Z","repository":{"id":134152252,"uuid":"307147995","full_name":"StoneStepsInc/linecnt","owner":"StoneStepsInc","description":"A line counting utility for C-like source files","archived":false,"fork":false,"pushed_at":"2021-03-21T22:56:36.000Z","size":208,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-25T11:41:57.311Z","etag":null,"topics":["line-count","line-counting","line-counts","linecnt","source-line-counting","source-lines"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/StoneStepsInc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-10-25T17:00:19.000Z","updated_at":"2021-03-22T02:03:22.000Z","dependencies_parsed_at":null,"dependency_job_id":"e653fe13-5db2-4f7b-8b53-80ea8967d64e","html_url":"https://github.com/StoneStepsInc/linecnt","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StoneStepsInc%2Flinecnt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StoneStepsInc%2Flinecnt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StoneStepsInc%2Flinecnt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StoneStepsInc%2Flinecnt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/StoneStepsInc","download_url":"https://codeload.github.com/StoneStepsInc/linecnt/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244601397,"owners_count":20479448,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["line-count","line-counting","line-counts","linecnt","source-line-counting","source-lines"],"created_at":"2024-11-25T16:11:49.469Z","updated_at":"2025-03-20T11:22:50.683Z","avatar_url":"https://github.com/StoneStepsInc.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Line Counting Utility\r\n\r\n`lincnt` is a source line counting utility for C-like files. It uses a simple\r\nparser to recognize C and C++ style comments to distinguish code and comment\r\nlines and count them separately.\r\n\r\n### What's Counted\r\n\r\n`linecnt` counts separately comments, empty lines and brace lines, which are\r\nlines with single open and close brace characters. Everything else is considered\r\ncode.\r\n\r\nFor example, this is how the following source file will be counted:\r\n\r\n    ///                                         \u003c-- C++ comment\r\n    /// @brief Go to a URL.                     \u003c-- C++ comment\r\n    ///                                         \u003c-- C++ comment\r\n    void go(const std::string\u0026 url)             \u003c-- code\r\n    {                                           \u003c-- brace\r\n        if(url.empty()) {                       \u003c-- code\r\n            fw(\"http://localhost/\");            \u003c-- code (ignores `//` within a string)\r\n        }                                       \u003c-- brace\r\n        else {                                  \u003c-- code\r\n            fw(url); // go to the URL           \u003c-- code + C++ comment\r\n        }                                       \u003c-- brace\r\n        /* used to return an error              \u003c-- C comment\r\n        return result;                          \u003c-- C comment\r\n        */                                      \u003c-- C comment\r\n    }                                           \u003c-- brace\r\n                                                \u003c-- empty line\r\n\r\nSingle-quoted and double-quoted strings are recognized and comments within\r\nstrings are ignored.\r\n\r\nNote that JavaScript's template literals are ignored by the current parser\r\nand may be miscounted. For example, this line will be counted as code and a\r\nC++ comment:\r\n\r\n    let url = `http://localhost/${path}`;\r\n\r\n### Syntax\r\n\r\n    linecnt [-s] [-v] [-d dir-name] [-c] [-j] [ext [ext [ ...]]]\r\n\r\n      -s    Process files in the current directory and all subdirectories\r\n      -v    Produce verbose output\r\n      -d    Start in the specified directory\r\n      -c    Add common C/C++ extensions to the list\r\n      -j    Add common Java extensions to the list\r\n      -V    Print version information\r\n      -W    Print warranty information\r\n      -h    Print this help\r\n\r\nLines are counted in files identified by extensions. There is no default extension\r\nlist and at least one extension must be specified either explicitly or via the\r\nshorthand `-c` and `-j` options.\r\n\r\nOnly current directory is scanned by default. Sub-directories may be scanned using\r\nthe `-s` option. Alternative directory may be specified via `-d` and may be either\r\na relative or an absolute directory.\r\n\r\n### Examples\r\n\r\nScan `.c`, `.cpp` and `.h` files in the current directory.\r\n\r\n    linecnt cpp c h\r\n\r\nScan `.java` and `.inc` files in the directory `src`, relative to the current\r\ndirectory, and all of its sub-directories.\r\n\r\n    linecnt -d src -s -j inc\r\n\r\nScan commont C++ extensions in the directory `/prj/src` and all of its sub-directories.\r\n\r\n    linecnt -d /prj/src -s -c\r\n\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstonestepsinc%2Flinecnt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstonestepsinc%2Flinecnt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstonestepsinc%2Flinecnt/lists"}