https://github.com/vyahello/flake8-debug
🛑 flake8 plugin that forbids debug funcs in prod codebase (flake8, ast)
https://github.com/vyahello/flake8-debug
disable-print flake8-plugin
Last synced: 5 months ago
JSON representation
🛑 flake8 plugin that forbids debug funcs in prod codebase (flake8, ast)
- Host: GitHub
- URL: https://github.com/vyahello/flake8-debug
- Owner: vyahello
- License: mit
- Created: 2022-03-04T15:24:12.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2024-04-23T13:38:13.000Z (almost 2 years ago)
- Last Synced: 2025-09-25T13:27:46.759Z (6 months ago)
- Topics: disable-print, flake8-plugin
- Language: Python
- Homepage: https://pypi.org/project/flake8-debug
- Size: 183 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README

[](https://www.python.org/)
[](https://coveralls.io/github/vyahello/flake8-debug?branch=master)
[](https://github.com/psf/black)
[](http://flake8.pycqa.org/)
[](LICENSE.md)
[](https://pypi.python.org/pypi/flake8-debug/)
[](https://pypi.python.org/pypi/flake8-debug)
[](https://pypi.python.org/pypi/flake8-debug)
[](https://pepy.tech/project/flake8-debug)
[](https://www.elegantobjects.org)
# flake8-debug
> A simple flake8 plugin that forbids the usage of `print`, `breakpoint` and `pdb.set_trace` functions in production code.
## Tools
### Production
- python 3.7+
- [flake8](http://flake8.pycqa.org/en/latest/)
### Development
- [black](https://black.readthedocs.io/en/stable/)
- [flake8](http://flake8.pycqa.org/en/latest/)
- [pytest](https://docs.pytest.org/en/7.0.x/)
## Installation
### PYPI
```bash
pip install flake8-debug
✨ 🍰 ✨
```
### Source code
```bash
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
```python
# 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()
```
```bash
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](#flake8-debug)**
## Development notes
### Testing
Please run the following script to start plugin tests:
```bash
pytest
```
### CI
To be able to run code analysis, please execute command below:
```bash
./analyse-source-code.sh
```
### Meta
Author – _Vladimir Yahello_.
Distributed under the `MIT` license. See [license](LICENSE.md) for more information.
You can reach out me at:
* [vyahello@gmail.com](vyahello@gmail.com)
* [https://twitter.com/vyahello](https://twitter.com/vyahello)
* [https://www.linkedin.com/in/volodymyr-yahello-821746127](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:
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](https://github.com/vyahello/flake8-debug/issues) page.
If you have ideas you want to change/implement please do not hesitate and create an issue.
**[⬆ back to top](#flake8-debug)**