Pylint: False positive no-value-for-parameter in metaclass

Created on 21 Nov 2019  路  3Comments  路  Source: PyCQA/pylint

Steps to reproduce

given dang.py

# pylint: disable=missing-module-docstring,blacklisted-name,invalid-name,missing-function-docstring,missing-class-docstring

class MetaDang(type):

    @staticmethod
    def foo(fn, string):
        fn(string)

    def bar(cls, string):
        cls.foo(print, string)

    def baz(cls):
        cls.bar('woo')

class Dang(metaclass=MetaDang):
    pass

Dang.baz()

Current behavior

py -3.7 -m pylint dang.py
************* Module dang
dang.py:13:8: E1120: No value for argument 'string' in unbound method call (no-value-for-parameter)

------------------------------------------------------------------
Your code has been rated at 5.00/10

Expected behavior

py -3.7 -m pylint dang.py

-------------------------------------------------------------------
Your code has been rated at 10.00/10

pylint --version output

pylint 2.4.0
astroid 2.3.3
Python 3.7.4 (tags/v3.7.4:e09359112e, Jul 8 2019, 20:34:20) [MSC v.1916 64 bit (AMD64)]

astroid bug

Most helpful comment

Same issue here (I know I shouldn't comment, but I feel it won't get attention if they don't notice it).

All 3 comments

Thanks, I agree we should fix this.

Hi, it this issue, isn't it?

from abc import ABCMeta
class Foo(ABCMeta):
    def __getattr__(cls, bar):
        return cls(bar)

class Bar(metaclass=Foo):
    def __init__(self, foo):
        self.foo = foo

No value for argument 'bases' in constructor call
No value for argument 'namespace' in constructor call
If "ABCMeta" is replaced by "type"
messages do not appear

Same issue here (I know I shouldn't comment, but I feel it won't get attention if they don't notice it).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

PCManticore picture PCManticore  路  3Comments

sambarluc picture sambarluc  路  3Comments

jrial picture jrial  路  3Comments

pylint-bot picture pylint-bot  路  3Comments

lancelote picture lancelote  路  3Comments