Skip to main content

Flake8 plugin to find commented out code

Project description

flake8-eradicate

wemake.services Build Status Coverage Python Version PyPI version wemake-python-styleguide

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 from eradicate, 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


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 details)

Uploaded Source

Built Distribution

flake8_eradicate-0.2.1-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file flake8-eradicate-0.2.1.tar.gz.

File metadata

  • Download URL: flake8-eradicate-0.2.1.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/0.12.11 CPython/3.6.6 Darwin/18.6.0

File hashes

Hashes for flake8-eradicate-0.2.1.tar.gz
Algorithm Hash digest
SHA256 cc2c3300a6643f8347988cc828478c347975f7bf9c8fc1f8a7027da41ab9bdbd
MD5 d0100d7f12388845eb63ead6e727bef9
BLAKE2b-256 d5530da511d62e49afd8a5a8d2c2ce6172a6ed5ed45d459e75140258cd8b2346

See more details on using hashes here.

File details

Details for the file flake8_eradicate-0.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for flake8_eradicate-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 86804c682f9805a689379307939f350140fe9c015c3e600baff37fb23f7f21cc
MD5 54d0b97912296635e55883fbf49e5426
BLAKE2b-256 a311ced508b31a854afc9c80e9694c0910b97a0ac417a34231cff5aca6e6f57b

See more details on using hashes here.

Supported by

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