What changed in cloc from 1 to 2
7 releases numbered after v1.98 up to and including v2.12, stable releases only. v1.98 and v2.12 are the newest stable releases of 1 and 2 we track; this page follows them as new ones ship.
148 changes across 7 releases
- Add support for the AL (Business Central) language
- Add support for the CUE language
- Add support for the KDL language
- Add support for the RON language
- Add support for the Salam language
- Add support for the Sema language
- Add support for Windows INF files
- Add support for the Wren language
- Add ability to count contents of .gem files
- Add --total switch to show total column counts
- Add .scp as an extension for SQL stored procedures
- Add .inc as an extension for Assembly
- Add support for the beluga language
- Add support for the C3 language
- Add support for CodeQL files
- Add support for the DAML language
- Add support for the Quxlang language
- Add support for the Rhai language
- Add support for the Slang language
- Add support for --by-percent with --fmt formatting styles
- Support process substitution as input to --sum-reports on Unix-like operating systems only
- Support input through process substitution on Unix-like operating systems
- Add support for Activiti Business Process files
- Add support for Aria files
- Add support for AXAML files
- Add support for Bicep files
- Add support for BitBake files
- Add support for Clarity files
- Add support for Haskell Boot files
- Add support for Hibernate files
- Add support for JSP Tag Library Definition files
- Add support for Jasper Report XML/Template files
- Add support for Justfile files
- Add support for Liquibase files
- Add support for Magik files
- Add support for VSCode Workspace files
- Add support for Yarn files
- Add .cts extension for TypeScript
- Add .vbhtml extension for Visual Basic .NET
- New switch --include-submodules (applies to --vcs=git) to include git submodule files in the count
- Support for the Cangjie language
- Support for the Elixir Script language
- Support for Fortran 2003
- Support for the Jsonnet language
- Support for the Nextflow language
- Support for the Nushell language
- Support for the Org Mode file type
- Support for the Rego language
- Support for UXML and USS (Unity) file types
- Column headers for the --show-lang and --show-ext output
- New switch --files-from as a synonym for --vcs
- New switch --ksep/--thousands-delimiter to show a separator between thousands in output counts, defaulting to a comma
- New switch --percent as a shortcut to --by-percent t to show percentage of totals in the blank, comment, and code columns
- Backtick and C++ style comment support for Svelte
- Results are written in multiple formats when multiple output format switches are given, such as --json --yaml --xml
- Github Actions workflow to package a release, including a Windows executable that works with symlinks as used by winget
- Support for counting Blueprint files
- Support for counting Cadence files
- Support for counting Civet files
- Support for counting MoonBit files
- Support for counting Pek files
- Support for counting Pkl files
- Support for counting SurrealQL files
- Arch Linux AUR package available for cloc
- New switch --ignore-regex to exclude files whose content matches a regex
- New switch --unique to identify unique files found
- Descriptive message at the end of a run if timeouts were encountered
- Support for the Arturo language and file type
- Support for Glimmer JavaScript language and file type
- Support for Glimmer TypeScript language and file type
- Support for the Luau language and file type
- Support for the Modelica language and file type
- Support for the Mojo language and file type
- Support for the Nickel language and file type
- Support for the Pawn language and file type
- Support for the Processing language and file type
- Support for the Templ language and file type
- Support for the Yang language and file type
- Support SQL output with --diff
- Support counting in git repository directories not owned by the user
- Added support for new languages and file types: AnsProlog, AppleScript, ArkTs, Astro, Dafny, PlusCal, Prisma Schema, PRQL, Slint, Snakemake, TLA+, and vyper
- Added five new output formats selectable with the new --fmt switch, including language name with --by-file counts
- Added .j2 as a Jinja Template file extension
- Added .mts as a TypeScript file extension
- Added .iuml, .pu, .plantuml, and .wsd as PlantUML file extensions
- Added support for Java block comments
- Added recognition of autogenerated C# SpecFlow files, which can be ignored with --no-autogen
- Added support for --list-file with --git-diff-* options
- SQL output adds a foreign key 'id' to table t referencing 'id' in the metadata table, with the key value set to Unix epoch seconds when cloc was invoked
- Added support for // comments in ReasonML
- Exclusion list files now support directories, excluding all files below the named directories
- Added support for --exclude-file-list with --git --diff
- Added new switch --strip-code, which attempts to leave only comments in the output file
- Make --exclude-lang case insensitive to be consistent with --include-lang
- Recognize comment markers in single quoted QML strings
- Skip the contents of .venv directories
- Update the wscript implementation, which is a filename rather than an extension
- Update the BibTeX entry in the README
- Improve Perl filter for POD (plain old documentation) handling
- --quiet now suppresses all informational output including error messages unless the new switch --show-errors is also given
- Renamed "VB for Applications" to "VBA"
- Renamed "Visual Basic Script" to "VBScript"
- Revert back to manual build of Windows executable to avoid issues with symlinks seen with winget on executables created in GitHub Actions
- Removed the -> separator in --show-ext output
- Removed leading blank space for --fmt output written to STDOUT
- Changed the sequence of Python language filters so docstrings are handled before #
- Jenkinsfile is now recognized as Groovy
- Improved Windows/Unix path conflict handling when using --git --diff in git-bash terminal
- On Windows, the git archive command used with --git --diff uses zip format instead of tar
- Updated the Windows executable to work better with the Microsoft winget package manager
- Follow file renames when pairing files for --git --diff
- Slight performance improvement for --help by installing temporary modules later
- Eliminate the need to write temporary files when using --fmt
- Improve handling of C comments in Go strings
- Files matching *.o.d are now ignored
- Ignore .gitattribute files
- Improved support for --exclude-list-file
- More consistent and accurate results from --diff
- Disambiguated .inc files among PHP, Pascal, and Fortran
- Use secure handling of system calls to expand archive files
- Prevent regex timeouts in Swift
- Lower memory requirements when handling large XML/HTML and binary files
- Fix double-open on Windows when handling long paths
- Ensure an archive file is not a directory before attempting to extract it
- Fix handling of nested archive files, such as a zip file inside a zip file
- Handle empty files when using --git --diff
- Replace "Nothing to count." output with valid formatted output (JSON, etc) when no files are found to count
- Fix language definition parse errors with --read-lang-def and --force-lang-def by updating the matching regex to allow a leading '.' as in .NET
- Removed the file irregular"file2.md from the test suite, as filenames with embedded double quotes are illegal in Windows and caused git pull problems
- Removed duplicate percent entry in options handling
- Support for --exclude-lang in --diff mode
- Fixed --exclude-lang when used in diff mode and all files are additions or deletions
- On Windows, removed temporary SCALAR(0x..) files created when using --fmt
- Handled --by-file for JSON and YAML outputs with single and double quotes in file names
- Better handling of Vuejs
- Better handling of Oracle PL/SQL
- Better error message on failure to count .src.rpm files if external tools are not installed
- Non-Glade .ui files are identified as 'XML (Qt/GTK)' instead of 'Qt'
- File filter rules are applied with --no-recurse
- Restore Dockerfile CI by fixing CPAN module setup that stopped installing Parallel::ForkManager
- Improve --fmt output column alignments
- Handle --no-match when combined with --fullpath and --vcs
- Symlink problem when installed via winget, resolved by a second Windows executable cloc-2.02-winget.exe that includes PR #850
- Fixed JSON output generator inserting a superfluous comma
- More accurate counts of XML with block comments
- More accurate counts of Java with block comments and comment markers within strings
- Fixed improper handling of --match-d and --not-match-d
- Fix vulnerabilities in the handling of archive files (zip, tar, rpm, whl, gem, etc) that could allow remote code execution from a maliciously crafted archive
Original release notes, newest first
The list above is our reading of these notes; the originals from Al Danial are here, one fold per release.
v2.12v2.12 -- Security Update
This is a security release to address vulnerabilities in the handling of archive files (zip, tar, rpm, whl, gem, etc). A maliciously crafted archive file counted with cloc versions before this release can allow a remote code execution (RCE) attack.
All users are encouraged to update to this (or newer, when available) version.
New Languages and File Types:
- AL (Business Central)
- CUE
- KDL
- RON
- Salam
- Sema
- Windows INF
- Wren
Updates:
- Add ability to count contents of .gem files.
- New switch
--totalto show total column counts - Make
--exclude-langcase insensitive to make it consistent with--include-lang - Recognize comment markers in single quoted QML strings
- Add .scp as an extension for SQL stored procedures
- Add
.incas an extension for Assembly
Bug fixes:
- Secure handling of system calls to expand archive files.
- Prevent regex timeouts in Swift.
- Lower memory requirements when handling large XML/HTML and binary files.
- Fix double-open on Windows when handling long paths.
- Ensure an archive file is not a directory before attempting to extract it.
v2.10
New Languages and File Types:
- beluga
- C3
- CodeQL
- DAML
- Quxlang
- Rhai
- Slang
Updates:
- Skip contents of
.venvdirectories. - Update wscript implementation (this is a filename, not an extension).
- Updated BibTeX entry in the README.
- Add support for
--by-percentwith--fmtformatting styles. - Support process substitution as input to
--sum-reports(Unix-like operating systems only).
Bug fixes:
- Fix handling of nested archive files (ie, a zip file inside a zip file).
v2.08
New Languages and File Types:
- Activiti Business Process
- Aria
- AXAML
- Bicep
- BitBake
- Clarity
- Haskell Boot
- Hibernate
- JSP Tag Library Definition
- Jasper Report XML/Template
- Justfile
- Liquibase
- Magik
- VSCode Workspace
- Yarn
Updates:
- Support input through process substitution on Unix-like operating systems (example:
cloc <(git diff HEAD~1 HEAD --name-only)) - Improve Perl filter for POD (plain old documentation) handling.
--quietnow suppresses all informational output including error messages unless new switch--show-errorsis also given.- Add
.ctsextension for TypeScript. - Renamed "VB for Applications" to "VBA"
- Add
.vbhtmlextension for Visual Basic .NET - Renamed "Visual Basic Script" to "VBScript"
- New switch
--include-submodules(applies to--vcs=git) to include git submodule files in the count. - Revert back to manual build of Windows executable to avoid issues with symlinks seen with winget on executables created in Github Actions.
Bug fixes:
- Handle empty files when using
--git --diff. - Replace "Nothing to count." output with valid formatted output (JSON, etc) when no files are found to count.
- Fix language definition parse errors with
--read-lang-def,--force-lang-def(specifically, update matching regex to allow leading '.' as in .NET)
v2.062.06
New Languages and File Types:
- Cangjie
- Elixir Script
- Fortran 2003
- Jsonnet
- Nextflow
- Nushell
- Org Mode
- Rego
- UXML, USS (Unity)
Updates:
- First attempt at using Github Actions to package a release including making a Windows executable that works with symlinks as used by winget
- Add column headers for
--show-langand--show-extoutput - Remove
->separator in--show-extoutput - Remove leading blank space for
--fmtoutput written to STDOUT - New switch
--files-fromas a synonym for--vcs - New switch
--ksep/--thousands-delimiterto show a separator (default is a comma) between thousands in output counts - Change sequence of Python language filters so that docstrings are handled before #
- Jenkinsfile now recognized as Groovy
- Improve Windows/Unix path conflicts when using
--git --diffin git-bash terminal - New switch
--percentas a shortcut to `--by-percent t' to show percentage of totals in blank, comment, code columns - Add backtick and C++ style comment support for Svelte
- Write results in multiple formats if multiple output format switches are given (for example
--json --yaml --xml)
Bug fixes:
- Remove file
irregular"file2.mdfrom the test suite as filenames with embedded double quotes are illegal in Windows and cause git pull problems (among other issues). This file is created dynamically during testing on non-Windows operating systems. - On Windows use zip format instead of tar for the 'git archive' command used when running with
--git --diff - Remove duplicate "percent" entry in options handling
- Support
--exclude-langin--diffmode - Fix
--exclude-langoption when used in diff mode and when all files are additions or deletions - On Windows, remove temporary
SCALAR(0x..)files created when using--fmt - Handle
--by-filefor JSON and YAML outputs with single and double quotes in file names
Update 2025-06-29: updated Windows executable to work better with Microsoft winget package manager
v2.04
New Languages and File Types:
- Blueprint
- Cadence
- Civet
- MoonBit
- Pek
- Pkl
- SurrealQL
Updates:
- Follow file renames when pairing files for --git --diff.
- Arch Linux now has an AUR package for cloc.
- New switch --ignore-regex to exclude files whose content matches a regex.
- New switch --unique to identify unique files found.
- Descriptive message at the end of a run if timeouts were encountered.
- Slight performance improvement for --help by installing temporary modules later.
Bug fixes:
- Better handling of Vuejs.
- Better handling of Oracle PL/SQL.
- Better error message on failure to count
.src.rpmfiles if external tools are not installed. - Identify non-Glade
.uifiles as 'XML (Qt/GTK)' instead of 'Qt'. - Apply file filter rules with
--no-recurse.
v2.02
New Languages and File Types:
- Arturo
- Glimmer JavaScript
- Glimmer TypeScript
- Luau
- Modelica
- Mojo
- Nickel
- Pawn
- Processing
- Templ
- Yang
Updates:
- Support SQL output with
--diff - Support counting in git repository directories not owned by the user.
- Eliminate the need to write temporary files when using
--fmt. - Restore Dockerfile CI by fixing CPAN module setup that somehow stopped installing
Parallel::ForkManager. - Improve handling of C comments in Go strings.
Bug fixes:
- Improve
--fmtoutput column alignments. - Handle
--no-matchwhen combined with--fullpathand--vcs.
Update 2024-08-25: Added a second Windows executable, cloc-2.02-winget.exe, which includes PR #850 to resolve the symlink problem described in #849. winget in particular uses symlinks when it installs applications.
v2.00
Note: There are no breaking changes between the 1.xx versions and this 2.00 release.
New Languages and File Types:
- AnsProlog
- AppleScript
- ArkTs
- Astro
- Dafny
- PlusCal
- Prisma Schema
- PRQL
- Slint
- Snakemake
- TLA+
- vyper
Updates:
- Five new output formats with the new
--fmtswitch. Includes the often- requested addition of language name with--by-filecounts. - *.o.d files are ignored
- Added .j2 as a Jinja Template extension.
- Added .mts as a TypeScript extension.
- Added .iuml, .pu. .plantuml, .wsd as as PlantUML extensions.
- Support Java block comments.
- More consistent and accurate results from
--diff. - Disambiguate .inc files among PHP, Pascal, and Fortran.
- Ignore .gitattribute files.
- Improved support for
--exclude-list-file. - Fix JSON output generator which inserted a superfluous comma.
- Recognize autogenerated C# SpecFlow files and ignore them with
--no-autogen. - Support
--list-filewith--git-diff-*. - SQL output: add foreign key 'id' to table t referencing 'id' in the metadata table. The key value is Unix epoch seconds when cloc was invoked.
- Support // comments in ReasonML.
- Support directories in exclusion list files; all files below the named directories are excluded.
- Support
--exclude-file-listwith--git --diff. - New switch,
--strip-code, which attempts to only leave comments in the output file.
Bug fixes:
- More accurate counts of XML with block comments.
- More accurate counts of Java with block comments and comment markers within strings.
- Fix improper handling of
--match-dand--not-match-d.