yesqa
Automatically remove unnecessary `# noqa` comments.
What it is and what it does
yesqa is a maintenance tool that scans Python code for `# noqa` comments and removes those that are no longer needed. It integrates with flake8 to determine which suppressions are actually suppressing violations; if a comment no longer matches any active violation, it gets removed. This is useful when your linting configuration changes (e.g., you increase max line length), when code is refactored and violations disappear, or when noqa comments were added by mistake.
The tool works as a standalone command-line utility or as a pre-commit hook, making it easy to enforce clean suppression comments across a team or CI pipeline. It depends on flake8 for violation detection and tokenize-rt for safe comment manipulation, and supports both CPython and PyPy on modern Python versions.
Use it for:
- Clean up noqa comments after raising your flake8 line-length limit or disabling certain checks.
- Remove stale suppressions when refactoring code that previously violated linting rules.
- Enforce hygiene in pre-commit hooks to prevent accumulation of dead noqa comments over time.
- Audit a codebase to find noqa comments that were added by mistake and no longer serve a purpose.
- Integrate into CI to automatically flag or remove unnecessary suppressions during code review.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
yesqa automatically removes unnecessary `# noqa` comments from Python code, detecting and cleaning up suppressions that no longer apply due to configuration changes, code modifications, or mistakes.
Yes. yesqa solves a real maintenance problem—noqa comment drift—with low install friction, active maintenance, permissive licensing, and no known vulnerabilities. It's most valuable in teams or projects that use flake8 and want to keep suppression comments honest over time.
Install
yesqa on PyPI
pip
pip install yesqauv
uv add yesqapoetry
poetry add yesqaInstalling yesqa
Before you install
Low friction: pure Python wheel with only two runtime dependencies (flake8 and tokenize-rt). Actively maintained as of July 2026 with consistent commit history.
License in practice
MIT license (permissive) places no restrictions on use, modification, or distribution in commercial or private projects.
Quickstart
pip install yesqa
# Run on a Python file
yesqa your_file.py
# Or use as a pre-commit hook by adding to .pre-commit-config.yaml:
# - repo: https://github.com/asottile/yesqa
# rev: v1.5.0
# hooks:
# - id: yesqa
Requires Python 3.8 or later; flake8 must be installed (included as a runtime dependency).
Verify before relying
- Whether yesqa correctly handles all flake8 plugin combinations when additional_dependencies are specified.
- Performance characteristics on very large codebases or projects with many noqa comments.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — flake8, tokenize-rt |
| Maintenance | actively maintained — 1,161 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 132,383/month — #11,554 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: yesqa-1.5.0-py2.py3-none-any.whl
Tags
More Quality Assurance packages
Coverage.py measures which lines of Python code…
permissive · top 1,000 on PyPI
ruffRuff is a Python linter and code formatter…
permissive · top 1,000 on PyPI
pexpectPexpect spawns and controls interactive console…
permissive · top 1,000 on PyPI
blackBlack reformats Python source code to a…
permissive · top 1,000 on PyPI
pytest-xdistpytest-xdist distributes pytest tests across…
permissive · top 1,000 on PyPI
cfn-lintValidates AWS CloudFormation templates in YAML…
permissive · top 1,000 on PyPI
flake8-noqaA flake8 plugin that validates the formatting…
copyleft · top 5,000 on PyPI
autoflakeautoflake removes unused imports and unused…
permissive · top 5,000 on PyPI
deadcodeScans Python codebases to find and optionally…
agpl · top 15,000 on PyPI
eradicateEradicate detects and removes commented-out…
permissive · top 5,000 on PyPI
pyupgradeAutomatically rewrites Python source code to…
permissive · top 5,000 on PyPI
cppcleancppclean analyzes C++ source code to identify…
permissive · top 15,000 on PyPI
nb-cleannb-clean removes execution counts, metadata,…
permissive · top 15,000 on PyPI
pep8Checks Python code against PEP 8 style…
permissive · top 5,000 on PyPI
pip-autoremoveA command-line tool that uninstalls a package…
permissive · top 15,000 on PyPI
refurbRefurb is a static analysis tool that scans…
copyleft · top 15,000 on PyPI