Flake8 plugin to forbid debug function usage
Project description
flake8-debug
A simple flake8 plugin that forbids the usage of
breakpoint
andpdb.set_trace
functions in production code.
Tools
Production
- python 3.7+
- flake8
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
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:
- vyahello@gmail.com
- https://twitter.com/vyahello
- https://www.linkedin.com/in/volodymyr-yahello-821746127
Contributing
I would highly appreciate any contribution and support. If you are interested to add your ideas into project please follow next simple steps:
- Clone the repository
- Configure
git
for the first time after cloning with yourname
andemail
pip install -r requirements.txt
to install all project dependenciespip install -r requirements-dev.txt
to install all development project dependencies- Create your feature branch (git checkout -b feature/fooBar)
- Commit your changes (git commit -am 'Add some fooBar')
- Push to the branch (git push origin feature/fooBar)
- 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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file flake8-debug-0.2.0.tar.gz
.
File metadata
- Download URL: flake8-debug-0.2.0.tar.gz
- Upload date:
- Size: 5.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6b5f61f983d8e1c079661b95c36cdf50369878b322a0fbbe8ce9bb6e288fa848 |
|
MD5 | 31e5965320e6b391cbdf035124d15861 |
|
BLAKE2b-256 | 7082b5d355b806c56ac41f1c38e00d01041ed2319acb791212624950f8b6b4f5 |
File details
Details for the file flake8_debug-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: flake8_debug-0.2.0-py3-none-any.whl
- Upload date:
- Size: 5.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f4d2f7c4804c93a4a67919a0cf26f66df950d4b40fd9121b9916f86852b02d2e |
|
MD5 | f68312a19a977acea2ce98ed0205f984 |
|
BLAKE2b-256 | de37faeaa69dfbe2b95927d99c1ef44e5ffbca49f8c2edb9c619f6c78cb041a8 |