Skip to content

bad-continuation doesn't consider multiple with-statements #2301

Closed
@The-Compiler

Description

@The-Compiler

With this block:

            with log.ignore_py_warnings(
                category=DeprecationWarning,  # error
                message=r'({})'.format('|'.join(messages))  # error
            ), log.ignore_py_warnings(
                category=PendingDeprecationWarning,
                module='imp'
            ), log.ignore_py_warnings(
                category=ImportWarning,
                message=r'Not importing directory .*: missing __init__'
            ):
                importlib.import_module(name)

pylint wants me to further indent the first lines (marked with # error), presumably to tell them apart from the body of the with:.

However, it does not want me to further indent the other two blocks, which seems inconsistent.

This appeared with pylint/astroid 2.0, it seems in earlier versions it didn't want to further indent things at all.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions