talira

cloc counts blank lines, comment lines, and physical lines of source code in many programming languages

open sourceGPL-2.0-or-laterself-hostablefree

cloc counts blank lines, comment lines and physical lines of source code in many programming languages, in files, directories, compressed archives and git commits. Given two versions of a code base it reports the differences, and it can sum results across runs and projects. It is a single self-contained Perl script with no dependencies outside standard Perl, with a Windows executable and a Docker image too, and writes results as text, Markdown, SQL, JSON, XML, YAML or CSV. It is written by Al Danial and has been developed since 2006.

Ways to install

Problems it solves

  • how many lines of code are in this repo, broken down by language
  • count only real code, not blank lines or comments, for a project estimate
  • compare the size of two releases of our codebase line by line
  • count the code in a tarball or zip file without extracting it
  • get line counts per language as JSON or CSV for a report
  • count lines of code at a specific git commit
  • add up code size across several projects in one table
  • a line counter that runs on Windows with no Perl installed

Features

  • counts blank, comment and code lines in many programming languages
  • counts files, directories, archives (tar, Zip, .ear) and git commits
  • diff mode between two versions of a code base
  • sum results across runs and projects
  • output as text, Markdown, SQL, JSON, XML, YAML and CSV
  • read comment definitions for new languages from a file
  • single self-contained file, no dependencies outside standard Perl
  • Windows executable and Docker image

Capabilities

Has a command line toolplan not known

Alternatives

The same job

These do what cloc does.

  1. Tokei Count your code, quickly.

Compare cloc with the top 3