skillfed

flake8-noqa

Flake8 noqa comment validation

flake8-noqa v1.5.0 1.4M downloads/30d#3,924 on PyPI39
Copyleft license GNU Lesser General Public License v3 AGING released

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-noqa

uv

uv add flake8-noqa

poetry

poetry add flake8-noqa

Installing 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

Environment :: ConsoleFramework :: Flake8Intended Audience :: DevelopersLicense :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)Programming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.9Topic :: Software Development :: Libraries :: Python ModulesTopic :: Software Development :: Quality Assurance

Tags

flake8 noqa comment validationnoqa comment formatterflake8 plugin quality checkvalidate noqa syntaxdetect unused noqa commentsflake8 comment linter
flake8-plugincode-quality

More Python Modules packages