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 false alarm and failure to disable #2304

Closed
kayhayen opened this issue Jul 16, 2018 · 6 comments
Closed

bad-continuation false alarm and failure to disable #2304

kayhayen opened this issue Jul 16, 2018 · 6 comments
Assignees
Labels

Comments

@kayhayen
Copy link

Steps to reproduce

I have this code piece:

        emit(
            """\
SET_CURRENT_EXCEPTION( exception_preserved_type_%(preserver_id)d, \
exception_preserved_value_%(preserver_id)d, \
exception_preserved_tb_%(preserver_id)d );""" % {
                "preserver_id" : preserver_id,
            }
        )

I think it wants the hanging "}" brace to align one level shorter, which is false.

With that false alarm in place, --disable=bad-continuation on the command line has no effect. I cannot disable the warning until the bug is fixed.

Current behavior

Reports:

nuitka\codegen\FrameCodes.py:446 C0330 bad-continuation Wrong hanging indentation.
}
| | ^

Expected behavior

No report, and allow --disable on that error.

pylint --version output

c/Python36_32/python -m pylint --version
main.py 2.0.0
astroid 2.0.0.dev4
Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 16:07:46) [MSC v.1900 32 bit (Intel)]

@PCManticore
Copy link
Contributor

Thanks for the report!

Yes, it seems that it wants the indentation to be one level shorter, which I agree does not make sense here.
Also confirming that we cannot disable bad-continuation here.

@PCManticore PCManticore added this to the Next bug fix release milestone Jul 17, 2018
@mthuurne
Copy link
Contributor

I also ran into the problem that bad-continuation sometimes cannot be suppressed. I'll add my test case here, as it's a bit shorter than the one from the original report.

In pylintrc:

[MESSAGES CONTROL]
disable=bad-continuation

[FORMAT]
indent-after-paren=9999

Code to check:

print(
    1,
    2,
    3
    )

An interesting effect is that the spaces set by indent-after-paren are printed as part of the error message (as spaces). I don't know if that's related to the bug, but it doesn't seem right.

@brycepg
Copy link
Contributor

brycepg commented Aug 4, 2018

@mthuurne I fixed failure to disable bad-continuation near the end of the file (after ast nodes end but not tokens) in pylint 2.1

@mthuurne
Copy link
Contributor

mthuurne commented Aug 4, 2018

Thanks!

@PCManticore PCManticore modified the milestones: Next bug fix release, Next minor release Aug 31, 2018
@PCManticore PCManticore removed this from the Next minor release milestone Sep 25, 2019
@Pierre-Sassoulas Pierre-Sassoulas self-assigned this May 2, 2020
@Pierre-Sassoulas
Copy link
Member

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

@kayhayen
Copy link
Author

kayhayen commented May 3, 2020

I agree @Pierre-Sassoulas

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

No branches or pull requests

5 participants