flake8-noqa
Flake8 noqa comment validation
What it is and what it does
flake8-noqa is a flake8 plugin that enforces correct formatting of `# noqa` comments and detects when they are unnecessary or malformed. It catches subtle mistakes like missing colons, extra spaces, or duplicate codes that would cause flake8 to misinterpret a targeted suppression as a blanket one—potentially hiding errors you care about. The plugin reports errors via codes like NQA001–NQA004 for formatting issues, NQA101–NQA104 for unnecessary or unmatched suppressions, and NQA011–NQA013 for the `# flake8: noqa` variant.
The plugin integrates directly into flake8's linting pipeline and requires no separate configuration to activate. It supports optional modes to enforce that all noqa comments include error codes, and can optionally include the plugin name in error messages. The description notes that some flake8 plugins intercept noqa comments before flake8 sees them, which can cause false positives; in such cases, the offending plugin should be configured to let flake8 handle noqa logic.
Use it for:
- Catch typos in noqa comments (missing colons, wrong spacing) that would silently become blanket suppressions and hide real errors.
- Enforce a team standard that all noqa comments must include specific error codes rather than blanket suppressions.
- Identify and remove unnecessary noqa comments that target violations no longer present in the codebase.
- Detect duplicate error codes within a single noqa comment and flag them for cleanup.
- Validate that noqa comments actually match violations flake8 has detected on that line.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
A flake8 plugin that validates the formatting and necessity of `# noqa` comments in Python code, catching malformed comments that would be silently ignored and flagging unnecessary suppressions.
Yes, if you use flake8 and want to prevent silent noqa comment failures. The plugin is lightweight, has no surprising dependencies, and solves a real problem: malformed noqa comments are easy to write and hard to spot. Maintenance is aging but the repository is active. The copyleft license is a consideration for proprietary projects. No known vulnerabilities.
Install
flake8-noqa on PyPI
pip
pip install flake8-noqauv
uv add flake8-noqapoetry
poetry add flake8-noqaInstalling flake8-noqa
Before you install
Low friction: pure Python wheel with only flake8 and typing_extensions as runtime dependencies. Maintenance is aging (188 days since last release), but the repository is active and not archived.
License in practice
Licensed under GNU Lesser General Public License v3 (copyleft). Derivative works and modifications must be distributed under the same or compatible license; proprietary code using this plugin should review copyleft obligations.
Quickstart
pip install flake8-noqa
# Then run flake8 as normal; the plugin activates automatically
flake8 your_file.py
# Optional: enable code requirement in config or CLI
flake8 --noqa-require-code your_file.py
Requires Python 3.9 or later and flake8 to be installed and configured in your project.
Verify before relying
- Whether the plugin's error codes (NQA001–NQA104) can be suppressed via flake8's standard ignore mechanisms without creating circular logic.
- Compatibility with flake8 plugins that process noqa comments themselves (the description notes this as a known anti-pattern but doesn't enumerate which plugins are affected).
Package facts
| License | GNU Lesser General Public License v3 (copyleft) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — flake8, typing_extensions |
| Maintenance | aging — 188 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,421,083/month — #3,924 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: flake8_noqa-1.5.0-py3-none-any.whl
Keywords: flake8, noqa
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
flake8-htmlA flake8 plugin that converts code style…
permissive · top 15,000 on PyPI
yesqayesqa automatically removes unnecessary `#…
permissive · top 15,000 on PyPI
flake8-fixmeA flake8 plugin that detects and flags…
permissive · top 15,000 on PyPI
flake8Flake8 is a command-line tool that combines…
permissive · top 1,000 on PyPI
flake8-blackA flake8 plugin that runs black's code style…
permissive · top 15,000 on PyPI
flake8-printA flake8 plugin that detects print statements…
permissive · top 5,000 on PyPI
flake8-string-formatA Flake8 plugin that validates string format…
permissive · top 15,000 on PyPI
pep8Checks Python code against PEP 8 style…
permissive · top 5,000 on PyPI
flake8-expression-complexityA flake8 extension that detects overly complex…
permissive · top 15,000 on PyPI
autopep8autopep8 automatically reformats Python code to…
permissive · top 5,000 on PyPI