Skip to content

False positive for WPS529 #3501

@sobolevn

Description

@sobolevn

Code like this

def func(**kwargs):
    if 'a' in kwargs:
        assert 'a_kwargs' not in kwargs
    else:
        kwargs['a'] = other(
            **kwargs.pop('a_kwargs', {}),
        )

raises WPS529

I don't think that it is correct, because we can't replace it with .get.

    # Correct:
    value = collection.get(key)
    if value is not None:
        print(value)

    # Wrong:
    if key in collection:
        print(collection[key])

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions