Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
The-Compiler opened this issue Jul 16, 2018 · 3 comments
Closed

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

The-Compiler opened this issue Jul 16, 2018 · 3 comments

Comments

@The-Compiler
Copy link
Contributor

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.

The-Compiler added a commit to qutebrowser/qutebrowser that referenced this issue Jul 16, 2018
@PCManticore
Copy link
Contributor

Confirming that I can reproduce this as well. Also given the adoption of black as a standard formatting tool in Python, I wonder if it makes sense to still suggest a further indentation for telling apart the body of the with from its arguments, given that black does not do that.

@fxfitz
Copy link

fxfitz commented Jan 8, 2020

I'm seeing this as well with 2.4.4 (but not 1.9.5).

@Pierre-Sassoulas
Copy link
Member

bad-continuation has been removed in #3571, black or another formatter can help you with this better than Pylint

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants