Flake8 plugin to find commented out code
Project description
flake8-eradicate
flake8
plugin to find commented out (or so called "dead") code.
This is quite important for the project in a long run.
Based on eradicate
project.
Installation
pip install flake8-eradicate
It is also a valuable part of wemake-python-styleguide
.
Usage
Run your flake8
checker as usual.
Commented code should raise an error.
Example:
flake8 your_module.py
Options
--eradicate-aggressive
to enable aggressive mode fromeradicate
, can lead to false positives
Error codes
Error code | Description |
---|---|
E800 | Found commented out code |
Output example
Without aggressive mode
» flake8 tests/fixtures/incorrect.py
tests/fixtures/incorrect.py:1:1: E800: Found commented out code:
--- before/tests/fixtures/incorrect.py
+++ after/tests/fixtures/incorrect.py
@@ -1,23 +1,16 @@
class Some(object):
- # property_name = 1
- # typed_property: int = 10
other_property = 2
# def function_name():
-# return None
# class CommentedClass(object):
# def __init__(self, prop: int) -> None:
-# self.property = prop
# def __str__(self) -> str:
-# return self.__class__.__name__
# def set_prop(self, prop: int):
-# self.prop = prop
# def get_prop(self):
-# return self.prop
With aggresive mode
» flake8 --eradicate-aggressive tests/fixtures/incorrect.py
tests/fixtures/incorrect.py:1:1: E800: Found commented out code:
--- before/tests/fixtures/incorrect.py
+++ after/tests/fixtures/incorrect.py
@@ -1,23 +1,10 @@
class Some(object):
- # property_name = 1
- # typed_property: int = 10
other_property = 2
-# def function_name():
-# return None
-# class CommentedClass(object):
-# def __init__(self, prop: int) -> None:
-# self.property = prop
-# def __str__(self) -> str:
-# return self.__class__.__name__
-# def set_prop(self, prop: int):
-# self.prop = prop
-# def get_prop(self):
-# return self.prop
License
MIT.
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
flake8-eradicate-0.2.1.tar.gz
(4.6 kB
view hashes)
Built Distribution
Close
Hashes for flake8_eradicate-0.2.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 86804c682f9805a689379307939f350140fe9c015c3e600baff37fb23f7f21cc |
|
MD5 | 54d0b97912296635e55883fbf49e5426 |
|
BLAKE2b-256 | a311ced508b31a854afc9c80e9694c0910b97a0ac417a34231cff5aca6e6f57b |