eradicate


Nameeradicate JSON
Version 2.3.0 PyPI version JSON
download
home_pagehttps://github.com/myint/eradicate
SummaryRemoves commented-out code.
upload_time2023-06-09 06:31:41
maintainerNikita Sobolev <mail@sobolevn.me>
docs_urlNone
authorSteven Myint
requires_python
licenseExpat License
keywords clean format commented-out code
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            =========
eradicate
=========

.. image:: https://github.com/myint/eradicate/actions/workflows/test.yml/badge.svg
    :target: https://github.com/myint/eradicate/actions/workflows/test.yml
    :alt: Build status

----

``eradicate`` removes commented-out code from Python files.


Introduction
============

With modern revision control available, there is no reason to save
commented-out code to your repository. ``eradicate`` helps cleans up
existing junk comments. It does this by detecting block comments that
contain valid Python syntax that are likely to be commented out code.
(It avoids false positives like the sentence ``this is not good``,
which is valid Python syntax, but is probably not code.)


Example
=======

.. code-block:: bash

    $ eradicate --in-place example.py

Before running ``eradicate``.

.. code-block:: python

    #import os
    # from foo import junk
    #a = 3
    a = 4
    #foo(1, 2, 3)

    def foo(x, y, z):
        # print('hello')
        print(x, y, z)

        # This is a real comment.
        #return True
        return False

After running ``eradicate``.

.. code-block:: python

    a = 4

    def foo(x, y, z):
        print(x, y, z)

        # This is a real comment.
        return False


Whitelisting
============

False positives can happen so there is a whitelist feature to fix them shorthand.
You can either add entries to the default whitelist with ``--whitelist-extend`` or overwrite the default with ``--whitelist``.
Both arguments expect a string of ``#`` separated regex strings (whitespaces are preserved). E.g. ``eradicate --whitelist "foo#b a r" filename``
Those regex strings are matched case insensitive against the start of the comment itself.

For the default whitelist please see ``eradicate.py``.


Related
=======

There are different tools, plugins, and integrations for ``eradicate`` users:

- `flake8-eradicate <https://github.com/sobolevn/flake8-eradicate>`_ - Flake8 plugin to find commented out or dead code.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/myint/eradicate",
    "name": "eradicate",
    "maintainer": "Nikita Sobolev <mail@sobolevn.me>",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "clean,format,commented-out code",
    "author": "Steven Myint",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/7a/e1/665186aedea2d6ebf0415cf97c0629c8123a721e7afc417deeade5598215/eradicate-2.3.0.tar.gz",
    "platform": null,
    "description": "=========\neradicate\n=========\n\n.. image:: https://github.com/myint/eradicate/actions/workflows/test.yml/badge.svg\n    :target: https://github.com/myint/eradicate/actions/workflows/test.yml\n    :alt: Build status\n\n----\n\n``eradicate`` removes commented-out code from Python files.\n\n\nIntroduction\n============\n\nWith modern revision control available, there is no reason to save\ncommented-out code to your repository. ``eradicate`` helps cleans up\nexisting junk comments. It does this by detecting block comments that\ncontain valid Python syntax that are likely to be commented out code.\n(It avoids false positives like the sentence ``this is not good``,\nwhich is valid Python syntax, but is probably not code.)\n\n\nExample\n=======\n\n.. code-block:: bash\n\n    $ eradicate --in-place example.py\n\nBefore running ``eradicate``.\n\n.. code-block:: python\n\n    #import os\n    # from foo import junk\n    #a = 3\n    a = 4\n    #foo(1, 2, 3)\n\n    def foo(x, y, z):\n        # print('hello')\n        print(x, y, z)\n\n        # This is a real comment.\n        #return True\n        return False\n\nAfter running ``eradicate``.\n\n.. code-block:: python\n\n    a = 4\n\n    def foo(x, y, z):\n        print(x, y, z)\n\n        # This is a real comment.\n        return False\n\n\nWhitelisting\n============\n\nFalse positives can happen so there is a whitelist feature to fix them shorthand.\nYou can either add entries to the default whitelist with ``--whitelist-extend`` or overwrite the default with ``--whitelist``.\nBoth arguments expect a string of ``#`` separated regex strings (whitespaces are preserved). E.g. ``eradicate --whitelist \"foo#b a r\" filename``\nThose regex strings are matched case insensitive against the start of the comment itself.\n\nFor the default whitelist please see ``eradicate.py``.\n\n\nRelated\n=======\n\nThere are different tools, plugins, and integrations for ``eradicate`` users:\n\n- `flake8-eradicate <https://github.com/sobolevn/flake8-eradicate>`_ - Flake8 plugin to find commented out or dead code.\n",
    "bugtrack_url": null,
    "license": "Expat License",
    "summary": "Removes commented-out code.",
    "version": "2.3.0",
    "project_urls": {
        "Homepage": "https://github.com/myint/eradicate"
    },
    "split_keywords": [
        "clean",
        "format",
        "commented-out code"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "90c2533e1338429aeba1f089566a2314d69d3e78ab57a73006f16a923bf2b24c",
                "md5": "7658cbd17015e3c7fed0b9906c339dd2",
                "sha256": "2b29b3dd27171f209e4ddd8204b70c02f0682ae95eecb353f10e8d72b149c63e"
            },
            "downloads": -1,
            "filename": "eradicate-2.3.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7658cbd17015e3c7fed0b9906c339dd2",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 6113,
            "upload_time": "2023-06-09T06:31:40",
            "upload_time_iso_8601": "2023-06-09T06:31:40.209170Z",
            "url": "https://files.pythonhosted.org/packages/90/c2/533e1338429aeba1f089566a2314d69d3e78ab57a73006f16a923bf2b24c/eradicate-2.3.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7ae1665186aedea2d6ebf0415cf97c0629c8123a721e7afc417deeade5598215",
                "md5": "a66b08ef034cac011866debb84ba1a60",
                "sha256": "06df115be3b87d0fc1c483db22a2ebb12bcf40585722810d809cc770f5031c37"
            },
            "downloads": -1,
            "filename": "eradicate-2.3.0.tar.gz",
            "has_sig": false,
            "md5_digest": "a66b08ef034cac011866debb84ba1a60",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 8536,
            "upload_time": "2023-06-09T06:31:41",
            "upload_time_iso_8601": "2023-06-09T06:31:41.814889Z",
            "url": "https://files.pythonhosted.org/packages/7a/e1/665186aedea2d6ebf0415cf97c0629c8123a721e7afc417deeade5598215/eradicate-2.3.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-06-09 06:31:41",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "myint",
    "github_project": "eradicate",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "eradicate"
}
        
Elapsed time: 0.10552s