Skip to content
This repository has been archived by the owner on Oct 8, 2022. It is now read-only.
/ rlocc Public archive

Just another blazingly fast LOC counter.

License

Notifications You must be signed in to change notification settings

ckatsak/rlocc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rlocc

Just another blazingly fast LOC counter.

Build Status (master) Build Status (develop) GitHub

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.

Disclaimer

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

Contents

Build

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

Usage

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.

Platforms

So far rlocc has only been tested on linux/amd64 with Rust 1.42.0 or later.

Supported File Types

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

Known issues & TODOs

  • 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) , rlocc cannot 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.)