Skip to content

Commit

Permalink
Doc: Add reasoning for replace vs strip in variable_redefinition
Browse files Browse the repository at this point in the history
  • Loading branch information
NiklasHargarter authored and mbrinkhoff committed Jun 11, 2024
1 parent 616b38f commit b9dc369
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions troubadix/plugins/variable_redefinition_in_foreach.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ def check_content(

for foreach_match in FOREACH_PATTERN.finditer(file_content):
identifier = foreach_match.group("ident")

# replace instead of strip, because the iterator can contain
# whitespace as part of the expression.
# Saving from further strip calls
# make_list( bar , foo )
iterator = foreach_match.group("iter").replace(" ", "")

if make_list_match := MAKE_LIST_PATTERN.fullmatch(iterator):
Expand Down

0 comments on commit b9dc369

Please sign in to comment.