Count lines of code

For example: https://github.com/tokio-rs/axum

How it works

Under the hood is scc tool, a fast and accurate code counter that supports over 300 languages and multiple output formats. We are grateful to the developers of scc for creating such a powerful and reliable tool.

How to use from terminal

You can use this service as an API by sending a request with wget or curl and getting a human-readable response. Terminal browsers such as lynx are also supported.

To send a request to this service, use the following link structure:

https://cloc.info/[git_host]/[git_owner]/[git_repo]

where [git_host] is the hosting platform for git, [git_owner] is the owner of the repository and [git_repo] is the name of the repository.

Example

To count lines of code for the repository https://github.com/torvalds/libgit2, just append to https://cloc.info/ the rest of the URL github.com/torvalds/libgit2

$ curl https://cloc.info/github.com/torvalds/libgit2
$ wget -qO- https://cloc.info/github.com/torvalds/libgit2
-------------------------------------------------------------------------------
Language                 Files     Lines   Blanks  Comments     Code Complexity
-------------------------------------------------------------------------------
C                          717    287940    53208     23097   211635      35225
C Header                   355     66273     7175     25338    33760       1372
Plain Text                 113       994       93         0      901          0
CMake                       49      2632      421       406     1805        230
Markdown                    27      4958     1170         0     3788          0
Shell                       17      1562      297       108     1157        242
BASH                        12        96       24        12       60          0
License                      6      1455      266         0     1189          0
HTML                         5       175        0         0      175          0
PHP                          5       201       18        30      153         15
JSON                         4        64        0         0       64          0
YAML                         4       859       26        37      796          0
Autoconf                     3       125       26        97        2          2
gitignore                    3        11        0         2        9          0
Module-Definition            2        58        0         0       58          0
Python                       2       507       40        12      455         48
-------------------------------------------------------------------------------
Total                     1324    367910    62764     49139   256007      37134
-------------------------------------------------------------------------------
Estimated Cost to Develop (organic) $9,125,564
Estimated Schedule Effort (organic) 31.86 months
Estimated People Required (organic) 25.44
-------------------------------------------------------------------------------
Processed 11310219 bytes, 11.310 megabytes (SI)
-------------------------------------------------------------------------------

This command will return a table with the number of lines of code for each programming language in the repository, as well as some metrics, such as the estimated cost of development, the estimated time of completion, and the estimated number of people required.

You can use the same syntax for any other git platform, such as gitlab.com or bitbucket.org, just by replacing [git_host] with the corresponding host.

Feedback

If you have any suggestions or questions, please feel free to open issue on GitHub repository. I would appreciate your feedback.