Skip to content

Commit

Permalink
Hardening suggestions for codemodder-python / sqlp-fix (#280)
Browse files Browse the repository at this point in the history
Use Assignment Expression (Walrus) In Conditional

Co-authored-by: pixeebot[bot] <[email protected]>
  • Loading branch information
pixeebot[bot] and pixeebot authored Feb 19, 2024
1 parent fe90431 commit 5b5a66f
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/core_codemods/sql_parameterization.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,8 +340,7 @@ def visit_Attribute(self, node: cst.Attribute) -> Optional[bool]:

def recurse_Name(self, node: cst.Name) -> list[cst.CSTNode]:
# if the expression is a name, try to find its single assignment
resolved = self.resolve_expression(node)
if resolved != node:
if (resolved := self.resolve_expression(node)) != node:
visitor = LinearizeQuery(self.context)
resolved.visit(visitor)
if len(visitor.leaves) == 1:
Expand Down

0 comments on commit 5b5a66f

Please sign in to comment.