Skip to main content

Flake8 plugin to forbid debug function usage

Project description

Screenshot

made-with-python Coverage Status Code style: black Checked with flake8 License PyPI version shields.io PyPI pyversions PyPi downloads Downloads EO principles respected here

flake8-debug

A simple flake8 plugin that forbids the usage of print, breakpoint and pdb.set_trace functions in production code.

Tools

Production

Development

Installation

PYPI

pip install flake8-debug
✨ 🍰 

Source code

git clone git@github.com:vyahello/flake8-debug.git
cd flake8-debug
python3 -m venv venv 
. venv/bin/activate
pip install -e .

Errors

Codes

  • DB100 - print function is detected.
  • DB200 - breakpoint function is detected.
  • DB201 - breakpointhook function is detected.
  • DB300 - set_trace function is detected.

Sample

# foo.py
import pdb
from pdb import set_trace
from sys import breakpointhook


def bar(*a):
    print(a)
    breakpoint()
    breakpointhook()
    set_trace()
    pdb.set_trace()
flake8 foo.py

foo.py:7:5: DB100 print() function usage is detected
foo.py:8:5: DB200 breakpoint() function usage is detected
foo.py:9:5: DB201 breakpointhook() function usage is detected
foo.py:10:5: DB300 set_trace() function usage is detected
foo.py:11:5: DB300 set_trace() function usage is detected

⬆ back to top

Development notes

Testing

Please run the following script to start plugin tests:

pytest 

CI

To be able to run code analysis, please execute command below:

./analyse-source-code.sh

Meta

Author – Vladimir Yahello.

Distributed under the MIT license. See license for more information.

You can reach out me at:

Contributing

I would highly appreciate any contribution and support. If you are interested to add your ideas into project please follow next simple steps:

  1. Clone the repository
  2. Configure git for the first time after cloning with your name and email
  3. pip install -r requirements.txt to install all project dependencies
  4. pip install -r requirements-dev.txt to install all development project dependencies
  5. Create your feature branch (git checkout -b feature/fooBar)
  6. Commit your changes (git commit -am 'Add some fooBar')
  7. Push to the branch (git push origin feature/fooBar)
  8. Create a new Pull Request

What's next

All recent activities and ideas are described at project issues page. If you have ideas you want to change/implement please do not hesitate and create an issue.

⬆ back to top

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flake8_debug-0.3.0.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

flake8_debug-0.3.0-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file flake8_debug-0.3.0.tar.gz.

File metadata

  • Download URL: flake8_debug-0.3.0.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for flake8_debug-0.3.0.tar.gz
Algorithm Hash digest
SHA256 9c0be5325d3a5d7ba47ab71c447ea898d47397bd8cf532dda4e8f7c9e1d86b02
MD5 ef23a1f685db24c8ed50b7e30bf3e385
BLAKE2b-256 ee13ceaf235fca8d14c67ef925220efc80f6ee85e51264ecc51b668e740953da

See more details on using hashes here.

File details

Details for the file flake8_debug-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: flake8_debug-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 5.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for flake8_debug-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8a909623a5f619dbd333d5c9859a4af0eb7b82a6047225d605993569f9769a45
MD5 4d1f99a540023199804815f3d3300624
BLAKE2b-256 7c04b3492aea14cc33750456ca5d550a6986968e823a623277c66d42e4149fae

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page