From 05c238acc64ef678e1855bca17bd7da92e89cd38 Mon Sep 17 00:00:00 2001 From: "David A. Wheeler" Date: Sat, 12 Aug 2017 21:12:54 -0400 Subject: [PATCH] Modify find/split operations to work on Python 2 and 3 Python 3 only accepts certain syntaxes for find & split. Thankfully, it's possible to use them in Python 2, so rework it so we can use the same syntax for both. This is not detected or fixed by futurize, sadly (a problem true for many other situations). Signed-off-by: David A. Wheeler --- flawfinder | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/flawfinder b/flawfinder index e3b3d72..f068743 100755 --- a/flawfinder +++ b/flawfinder @@ -1602,8 +1602,8 @@ def expand_ruleset(ruleset): # Note that this "for" loop modifies the ruleset while it's iterating, # so we *must* convert the keys into a list before iterating. for rule in list(ruleset.keys()): - if string.find(rule, "|") != -1: # We found a rule to expand. - for newrule in string.split(rule, "|"): + if "|" in rule: # We found a rule to expand. + for newrule in rule.split("|"): if newrule in ruleset: print("Error: Rule %s, when expanded, overlaps %s" % ( rule, newrule))