A Flake8 plugin that helps detect the usage of the ic() function from the icecream package in your codebase.
If you think this plugin is useful, please consider giving it a star by clicking on the badge! ⭐
The flake8-ic plugin ensures clean and production-ready code by identifying any instances of the ic() function, commonly used for debugging. This tool integrates seamlessly with flake8 to provide automated checks.
The flake8-ic plugin checks for the usage of the ic() function and related methods from the icecream package in your codebase. Below is a list of errors it detects:
| Error Code | Description |
|---|---|
IC100 | Avoid using ic() from the icecream package in production code. |
IC101 | Avoid using ic.disabled() from the icecream package in production code. |
IC102 | Avoid using ic.enabled() from the icecream package in production code. |
You can disable specific checks for flake8-ic using the --disable-ic-checks option. This is useful if you only want to enforce certain rules. The following options are available:
IC100: Disables checks for theic()function.IC101: Disables checks for theic.disabled()method.IC102: Disables checks for theic.enabled()method.
-
Disable a Single Check:
flake8 --disable-ic-checks=IC100
This will disable only the
IC100check. -
Disable Multiple Checks:
flake8 --disable-ic-checks=IC100,IC101
This will disable both the
IC100andIC101checks. -
Configuration in setup.cfg or tox.ini: You can set this option in your configuration file to apply it automatically:
[flake8] disable-ic-checks = IC100,IC102
-
Configuration in pyproject.toml: Add the configuration under the [tool.flake8] section:
[tool.flake8] disable-ic-checks = "IC100,IC102"
By disabling checks, you can tailor the plugin to match your project’s requirements while maintaining a clean and focused codebase.
Install the plugin via pip:
pip install flake8-icTo confirm the plugin is installed, run:
flake8 --versionYou should see flake8-ic listed among the installed plugins, along with the Flake8 version.
A big thank you to everyone who contributed to this project! 💖
(c) 2025, Created with ❤️ by Marco Espinosa