flake8-eradicate icon indicating copy to clipboard operation
flake8-eradicate copied to clipboard

False Positives | Markdown in block strings

Open RayOconnor opened this issue 3 years ago • 5 comments

Hello the following code is now getting flagged as E800 Found commented out code This has only just started getting flagged with the upgrade from 1.0.0 -> 1.1.0

Example code:

MARKDOWN = """
# {variable_containing_header_one}
Lots of content here...
"""

RayOconnor avatar Jun 28 '21 14:06 RayOconnor

@RayOconnor please, feel free to submit a fix!

sobolevn avatar Jun 28 '21 17:06 sobolevn

I was just about to submit a similar false-positive but with docstrings (that is essentially the same I suppose). In my case, it's not Markdown but an example TOML config as a part of the docstring: https://github.com/ansible/pylibssh/blob/devel/bin/pep517_backend/_backend.py#L79.

def get_config():
    """Grab optional build dependencies from pyproject.toml config.
    :returns: config section from ``pyproject.toml``
    :rtype: dict
    This basically reads entries from::
        [tool.local.cythonize]
        # Env vars provisioned during cythonize call
        src = ["src/**/*.pyx"]
        [tool.local.cythonize.env]
        # Env vars provisioned during cythonize call
        LDFLAGS = "-lssh"
        [tool.local.cythonize.flags]
        # This section can contain the following booleans:
        # * annotate — generate annotated HTML page for source files
        # * build — build extension modules using distutils
        # * inplace — build extension modules in place using distutils (implies -b)
        # * force — force recompilation
        # * quiet — be less verbose during compilation
        # * lenient — increase Python compat by ignoring some compile time errors
        # * keep-going — compile as much as possible, ignore compilation failures
        annotate = false
        build = false
        inplace = true
        force = true
        quiet = false
        lenient = false
        keep-going = false
        [tool.local.cythonize.kwargs]
        # This section can contain args tha have values:
        # * exclude=PATTERN      exclude certain file patterns from the compilation
        # * parallel=N    run builds in N parallel jobs (default: calculated per system)
        exclude = "**.py"
        parallel = 12
        [tool.local.cythonize.kwargs.directives]
        # This section can contain compiler directives
        # NAME = "VALUE"

    """

# NAME = "VALUE" is what eradicate complains about but shouldn't.

webknjaz avatar Oct 20 '21 19:10 webknjaz

Does this happen with raw eradicate? Or is it specific to flake8-eradicate?

sobolevn avatar Oct 20 '21 20:10 sobolevn

No idea, I haven't had a chance to check but wanted to comment here so that it's not totally forgotten.

webknjaz avatar Oct 20 '21 22:10 webknjaz

Sorry, I cannot reproduce.

Both eradicate and flake8-eradicate are fine with both examples. Снимок экрана 2021-10-21 в 10 56 18

sobolevn avatar Oct 21 '21 07:10 sobolevn