Metastatic.Analysis.SimplifyConditional
(Metastatic v0.10.4)
View Source
Suggests simplification of redundant conditionals.
Detects conditionals that return boolean literals and can be simplified to direct boolean expressions.
Patterns Detected
if condition then true else false→conditionif condition then false else true→not conditionif condition then condition else false→conditionif condition then true else condition→condition
Examples
# Before
if x > 5 then true else false
# After
x > 5
# Before
if is_valid then false else true
# After
not is_valid