Pylint: False-positive C0330?

Created on 7 Jun 2018  路  8Comments  路  Source: PyCQA/pylint

Steps to reproduce

  1. Create file multiline.py with the same contents that I put under those steps
  2. pylint multiline.py --disable=C0111 # to suppress "Missing module docstring"

multiline.py

#!/usr/bin/env python3


if __name__ == '__main__':
    MULTILINE = '''\
This is a multiline with two arguments:
{first}
{second}'''.format(
        first='The quick brown fox jumps over the lazy dog so quickly',
        second='Pi is exactly three!')
    print(MULTILINE)

Current behavior

No config file found, using default configuration
************* Module multiline
C:  9, 0: Wrong hanging indentation (remove 4 spaces).
        first='The quick brown fox jumps over the lazy dog so quickly',
    |   ^ (bad-continuation)
C: 10, 0: Wrong hanging indentation (remove 4 spaces).
        second='Pi is exactly three!')
    |   ^ (bad-continuation)

------------------------------------------------------------------

Expected behavior

No error. If i remove those 4 spaces, I'll get this:

if __name__ == '__main__':
    MULTILINE = '''\
This is a multiline with two arguments:
{first}
{second}'''.format(
    first='The quick brown fox jumps over the lazy dog so quickly',
    second='Pi is exactly three!')
    print(MULTILINE)

kwargs for format have the same indent as print do, whis is confusing. Also, pycodestyle starts complaining:

$ pycodestyle-3 multiline.py
multiline.py:9:5: E122 continuation line missing indentation or outdented
multiline.py:10:5: E122 continuation line missing indentation or outdented

But for pylint second version is better:

$ pylint multiline.py --disable=C0111
No config file found, using default configuration

-------------------------------------------------------------------
Your code has been rated at 10.00/10 (previous run: 3.33/10, +6.67)

pylint --version output

$ pylint --version
No config file found, using default configuration
pylint 1.7.5,
astroid 1.5.2
Python 3.6.5 (default, Mar 29 2018, 18:20:46)
[GCC 8.0.1 20180317 (Red Hat 8.0.1-0.19)]

Most helpful comment

Because I don't have time to fix 300 gazillions of issues. This is a volunteer run project, if you want an issue fixed, the best way to move it forward is to submit a PR rather than asking the maintainer if they'll fix this issue. It's irrelevant how old the issue is as long as nobody got time to fix it yet.

All 8 comments

reproduced also with pylint 1.9.2

I'm hit by this problem too: the Black formater as a tendency of producing this code on my projects, which makes pylint scream.

For information, the relevant Black issue was closed as being a Pylint bug: https://github.com/ambv/black/issues/48

Oh, I think this is probably a duplicate for #741

Yes, this looks like a duplicate of #741. Thanks for the report though!

Hmm, this bug is from 2015. Are you planning to fix it?

No.

Why so? And why the original issue is still open then?

Because I don't have time to fix 300 gazillions of issues. This is a volunteer run project, if you want an issue fixed, the best way to move it forward is to submit a PR rather than asking the maintainer if they'll fix this issue. It's irrelevant how old the issue is as long as nobody got time to fix it yet.

Was this page helpful?
0 / 5 - 0 ratings