GithubHelp home page GithubHelp logo

ckatsak / rlocc Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 0.0 155 KB

Just another blazingly fast LOC counter.

License: GNU General Public License v3.0

Rust 98.57% Makefile 1.43%
count-lines count-lines-of-code command-line-tool rust-library rust cloc cli code

rlocc's Introduction

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.)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.