Parse in-line if statements
@liamhuber is already working on this.
Since Feb 18, 2026.
- Dominant language
- Python
- Stars
- 3
- Forks
- 0
- Avg merge
- 1h 19m
- Merged PRs (30d)
- 5
Description
When we encounter a typical if-...-else statement, we find anast.If:
def simple_if_else(x, y):
if my_cond(x, y): # noqa: SIM108
z = my_add(x, y)
else:
z = my_mul(x, y)
return z
It would be nice to extend WorkflowParser.handle_assignment to also handle ast.IfExp so we can parse an else-node out of the equivalent python:
def simple_if_else(x, y):
z = my_add(x, y) if my_cond(x, y) else my_mul(x, y)
return z
I think such an extension should be quite straightforward. My current understanding is that if we have an assignment available (z above) then it's always possible to reformulate the weaker ast.IfExp back into the more powerful ast.If.
I want to focus on getting the core functionality up for all the control flow parsers before adding sugar to a given flow, so this can wait.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.