Pylint: False positive: bad-whitespace (No space allowed around keyword argument assignment) for non-trivial cases

Created on 10 Jan 2018  路  1Comment  路  Source: PyCQA/pylint

Steps to reproduce

  1. have argument with initial value and non-trivial annotation with newline within the annotation (as in example below) which is 100% correctly styled code

Example

"""What do you want from me, Pylint?"""

import pathlib
from typing import Tuple


def take_path(arg: pathlib.Path = None):
    print(arg)


def take_str(arg: str = None):
    print(arg)


def take_tuple(arg: Tuple[int, str] = None):
    print(arg)


def take_tuple_newline(arg: Tuple[
        int, str] = None):
    print(arg)
  1. run pylint

Current behavior

pylint complains about spaces around keyword argument assignment

C: 20, 0: No space allowed around keyword argument assignment
        int, str] = None):
                  ^ (bad-whitespace)

There have been many previous isssues about similar problems, e.g. #1429 #1525 #1543

Looks like PR #1430 for 1.8 (backported to 1.7 in #1679) didn't resolve the whitespace issue completely.

Expected behavior

pylint doesn't complain about spaces around keyword argument assignment

pylint --version output

Using config file /home/mateusz/.pylintrc
pylint 1.8.1, 
astroid 1.6.0
Python 3.6.1 (default, May 26 2017, 19:35:58) 
[GCC 5.4.0 20160609]
bug

Most helpful comment

Thanks for the report! I can repro this and am working on it

>All comments

Thanks for the report! I can repro this and am working on it

Was this page helpful?
0 / 5 - 0 ratings

Related issues

glmdgrielson picture glmdgrielson  路  3Comments

vinay-deshmukh picture vinay-deshmukh  路  3Comments

elirnm picture elirnm  路  3Comments

GergelyKalmar picture GergelyKalmar  路  3Comments

lancelote picture lancelote  路  3Comments