Skip to content

no-value-for-parameter false positive for variadic function passed as argument #5416

@perrinjerome

Description

@perrinjerome

Bug description

With the above code, no-value-for-parameter is emitted for func_KO, although nothing is emitted for func_OK, therefore I believe it's a false positive.

def func(one, two):
    """A function with two arguments"""
    return one, two


def func_OK(*args):
    """Variadic arguments passed to `func`, assumed to be OK"""
    return func(*args)


def func_KO(*args):
    """When `func` is used as a function argument, False positive is emited"""
    print(func(*args))

I was able to fix locally, even though I'm not sure to understand fully why, I'll try to send a pull request

Configuration

No response

Command used

pylint --disable=all --enable=no-value-for-parameter repro.py

Pylint output

************* Module repro
repro.py:13:10: E1120: No value for argument 'one' in function call (no-value-for-parameter)
repro.py:13:10: E1120: No value for argument 'two' in function call (no-value-for-parameter)

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

Expected behavior

No false positive should be emitted in func_KO, just like for func_OK.

Pylint version

pylint 2.12.2-dev0
astroid 2.9.0
Python 3.7.7 (default, Oct 13 2021, 05:29:46) 
[GCC 8.5.0]

OS / Environment

No response

Additional dependencies

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bug 🪲False Positive 🦟A message is emitted but nothing is wrong with the code

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions