Remove Redundant Condition
Documentation Index
Fetch the complete documentation index at: https://docs.sourcery.ai/llms.txt
Use this file to discover all available pages before exploring further.
Sourcery refactoring id: remove-redundant-condition
Section titled “Sourcery refactoring id: remove-redundant-condition”Description:
Section titled “Description:”Remove a redundant condition used during variable assignment
Before:
Section titled “Before:”x = y if z else yAfter:
Section titled “After:”x = yExplanation:
Section titled “Explanation:”Code may contain redundant statements where a condition is unnecessarily evaluated, and the result will be the same either way. This refactoring detects such redundancy and removes it.