Skip to content

Files

Latest commit

 

History

History
22 lines (15 loc) · 439 Bytes

using-constant-test.md

File metadata and controls

22 lines (15 loc) · 439 Bytes

Pattern: Use of constant in conditional statement

Issue: -

Description

Emitted when a conditional statement uses a constant value for its test. This might not be what the user intended to do. Review such code to resolve this issue.

Example of incorrect code:

if 2.0: # [using-constant-test]
    print "found 2.0"

Example of correct code:

number = 1.0

if (number == 2.0):
    print "found 2.0"