Just another blazingly fast LOC counter.
It works (and it's really fast too) but it is not finished yet. You may check the known issues below to make sure that you want to use it.
This is my first ever project in Rust; developed while reading the Rust Book!
My sincere apologies to the Rust community for possibly abusing the language; at the time rlocc is written I've been still fighting with the borrow checker :P
Assuming Rust is already installed, rlocc can be built using the provided Makefile:
$ make
which simply uses cargo as usual:
$ RUSTFLAGS="-Ctarget-cpu=native" cargo build --release
Even though rlocc has been developed as a library, for now it is mostly meant to be used through the accompanying binary.
In other words, its API is not really well-thought for use outside the provided binary.
As a command line tool, rlocc is very simple to use: it receives any number of file or directory names as command line input, and walks through them counting them.
For example, to count files file1, ../file3 and all files under ~/dir2, one can issue:
$ rlocc file1 ~/dir2 ../file3
No command line flags are supported at this time.
So far rlocc has only been tested on linux/amd64 with Rust 1.42.0 or later.
Currently rlocc supports 76 types of files.
It guesses the file type mostly via file name extensions, with very few exceptions (for Makefile, Dockerfile, etc).
The exhaustive list of all supported file types:
- Ada
- Assembly
- Autoconf
- AWK
- Batch
- C
- C++
- C/C++ Header
- C#
- Clojure
- CMake
- COBOL
- CSV
- CSS
- D
- Dart
- Delphi
- Dockerfile
- Eiffel
- Elm
- Elixir
- Erlang
- F#
- .gitignore
- Go
- Haskell
- HTML
- Java
- Javascript
- JSON
- Julia
- Jupyter
- Kotlin
- License files
- Lisp
- Lua
- Makefile
- MAL (MonetDB)
- Markdown
- Matlab
- Nim
- Nix
- OCaml
- OpenCL
- Pascal
- Perl
- PHP
- Plain Text
- Pony
- PowerShell
- Protocol Buffers
- Python
- R
- ReStructuredText
- Ruby
- Rust
- Scala
- Scheme
- Sed
- Shell
- SML
- Solidity
- SQL
- Swift
- Systemd
- TeX
- Tcl
- TOML
- TypeScript
- V
- Vala
- VimL
- WebAssembly (text format)
- YAML
- XML
- Zig
-
TODO: Proper code & installation documentation to publish at crates.io.
-
TODO: Command line options for the binary.
-
TODO: For now, when a token that begins a multi-line comment appears inside a string (in any supported language that supports both multi-line comments and strings) ,
rlocccannot handle it and the results of LOC count for that whole file get calculated wrong with high probability. -
Nested comments are not handled. (I don't think I'm gonna fix this, since it's not really a use case for me.)