emoji-remover

Crates.ioemoji-remover
lib.rsemoji-remover
version0.1.0
created_at2025-10-11 15:00:13.971823+00
updated_at2025-10-11 15:00:13.971823+00
descriptionA fast command-line tool to remove emojis from source code files
homepagehttps://github.com/jamiepine/emoji-remover
repositoryhttps://github.com/jamiepine/emoji-remover
max_upload_size
id1878279
size459,398
Jamie Pine (jamiepine)

documentation

https://github.com/jamiepine/emoji-remover

README

emoji-remover

A command-line/pre-commit tool to remove emojis from code files.

Because your code deserves better than AI-generated emoji spam. Built with Rust for blazing-fast emoji annihilation.

Features

  • Fast: Multi-threaded processing using Rayon
  • Smart: Respects .gitignore files by default
  • Flexible: Process individual files or entire directories
  • Safe: Dry-run mode to preview changes before applying
  • Clean: Removes trailing spaces left after emoji removal
  • Zero Dependencies: Single binary with no runtime dependencies
  • Install as a Git Pre-commit Hook: Follow the instructions below to set up emoji-remover as a pre-commit hook.

Installation

From Source

cargo install emoji-remover

From Binary

Download the latest release from the releases page.

Usage

# Remove emojis from a single file
emoji-remover path/to/file.rs

# Remove emojis from an entire directory
emoji-remover path/to/project/

# Dry run - see what would be removed without making changes
emoji-remover --dry-run path/to/project/

# Process specific file extensions only
emoji-remover --extensions "rs,js,ts" path/to/project/

# Ignore .gitignore files
emoji-remover --no-ignore path/to/project/

# Quiet mode - only show files with changes
emoji-remover --quiet path/to/project/

As a Git Pre-commit Hook

Option 1: If installed via cargo

Create .git/hooks/pre-commit in your repository:

#!/bin/bash
echo "Running emoji remover..."

# Get list of staged files
FILES=$(git diff --cached --name-only --diff-filter=ACM)

if [ -n "$FILES" ]; then
    # Run emoji-remover on staged files only
    echo "$FILES" | xargs emoji-remover --quiet
    
    # Re-add the modified files
    echo "$FILES" | xargs git add
fi

exit 0

Then make it executable:

chmod +x .git/hooks/pre-commit

Option 2: If built from source

The repository includes an installation script:

# Clone and build
git clone https://github.com/jamiepine/emoji-remover.git
cd emoji-remover
cargo build --release

# Install as pre-commit hook in your project
cd /path/to/your/project
/path/to/emoji-remover/install-pre-commit.sh

Options

-d, --dry-run         Perform a dry run without modifying files
-e, --extensions      File extensions to process (comma-separated)
-q, --quiet          Quiet mode - only show files with changes
    --no-ignore      Don't respect .gitignore files
-h, --help           Print help

Default File Extensions

By default, emoji-remover processes files with these extensions: rs, js, ts, jsx, tsx, py, java, c, cpp, h, hpp, go, rb, php, cs, swift, kt, scala, md, txt

Data Source

The emoji data used by this tool is sourced from Emoji-List-Unicode, which provides a comprehensive list of emojis from the Unicode official website.

The tool includes:

  • All standard emojis from all-emoji.json
  • Emoji variations with skin tone modifiers from full-emoji-modifiers.json

Build Process

The emoji data is processed at compile time using a Rust build script (build.rs). This approach:

  • Embeds all emoji patterns directly into the binary
  • Eliminates runtime file I/O for emoji data
  • Results in a single, self-contained executable

Performance

  • Multi-threaded file processing using Rayon
  • Efficient .gitignore handling via the ignore crate
  • Zero-allocation string replacements where possible
  • Typical processing speed: ~1000 files/second on modern hardware

License

MIT License - see LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Acknowledgments

Commit count: 0

cargo fmt