Metadata-Version: 2.4
Name: flake8-no-emoji
Version: 0.2.6
Summary: A Flake8 plugin that detects emojis in Python source code
Author: AlgorithmAlchemy
License: MIT
Keywords: flake8,plugin,emoji,linter,pre-commit,unicode,code style,static analysis,code quality,no-emoji-in-code
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Quality Assurance
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Text Processing :: Linguistic
Classifier: Framework :: Flake8
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: License :: OSI Approved :: MIT License
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: regex
Requires-Dist: emoji>=2.0.0
Dynamic: license-file

# flake8-no-emoji

`⭐️ Thanks everyone who has starred the project, it means a lot!`

[![PyPI version](https://img.shields.io/pypi/v/flake8-no-emoji.svg?logo=pypi&logoColor=white)](https://pypi.org/project/flake8-no-emoji/)
Install from **PyPI** by clicking the badge above.

[![GitHub](https://img.shields.io/badge/GitHub-Repository-black?logo=github&logoColor=white)](https://github.com/AlgorithmAlchemy/flake8-no-emoji)  
View the **source code on GitHub**

![Downloads](https://pepy.tech/badge/flake8-no-emoji)
![License](https://img.shields.io/pypi/l/flake8-no-emoji.svg)

**Flake8 plugin that detects and reports any emoji characters in Python source code.**
Helps keep your codebase clean, consistent, and free from unwanted Unicode emojis.

---

## Features

**Note:** Do not set the same category in both `--ignore-emoji-types` and `--only-emoji-types`, as `only` takes
precedence over ignore.

* Scans Python files for **all Unicode emoji characters** (including multi-codepoint clusters).
* Raises a linting error (`EMO001`) when emojis are found.
* Supports filtering by **emoji categories**:

    * `--ignore-emoji-types=PEOPLE,FOOD`
    * `--only-emoji-types=FLAGS`
* Works seamlessly with **Flake8** and **pre-commit hooks**.
* Lightweight and dependency-minimal (`regex` and `emoji` required).

---

## Installation

```bash
pip install flake8-no-emoji
```

---

## Usage

Run normally via `flake8`:

```bash
flake8 app
```

```bash
flake8 --select=EMO
```

Example output:

```
/example.py:3:10: EMO001 Emoji detected in code
```

---

## Configuration

You can configure categories to **ignore** or **allow exclusively**.

### Ignore certain categories

```bash
flake8 --ignore-emoji-types=PEOPLE,FOOD
```

This ignores emojis in the `PEOPLE` and `FOOD` categories, but still reports others.

### Allow only specific categories

```bash
flake8 --only-emoji-types=FLAGS
```

This only reports `FLAGS` emojis, ignoring everything else.
(**Note:** `only` takes precedence over `ignore`.)

---

## Example (with pre-commit)

Add to `.pre-commit-config.yaml`:

```yaml
repos:
  - repo: https://github.com/AlgorithmAlchemy/flake8-no-emoji
    rev: v0.2.6
    hooks:
      - id: flake8
        additional_dependencies: [ flake8-no-emoji ]
```

Run:

```bash
pre-commit run --all-files
```

---

## Categories Supported

* **PEOPLE** 👩 👨 😀
* **NATURE** 🌳 🐶 🌸
* **FOOD** 🍕 🍔 🍎
* **ACTIVITY** ⚽ 🎮 🎭
* **TRAVEL** ✈️ 🚗 🚀
* **OBJECTS** 💻 📱 📚
* **SYMBOLS** ❤️ ☮️ ✔️
* **FLAGS** 🇺🇸 🇯🇵 🏳️‍🌈
* **OTHER** (fallback if no match)

---

## Error Codes

* **EMO001** — Emoji detected in code.

---

## Development

Clone and install in editable mode:

```bash
git clone https://github.com/AlgorithmAlchemy/flake8-no-emoji
cd flake8-no-emoji
pip install -e .[dev]
pytest
```

---

## License

MIT License © 2025 [AlgorithmAlchemy](https://github.com/AlgorithmAlchemy)
