Skip to content

Smart Rust LOC counter, distinguising code, examples, tests and doc comments

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

Maximkaaa/cargo-warloc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Wise Analysis of Rust Lines of Code (WarLOC)

There are hundreds of tools that count lines of code in you software project. But have you ever wondered how many of those lines are inside hundreds of unit tests spread across your Rust modules? And let's be honest, we all what to brag about our project documentation being bigger than the code itself.

warloc can help you with both of those issues and more. Here is what it does you:

  • Counts separately lines of codes, documentation comments, regular comments and blank lines.
  • Separates those into lines belonging to main code, tests and examples.
  • Finds integration tests under tests directories.
  • Finds unit test code and fixtures under #[cfg(test)] and #[test].
  • Understands (to a limit) Rust syntax, so is more accurate in its counts then most generic LOC counters.
  • Does not count ignored (by .gitignore) files.
  • Can optionally give you stats file-by-file.

Here is the output for cargo repository:

File count: 1188
Type         | Code         | Blank        | Doc comments | Comments     | Total       
-------------|--------------|--------------|--------------|--------------|-------------
Main         | 82530        | 9682         | 12625        | 6220         | 111057      
Tests        | 144421       | 20538        | 588          | 10151        | 175698      
Examples     | 169          | 27           | 5            | 19           | 220         
-------------|--------------|--------------|--------------|--------------|-------------
             | 227120       | 30247        | 13218        | 16390        | 286975      

Installation

cargo install cargo-warloc

Usage

cargo warloc

Contributing

This project is made for fun, so there are no plans for implementing new features and fixing bugs (unless they feel like fun). If you like the project and you want it do something it doesn't, submit a PR, I'll gladly merge it (unless it's buggy or/and unreasonable) and publish the new version.

License

MIT or Apache 2.0 on your discretion.

Bragging

Got stats of your project and want to brag about it? Open a new thread in the discussions.

About

Smart Rust LOC counter, distinguising code, examples, tests and doc comments

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages