handle case where ignore patterns not defined

This commit is contained in:
Alan Hamlett 2013-10-28 18:04:25 -07:00
parent 105df0d4b0
commit 14e1a5d2e0

View file

@ -140,13 +140,16 @@ def parseArguments(argv):
def should_ignore(fileName, patterns):
for pattern in patterns:
try:
compiled = re.compile(pattern, re.IGNORECASE)
if compiled.search(fileName):
return pattern
except re.error as ex:
log.warning('Regex error (%s) for ignore pattern: %s' % (str(ex), pattern))
try:
for pattern in patterns:
try:
compiled = re.compile(pattern, re.IGNORECASE)
if compiled.search(fileName):
return pattern
except re.error as ex:
log.warning('Regex error (%s) for ignore pattern: %s' % (str(ex), pattern))
except TypeError:
pass
return False