yesqa

raw JSON →
1.5.0 verified Mon Apr 27 auth: no python

yesqa automatically removes unnecessary `# noqa` comments from Python code. It works by running flake8 (or other supported linters) to determine which noqa directives are actually needed. Current version is 1.5.0, released as a command-line tool with no Python API. Maintenance is active.

pip install yesqa
error ModuleNotFoundError: No module named 'flake8'
cause yesqa requires flake8 to be installed in the same Python environment.
fix
Run 'pip install flake8' to install flake8.
error yesqa: error: argument filename: expected one argument
cause yesqa requires at least one filename as argument. Running without arguments is not supported.
fix
Specify a file or use wildcard: 'yesqa *.py'
error Cannot find configuration for flake8 in setup.cfg or .flake8
cause yesqa looks for flake8 configuration files. If missing, it may not detect custom error codes.
fix
Create a flake8 configuration file (e.g., .flake8) in your project root.
gotcha yesqa does not work without flake8 or a compatible linter installed. It relies on flake8's AST to determine which noqa comments are needed. Without flake8, yesqa will raise an ImportError.
fix Ensure flake8 is installed: pip install flake8
gotcha Running yesqa on a file that already has noqa comments on every line may remove all of them if they are all unnecessary, potentially exposing previously ignored lint errors. Always review the diff.
fix Use version control to review changes: 'git diff' before committing.
deprecated yesqa versions prior to 1.0.0 used a different CLI interface. If you have an old script using 'python -m yesqa' without arguments, it may not work as expected.
fix Update to latest version: pip install --upgrade yesqa

Basic usage: run 'yesqa <file>' to remove unnecessary noqa comments. The tool reads flake8 configuration from setup.cfg, tox.ini, or .flake8 automatically.

# Run yesqa on a single file
yesqa myfile.py

# Run yesqa on all Python files in a directory (using find)
find . -name '*.py' -exec yesqa {} +

# Run with flake8 options (passed through to flake8)
yesqa --ignore E501 myfile.py