flake8-debugger

4.1.2 · active · verified Wed Apr 15

flake8-debugger is a plugin for the flake8 code quality tool that checks for the presence of common debugger statements (like `pdb.set_trace()`, `ipdb.set_trace()`, and `breakpoint()`) in Python code. This helps prevent accidental commits of debugging code into production. The current version is 4.1.2. Releases are made periodically, typically following updates to Python versions or the flake8 ecosystem.

Warnings

Install

Quickstart

Install flake8-debugger alongside flake8. It automatically integrates. Create a Python file with a debugger statement and run flake8 on it to see the plugin in action.

import os

def my_function():
    # This line will be flagged by flake8-debugger
    if os.environ.get('DEBUG_ENABLED', 'false').lower() == 'true':
        import pdb; pdb.set_trace()
    print("Hello, world!")

my_function()

# To run this example:
# 1. Save the code as example.py
# 2. Run 'pip install flake8 flake8-debugger'
# 3. Run 'flake8 example.py' in your terminal
# Expected output will include an error like 'example.py:6:9: D001 debugger detected'

view raw JSON →