2 releases
new 0.1.1 | May 12, 2025 |
---|---|
0.1.0 | May 12, 2025 |
#1115 in Text processing
Used in quagga
125KB
1.5K
SLoC
Warrah
warrah
is a command-line utility and a Rust library that sloppily removes code comments from a text file and outputs the result to stdout:
> warrah code.py
It's a sloppy program because it doesn't fully parse the code. It uses simple and fast logic to detect single- and multi-line comments. Consequently, it will remove comments inside strings and may result in invalid code.
The main use of this utility is to strip comments from code in order to feed it to an LLM, where occasionally incorrect code is fine. Thus the main focus here is on speed, low resource usage, language coverage and simplicity, not correctness.
Supported languages
Warrah supports single and multi-line comments in over 60 programming and markup languages, including popular ones like:
- Python
- JavaScript/TypeScript
- Rust
- Java
- C/C++
- Go
- Ruby
- HTML/CSS
- Shell scripts
- and many more...
For a complete list of supported languages and their comment syntax, please see docs/languages.md.
Installation
There are three ways to install Warrah.
Install using Cargo
First install Rust, then run:
cargo install warrah
Homebrew
Install with Homebrew:
brew tap evgenyneu/warrah
brew install warrah
Pre-built binaries
Download a pre-built binary from the GitHub Releases page.
- Download the appropriate version for your platform.
- Move the binary to a location in your PATH.
Usage
warrah [PATH]
PATH: The path to the code file to strip comments from. The language is auto-detected from the file name or extension.
Output goes to stdout, use >
to save it:
warrah code.py > code_no_comments.py
Rust library
See https://crates.io/crates/warrah if you want to use Warrah as a Rust library.
Development
See docs/development.md for instructions on how to set up the development environment.
Contributing
See contributing guidelines in CONTRIBUTING.md.
What's Warrah?
The warrah, or Falkland Islands wolf (Dusicyon australis), also known as the "Antarctic wolf," was the only native land mammal of the Falkland Islands. It was hunted by settlers for its fur and perceived threat to livestock, leading to its extinction in 1876.

Falkland Island fox or "Antarctic Wolf" by John Gerrard Keulemans, from St. George Mivart's Dogs, Jackals, Wolves, and Foxes: A Monograph of the Canidae, published by R. H. Porter, London, 1890. Lithography by Mintern Brothers. Source: Wikimedia Commons.
Feedback is welcome
If you need help or notice a bug, feel free to create an issue ticket. We will be happy to help. :D
The unlicense
This work is in public domain.