Skip to content

Useless logical and bitwise operations #3593

@j2cry

Description

@j2cry

Meaningless number operations are prohibited by WPS345.
But meaningless logical operations are not handled

# not noticed
myvar = True or False
myvar = True and False
myvar = call() and False
myvar = call() and not True
myvar = call() or False

This may also be relevant for some bitwise operations

# noticed by WPS345
myvar = 1 | False
myvar = 1 | 0
myvar = 1 & 0

# not noticed
myvar = 1 & True
myvar = 1 | True
myvar = 5 | 5
myvar = 452 & 452

Should we deal with this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions