Why this matters
If a function always returns the same value regardless of input, it may indicate poor design or a logic error.
Identify functions that return the same value regardless of input. This may indicate poor design or a logic error.
If a function always returns the same value regardless of input, it may indicate poor design or a logic error.
Side-by-side examples engineers can pattern-match during review.
def foo(a): # NonCompliant
b = 12
if a == 1:
return b
return b// (no example provided)def foo(a): # NonCompliant
b = 12
if a == 1:
return b
return bFrom the same buckets as this rule.