Skip to content

Commit

Permalink
update based on review
Browse files Browse the repository at this point in the history
  • Loading branch information
clavedeluna committed Mar 5, 2024
1 parent 28ce50a commit ac0555f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/codemodder/codemods/base_visitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ def __init__(
def filter_by_result(self, node):
pos_to_match = self.node_position(node)
if self.results is None:
# Some codemods must run without results existing.
# Returning True here means codemods without detectors (and results)
# will still run their transformations.
return True
return any(result.match_location(pos_to_match, node) for result in self.results)

Expand Down
5 changes: 2 additions & 3 deletions src/core_codemods/sonar/sonar_jwt_decode_verify.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,12 @@ def filter_by_result(self, node) -> bool:
results returned have a start/end column for the verify keyword
within the `decode` call, not for the entire call like semgrep returns.
"""
if self.results is None:
return False
match node:
case cst.Call():
pos_to_match = self.node_position(node)
return any(
self.match_location(pos_to_match, result) for result in self.results
self.match_location(pos_to_match, result)
for result in self.results or []
)
return False

Expand Down

0 comments on commit ac0555f

Please sign in to comment.